Code Monkey home page Code Monkey logo

Comments (3)

CezaryKlus avatar CezaryKlus commented on June 30, 2024

This is something related to the SOAP message processing/validation.
What makes the error happen is the SOAP message with the default namespace defined e.g.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:int="..." **xmlns=**"...">
and content like

   <soap:Header/>
   <soap:Body>
      <int:x>
         <int:y>
            **<z></z>**

as soon as I change the message to
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:int="..." **xmlns:mes=**"...">

   <soap:Header/>
   <soap:Body>
      <int:x>
         <int:y>
            **<mes:z></mes:z>**

it gets processed successfully.
Although was not able to reproduce in a project created from scratch based on CoreWCF template.

from corewcf.

jimm98y avatar jimm98y commented on June 30, 2024

I'm running into this as well with Onvif messages:

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
       <GetCapabilities xmlns="http://www.onvif.org/ver10/device/wsdl">
            <Category>All</Category>
       </GetCapabilities>
   </s:Body>
</s:Envelope>

CoreWCF fails with:

System.ObjectDisposedException: 'Message is closed.'

>	CoreWCF.Primitives.dll!CoreWCF.Channels.BufferedMessage.Properties.get() Line 1615	C#
 	CoreWCF.Http.dll!CoreWCF.Channels.AspNetCoreReplyChannel.HandleRequest(Microsoft.AspNetCore.Http.HttpContext context) Line 127	C#
 	CoreWCF.Http.dll!CoreWCF.Channels.RequestDelegateHandler.HandleRequest(Microsoft.AspNetCore.Http.HttpContext context) Line 125	C#
 	CoreWCF.Http.dll!CoreWCF.Channels.ServiceModelHttpMiddleware.InvokeAsync(Microsoft.AspNetCore.Http.HttpContext context) Line 49	C#
 	CoreWCF.Primitives.dll!CoreWCF.Channels.MetadataMiddleware.BuildBranch.AnonymousMethod__2(Microsoft.AspNetCore.Http.HttpContext reqContext) Line 103	C#
 	CoreWCF.Primitives.dll!CoreWCF.Channels.MetadataMiddleware.InvokeAsync(Microsoft.AspNetCore.Http.HttpContext context) Line 53	C#
 	Microsoft.AspNetCore.Diagnostics.dll!Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(Microsoft.AspNetCore.Http.HttpContext context)	Unknown
 	Microsoft.AspNetCore.HostFiltering.dll!Microsoft.AspNetCore.HostFiltering.HostFilteringMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext context)	Unknown
 	Microsoft.WebTools.BrowserLink.Net.dll!Microsoft.WebTools.BrowserLink.Net.BrowserLinkMiddleware.InvokeAsync(Microsoft.AspNetCore.Http.HttpContext context)	Unknown
 	Microsoft.WebTools.BrowserLink.Net.dll!Microsoft.WebTools.BrowserLink.Net.VsContentMiddleware.InvokeAsync(Microsoft.AspNetCore.Http.HttpContext context)	Unknown
 	Microsoft.AspNetCore.Watch.BrowserRefresh.dll!Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware.InvokeAsync(Microsoft.AspNetCore.Http.HttpContext context)	Unknown
 	Microsoft.AspNetCore.Server.Kestrel.Core.dll!Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests<Microsoft.AspNetCore.Hosting.HostingApplication.Context>(Microsoft.AspNetCore.Hosting.Server.IHttpApplication<Microsoft.AspNetCore.Hosting.HostingApplication.Context> application)	Unknown
 	Microsoft.AspNetCore.Server.Kestrel.Core.dll!Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequestsAsync<Microsoft.AspNetCore.Hosting.HostingApplication.Context>(Microsoft.AspNetCore.Hosting.Server.IHttpApplication<Microsoft.AspNetCore.Hosting.HostingApplication.Context> application)	Unknown
 	Microsoft.AspNetCore.Server.Kestrel.Core.dll!Microsoft.AspNetCore.Server.Kestrel.Core.Internal.HttpConnection.ProcessRequestsAsync<Microsoft.AspNetCore.Hosting.HostingApplication.Context>(Microsoft.AspNetCore.Hosting.Server.IHttpApplication<Microsoft.AspNetCore.Hosting.HostingApplication.Context> httpApplication)	Unknown
 	Microsoft.AspNetCore.Server.Kestrel.Core.dll!Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure.KestrelConnection<Microsoft.AspNetCore.Connections.ConnectionContext>.ExecuteAsync()	Unknown
 	Microsoft.AspNetCore.Server.Kestrel.Core.dll!Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure.KestrelConnection<System.__Canon>.System.Threading.IThreadPoolWorkItem.Execute()	Unknown

I'm using the sample app from this repo with WsHttpBinding (needed for Soap 1.2) and Onvif generated from WSDL using svcutil.exe -sc.

from corewcf.

jimm98y avatar jimm98y commented on June 30, 2024

So in my case, it turned out I was using incorrect binding:

var binding = new WSHttpBinding(SecurityMode.None);
binding.Security.Message.ClientCredentialType = MessageCredentialType.None;

I fixed it by using the following which also works on the client side:

    var httpTransportBinding = new HttpTransportBindingElement
    {
        AuthenticationScheme = AuthenticationSchemes.Anonymous
    };
    var textMessageEncodingBinding = new TextMessageEncodingBindingElement
    {
        MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None)
    };  
    var binding = new CustomBinding(textMessageEncodingBinding, httpTransportBinding);

from corewcf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.