Open mehrdadniroomand opened 6 years ago
Hi @mehrdadniroomand, is it possible to share the service address (if public?) or the service wsdl so we can investigate?
thanks,
@mehrdadniroomand thank you for the provided information, we will investigate.
I have the same problem using "Microsoft WCF Web Service Reference Provider" over .NET Core.
With "Add service reference" over .Net classic projects works without problems.
Any suggestion?
@mehrdadniroomand @charce36 I don't know if you guys got this working, but I worked around the issue with these steps:
Seems like it only cares about encoding when adding the reference, since consuming the service works fine after doing this.
@mehrdadniroomand @charce36 I don't know if you guys got this working, but I worked around the issue with these steps:
- Download the wsdl file
- Change the encoding attribute to "UTF-8"
- Generate the service classes from your local file
- Change "Uri" in ConnectedService.json to the real URL (it points to your local file now)
Seems like it only cares about encoding when adding the reference, since consuming the service works fine after doing this.
Hi @magnusvw , it seems this method, doesnt work for me. It still response with the same error message
The content type text/xml; charset=ISO-8859-1 of the response message does not match the content type of the binding (text/xml; charset=utf-8)
Is there a fix for this yet? I am still getting the problem which is preventing me from moving over to dot net core.
@Joe-Goodall We have not made a fix for this yet, it's still in our backlog to get to. Are you not able to work around it using an approach similar to what's been posted? It sounds like this is just a problem of the serialization code reading the wsdl and having the encoding not match what's declared.
For the wsdls provided I can work around it by simply saving the wsdl file (from ?singlewsdl) to disk and running the tool on the local file instead of the url. It's not ideal to have to use a workaround, but from my current understanding this shouldn't be a blocking problem because you should be able to take the text from the wsdl and save it with an encoding that works.
@dasetser How to do I go about downloading the wsdl file?
The service I am trying to use is http://api.despatchbay.com/soap/v15/shipping.php?wsdl
@Joe-Goodall Going to http://api.despatchbay.com/soap/v15/shipping.php?singlewsdl shows you the full text of the wsdl file. You can just copy paste it to a text file or use your browser's save feature (Ctrl+S on most browsers), and save it with the .wsdl extension. Then you can pass in the full path of the wsdl file to the tool.
Hi. I got the webservice working with the approach above. But since the server uses ISO-8859-1 when I am receiveing the answer I get :
The content type text/xml; charset=ISO-8859-1 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 869 bytes of the response were: ...
Is there any workaround for the answer?Thanks.
@dasetser It appears to be that I have misread the original issue. I can generate the code from wsdl file perfectly fine, but when I call a web service method I get the same error as @jardg
@mconnew Do you have any suggestions for what to do when getting this error at runtime?
I finally got it working thanks to implementing a CustomBinding using this post http://pathfindertech.net/connecting-to-a-php-web-service-with-wcf-in-c/ .
For .Net Core I needed to import the NuGet package System.ServiceModel.Primitives and then make some little changes in the CustomTextMessageBindingElement class I downloaded from the link. Such as not implementing IWsdlExportExtension and his methods and remove BuildChannelListener and CanBuildChannelListener implementations.
I put the final code for this class in : https://plnkr.co/edit/Cwa2If679ft4pvSP0bYx
Then I only need to do this for the webservice client:
CustomBinding binding = new CustomBinding(new CustomTextMessageBindingElement("iso-8859-1", "text/xml", MessageVersion.Soap11), new HttpTransportBindingElement()); //Or HttpsTransportBindingElement
webService.Endpoint.Binding = binding;
Following @jardg advice, I managed to consume a ISO-8859-1 encoded SOAP WS:
Now I'm stuck at serializing the response, I have as response this XML:
`<?xml version="1.0" encoding="ISO-8859-1"?>
Fellows, 3 years later, this issue still exists. How about re-prioritizing, please?
Hi there When I want to add a web services(asmx,wsdl) to the asp.net core2.0 v15.5, I will encounter this error in the status box: "The encoding in the declaration 'ISO-8859-1' does not match the encoding of the document 'utf-8' " but in webform or mvc projects it works well with out any error. How can I fix this error?