There is a Java-Soap-Service which I want to call with WSE 3.0, I generated a Proxy with the WSDL-File but the service expects MTOM for it´s data.
I also followed this tutorial and it worked well but didn´t helped:
http://twit88.com/blog/2008/05/14/net-mtom-enabled-your-application-using-wse/
The Exception I get is:
System.FormatException: "WSE839: An HTTP response was received that used the following content type: text/xml;charset=UTF-8. The following content type was expected: multipart/related; type=application/xop+xml."
I know WSE 3.0 is obsolete if there is an other way to do it please tell.
Can some one please help?
Change your generated classes base class from System.Web.Services.Protocols.SoapHttpClientProtocol to Microsoft.Web.Services3.WebServicesClientProtocol. Once that is done you will be able to access a field called RequireMtom. Set this to true prior to calling any method that needs to send MTOM. Make sure to disable it for non MTOM calls.
Related
I am using a third party Soap service. I have absolutely no access to server-side setting or code. I am getting the 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). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 812 bytes of the response were: '
As I don't have access to server-side settings or code, I tried to fix it on client-side. I tried changing the binding from basicHttpBinding to wsHttpBinding. But it did not work. It is a siple http service with no credentials.
I expect to be able to fix it on the client-side.
Given that you don’t know the service configuration on the server-side, we usually consume the web service by using the service metadata, which is often the below form.
https://vabqia969vm/Service1.svc?wsdl
Then we create a console application, call the service by adding service reference.
https://learn.microsoft.com/en-us/dotnet/framework/wcf/accessing-services-using-a-wcf-client
https://learn.microsoft.com/en-us/visualstudio/data-tools/how-to-add-update-or-remove-a-wcf-data-service-reference?view=vs-2019
Besides, please pay attention to the auto-generated configuration in the Appconfig file.
Feel free to let me know if there is anything I can help with.
I have a very simple program meant to use the Google Discovery API. However, when I try to use the getRest call, it fails as below. Any ideas? I'm using the most recent version of the Discovery API from NuGet, VS 2012 Pro.
DiscoveryService service = new DiscoveryService(new Google.Apis.Services.BaseClientService.Initializer());
//this works no problem
service.Apis.List().Execute();
//this works on the API reference page's Try It! area, but fails here
service.Apis.GetRest("admin", "directory_v1").Execute();
This is the resulting error that is thrown in the Google.Apis.Requests.ClientServiceRequest class, on the Execute() method - line 96:
JsonSerializationException was unhandled
Additional content found in JSON reference object. A JSON reference object should only have a $ref property. Path 'schemas.User.properties.name.description', line 1251, position 20.
This is a documented error. Get the generated discovery to discovery its own discovery document #79
The only work around I have currently found is to use the Client lib to log in and then manually make my requests from the Discovery API. Its messy and doesn't work very well because you can use the class structure that the Discovery API class library would have given you.
Very new to this. I am using a wsdl. Generating the web reference and .net builds the classes in references.cs. Now is there any way I can get the soap request going out though any c# methods in my code?
Getting at System.Xml.Serialization.XmlSerializer.Serialize error in prod but absolutely working fine in UAT. No body has no clue on why? Can someone pls provide insights on getting the soap request going out ?
You can use tool fiddler to track the request and responce
I have a web service that I want to consume driven by PHP and SOAP. I can add the web service just fine and I get the list of methods when I added(used add service reference when added). But now I get an error:
Warning 1 Custom tool warning: There was an error verifying some XML Schemas generated during export:
Type 'http://www.w3.org/2001/XMLSchema:struct' is not declared. localPATH:Reference.svcmap 1 1 SOAP_Webservice_Test
From what I understand, this is due to a specific type that I have in my PHP Soap API. I have googled but none of the mentioned fixes does it for me.
Any suggestions how to proceed with my debugging?
Closing this because the problem was not in the client, it was in the soap server I tried to refer to.
I have written a WCF REST API for third-party use. One of the things I want to do is to return custom error responses to clients if anything goes wrong. I don't want the WCF default error page showing that internal server error has occurred or method name not found.
To do so I throw WebFaultException<Error> where necessary. This return the following type of response to the client:
<Error>
<type>MissingTag</type>
<Desc>Tag 349 is missing</Desc>
</Error>
But how can I handle if any other type of error occurs like a serialization error or the "Method not found" error or place where I want to check that POST, PUT and PATCH have http header content-type present. I want to throw WebFaultException<> there too. I tried looking into IErrorHandler but could not get it working.
Any one got ideas on how to implement this type of thing. Also can I have a simple code demonstrating the IErrorHandler usage?
You can look into Message Inspectors BeforeSendReply for customizing the reply that needs to be sent to the client
If the content-type is not set when the request is made you can look into the AfterReceiveRequest where in you can customise the request received and then action as needed.