question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The envelope version of the incoming message (Soap12 (http://www.w3.org/2003/05/soap-envelope)) does not match that of the encoder (Soap11 (http://schemas.xmlsoap.org/soap/envelope/))

See original GitHub issue

Hi All,

Thanks for your efforts in putting this together. Trying it on a sample project have have run into the above error message. From my searching it appears that “BasicHttpBinding” is related to Soap 1.1 and wsBasicHttpBinding is for SOAP 1.2. By the looks of it, using System.ServiceModel does not support the ws binding.

The error happens at: var requestMessage = _messageEncoder.ReadMessage(httpContext.Request.Body, 0x10000, httpContext.Request.ContentType); in SoapEndpointMiddleware.cs

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:17 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
MickeyFinncommented, Feb 14, 2018

To Add some color into this issue as I’ve seen that it doesn’t seem to support custom binding. Code Example: // create Soap 1.2 Binding TextMessageEncodingBindingElement textBindingElement = new TextMessageEncodingBindingElement(MessageVersion.Soap12WSAddressing10, System.Text.Encoding.UTF8); HttpTransportBindingElement httpBindingElement = new HttpTransportBindingElement(); httpBindingElement.AllowCookies = true; httpBindingElement.MaxBufferSize = int.MaxValue; httpBindingElement.MaxReceivedMessageSize = int.MaxValue; CustomBinding soap12Binding = new CustomBinding(textBindingElement, httpBindingElement); // service app.UseSoapEndpoint<SoapService>(“/SoapService.svc”, soap12Binding);

Now call that service from a client and the stack trace is… Microsoft.AspNetCore.Server.Kestrel[13] Connection id “0HLBJT99U8TBU”, Request id “0HLBJT99U8TBU:00000001”: An unhandled exception was thrown by the application. System.InvalidOperationException: This message cannot support the operation because it has been read. at System.ServiceModel.Channels.Message.EnsureReadMessageState() at System.ServiceModel.Channels.Message.GetReaderAtBodyContents() at SoapCore.SoapEndpointMiddleware.GetRequestArguments(Message requestMessage, OperationDescription operation, Dictionary`2& outArgs) at SoapCore.SoapEndpointMiddleware.<ProcessOperation>d__7.MoveNext() — End of stack trace from previous location where exception was thrown —

1reaction
mtinwalacommented, Mar 10, 2020

I solved it with the following statement in the startup.cs:

TextMessageEncodingBindingElement textBindingElement = new TextMessageEncodingBindingElement(MessageVersion.Soap12WSAddressingAugust2004, System.Text.Encoding.UTF8);
HttpTransportBindingElement httpBindingElement = new HttpTransportBindingElement();
CustomBinding soap12Binding = new CustomBinding(textBindingElement, httpBindingElement);

app.UseSoapEndpoint<INotificationService>("/MyService.asmx", soap12Binding, SoapSerializer.XmlSerializer);

I implemented this kind of binding and now I am getting a different error.

crit: SoapCore.SoapEndpointMiddleware[0] An error occurred when trying to service a request on SOAP endpoint: /myendpoint.asmx System.InvalidOperationException: The body of the message cannot be read because it is empty. at System.ServiceModel.Channels.Message.GetReaderAtBodyContents() at SoapCore.SoapEndpointMiddleware.ProcessOperation(HttpContext httpContext, IServiceProvider serviceProvider) at SoapCore.SoapEndpointMiddleware.Invoke(HttpContext httpContext, IServiceProvider serviceProvider)

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Issue with service reference
The envelope version of the incoming message (Soap11 (http://schemas.xmlsoap.org/soap/envelope/)) does not match that of the encoder (Soap12 ...
Read more >
SOAP 1.2 WSDL · Issue #181 · DigDes/SoapCore
... envelope version of the incoming message (Soap11 (http://schemas.xmlsoap.org/soap/envelope/)) does not match that of the encoder (Soap12 ...
Read more >
SOAP response error to source - Forums - Mirth Community
... envelope version of the incoming message (Soap11 (http://schemas.xmlsoap.org/soap/envelope/)) does not match that of the encoder (Soap12 ...
Read more >
SOAP Version 1.2 Specification Errata
See Test Collection Errata; Errata for SOAP Version 1.2 schemas. ... xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> ...
Read more >
SOAP Version 1.2 Part 1: Messaging Framework (Second ...
A normative XML Schema [XML Schema Part 1], [XML Schema Part 2] document for the "http://www.w3.org/2003/05/soap-envelope" namespace can be ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found