Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix 'Unrecognized Message Version' after changing endpoint address

Tags:

c#

.net-core

wcf

I'm trying to consume a WCF service with a new endpoint in .NET Core 3.0. I added the service reference and have made a successful call.

After changing my WCF endpoint address to the same address I originally used, I'm getting an 'Unrecognized message version.' error. How can I get past this error?

I've already tried using a custom binding, changing the transport type, and SOAP version. I've narrowed down the issue to the endpoint address.

With the below snippet's commented line included, I get the error message. When I keep the address commented out, the service returns a valid response. I've verified that the service uses basic HTTP binding with no credentials needed.

using var client = new AccountServiceClient();
// client.Endpoint.Address = new EndpointAddress("<url redacted>");
var response = client.getAccountAsync(new AccountRequest ...

I am using the same URL in code as the one I originally configured for testing purposes; however, this URL will change depending on environment. The expected result should populate the response variable. Instead, I'm getting the following error message:

System.AggregateException : One or more errors occurred. (Unrecognized message version.)
---- System.ServiceModel.CommunicationException : Unrecognized message version.
like image 496
Brian Chambers Avatar asked Oct 30 '25 01:10

Brian Chambers


2 Answers

I solved my issue by removing the "?wsdl" from the URL of the service in the endpoint address.

For example, if the URL was "http://server/service?wsdl", I entered "http://server/service" in the endpoint address.

like image 143
Brian Chambers Avatar answered Oct 31 '25 17:10

Brian Chambers


I faced the same issue working with a SAP wsdl file. Unlike this Solution my link did not have the ?wsdl. In my case i noticed i was using the wsdl url instead of the wsdl endpoint

My wsdl url is like: http://192.168.0.11:8088/sap/bc/srt/wsdl/bndg_WBTSRN34RT681000000C0A8010A/wsdl11/allinone/ws_policy/document?sap-client=200

All i needed was to use the wsdl endpoint insted of the wsdl url. To find the wsdl endpoint open the wsdl file and check the address location under the wsdl:service tag

  <wsdl:service name="ZWS_FILEService">
    <wsdl:port name="ZWS_FILE" binding="tns:ZWS_FILE">
      <soap:address location="http://192.168.0.11:8088/sap/bc/srt/rfc/sap/zws_file/200/zws_file/zws_file"/>
    </wsdl:port>
  </wsdl:service>
like image 45
Towernter Avatar answered Oct 31 '25 17:10

Towernter