I have a wcf web servis. It works properly on our iis application server. Now I need to move this application into another server. Without changing anything, it doesn't work new server. The problem is service response type turned text\html. When I have tried on soap ui at header tab:
Content-Type text/html; charset=UTF-8
When I tried in a simple console application I have got following error:
The content type text/html; charset=UTF-8 of the response message does
not match the content type of the binding (text/xml; charset=utf-8)
What am I doing wrong?
EDIT: I just realized that It work with this binding settings:
<bindings>
<basicHttpBinding>
<binding name="Binding1" hostNameComparisonMode="StrongWildcard" receiveTimeout="00:10:00" sendTimeout="00:10:00" openTimeout="00:10:00" closeTimeout="00:10:00" maxReceivedMessageSize="2147483647" maxBufferPoolSize="52428800" messageEncoding="Text" textEncoding="utf-8" bypassProxyOnLocal="false" useDefaultWebProxy="true">
<readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647" />
<security mode="TransportWithMessageCredential">
<message clientCredentialType="UserName"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
When I change security mode to "None" (that I need) content type is become text\html
Related
I have WCF SOAP service. One of operation return dynamic ContentType response. I tried to change request ContentType, add headers but no luck, ended into the same error.
See below:
WebOperationContext.Current.OutgoingResponse.ContentType = MimeType(document.Front.FileName);
e.g. MimeType
{".PDF", "application/pdf" },
{".JPG", "image/jpeg"},
{".PNG", "image/png"},
Server config:
<!-- language: lang-xml -->
<basicHttpBinding>
<binding name="BasicSecureBinding_IManager" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</binding>
Client config:
<!-- language: lang-xml -->
<binding name="BasicHttpBinding_DataService.IDataService"
allowCookies="false"
bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard"
messageEncoding="Text"
textEncoding="utf-8"
transferMode="Buffered"
useDefaultWebProxy="true">
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
As server and client configurations are very similar and are working for other SOAP APIs. But for an above-mentioned piece of code, it gives me an error.
Error:
The content type application/pdf of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '00000000-0000-0000-0000-000000000000JVBERi0x...
How I can invoke that operation to support dynamic content type?
NOTE:
I can not change server-side code.
I am facing 413 error in WCF service even if maxReceivedMessageSize is set to max i.e. 2147483647 and actual message size is less than 50kb.
This issue appears only when there is some ideal time between two request.
The exact scenario is as below:
1. Send 1000 messages each of them is around 38 kb. STATUS: PASS
2. Wait for sometime(Minimum 3 mins)
3. Send 1 message. STATUS: FAIL. (413 error)
I am using ws2007FederationHttpBinding. Web.config tag is as below:
<ws2007FederationHttpBinding>
<binding name="federationHttpBinding" openTimeout="00:04:00" closeTimeout="00:04:00" receiveTimeout="00:04:00" sendTimeout="00:40:00" maxReceivedMessageSize="2147483647">
<!-- <readerQuotas maxArrayLength="2147483647" maxDepth="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647" /> -->
<security mode="TransportWithMessageCredential">
<message establishSecurityContext="false">
</message>
</security>
</binding>
</ws2007FederationHttpBinding>
Client side binding tag is as below:
<ws2007FederationHttpBinding>
<binding name="AuthorizationBinding" openTimeout="00:04:00" closeTimeout="00:04:00" receiveTimeout="00:04:00" sendTimeout="00:40:00" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647">
<readerQuotas maxArrayLength="2147483647" maxDepth="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/>
<security mode="TransportWithMessageCredential">
<message establishSecurityContext="false"/>
</security>
</binding>
</ws2007FederationHttpBinding>
I think you could solve this problem by removing the name attribute from the binding tag, A similar problem could be found here
WCF service maxReceivedMessageSize basicHttpBinding issue
You also have to set maxBufferSize
<binding name="federationHttpBinding"
maxReceivedMessageSize="2147483647"
maxBufferSize="2147483647"
maxBufferPoolSize="2147483647">
There is a wsdl hosted on apache or jboss on a remote server that I am trying to use in my c# project. I have added a service reference in visual studio, which automatically generated an app.config file for me, where the system.serviceModel section looks as follows
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="ArtesiaWebServicesHttpBinding" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="655360" maxBufferPoolSize="524288" maxReceivedMessageSize="655360"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://serverpath/ArtesiaWebServices"
binding="basicHttpBinding" bindingConfiguration="ArtesiaWebServicesHttpBinding"
contract="DAMService.ArtesiaWebServicesInterface" name="ArtesiaWebServicesHttpPort" />
</client>
</system.serviceModel>
At runtime, during a method call, I get the following error:
The content type multipart/related; type="application/xop+xml"; start=""; start-info="text/xml"; boundary="----=_Part_386_1206794365.1374255761229" of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly.
What could be the problem?
The problem was solved by changing messageEncoding property of the binding to "Mtom" instead of "Text"
I have the following Visual Studio Web application structure:
CustomerManagement\
- Services
- Customers.aspx
- Customers.aspx.cs
- CustomersWcfDS.svc
- Default.aspx
- web.config
The following code is inside the <configuration> in the web.config file:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ICustomers" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:1112/Services/Customers.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICustomers" contract="CustomersService.ICustomers" name="BasicHttpBinding_ICustomers" />
</client>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
I build the project and enter the following URL but there is no reactions.
http://localhost:1112/Services/Customers.svc
I also tried the following:
http://localhost:1112/Services/CustomersWcfDS.svc
and also
http://localhost:1110/Services/Customers.svc
and
http://localhost:1110/Services/CustomersWcfDS.svc
(The port 1110 was tested because of the Project Properties Port number was set to 1110.)
but it still fail to display something similar like the following illustration
So, is there any expert that can advise me where have my WCF service URL gone to?
Hi based on your image,
I think you have renamed the service name as Customers.svc . But still it refering to the previous one. What you can do is try to find the "SimpleService.svc" in your entire solution
and rename it as Customers.svc. If you have any problem put it as a comment.
I'm new to using Service Reference in Visual Studio, and I'm trying to consume a Java Web Service. I've added Service Reference using the wizard. The wizard built the proxy code and added endpoints to the config file.
The Java Endpoint takes a custom type as single parameter. I've populated the object via the proxy objects and passed that in the call to the service. But when I look at the response object, all the properties are null. No error is thrown. Note, when I use soapUI I can edit and send XML to the service and successfully get a response. If an error occurs I can view the XML error message sent back in soapUI.
Here is the calling code:
static void CallJavaEndPoint()
{
IFX_ProductInqRq inqRQ = new IFX_ProductInqRq();
IFX_ProductInqRqCatSvcRq[] CatSvcRqCollection = new IFX_ProductInqRqCatSvcRq[1];
IFX_ProductInqRqCatSvcRq CatSvcRqItem = new IFX_ProductInqRqCatSvcRq();
IFX_ProductServiceReference.FX_Product_PortTypeClient proxy = new FX_Product_PortTypeClient();
IFX_ProductInqRs response;
// Remove other code for setting properties for brevity
CatSvcRqItem.RequestID = "123456";
CatSvcRqCollection[0] = CatSvcRqItem;
inqRQ.CatSvcRq = CatSvcRqCollection;
// reponse just comes back null, no errors
response = proxy.IFX_CustomerAccountDetailInquiry(inqRQ);
}
from config file:
<basicHttpBinding>
<binding name="IFX_Product_Binding" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="IFX_Product_Binding1" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://example.com/EX_IFXProduct/services/Product_SoapPort_1234"
binding="basicHttpBinding" bindingConfiguration="IFX_Product_Binding"
contract="IFX_ProductServiceReference.IFX_Product_PortType"
name="Product_SoapPort_1234" />
</client>
Questions:
Am I calling the Java Web Service correctly?
How would I view the XML error being returned?
Am I better off using a Web Reference or the WebRequest/HttpWebRequest to connect to this Java Web Service?
You could use a tool like Fiddler to inspect the request/response that you are sending from code and then compare that to the successful request that you send with SoapUI.
What you have to do is review the generated Reference.cs file. There will be a couple of namespace attributes that differs. When you inspect the response using SoapUI you will find the correct namespace. Replace all the namespace references in the Reference.cs file with the namespace you have found in the SoapUI response.
When you finished replacing the namespaces you will see that the response is now serialized well.
Keep in mind that the Reference.cs is a generated file and that you lose the changes when you are updating the service reference.