SOAP in .NET Core?
Solution 1
In VS 2017, as of December '17 (v15.5) you can now add a generated WCF client to a service using WSDL from a .NET Standard project using Connected Services. In the Solution Explorer, you can get there from a right-click on "Dependencies" or right-click on the project under "Add..."
Solution 2
Microsoft currently does not plan to ship a SOAP server side framework for .NET Core. Neither the WCF ServiceHost nor ASMX are available. Too early to tell, which of the non-Microsoft stacks will jump in and be the dominant player.
With the introduction of ASP.NET Web API and the uprising of REST endpoints, WCF was dead. The WCF client is a interop story, not a forward going story (full story here: http://blog.tonysneed.com/2016/01/06/wcf-is-dead-long-live-mvc-6/)
Solution 3
Some months ago, due to a limitation WCF clients have (when integrating with a Java Web Service, someone created a response class with the same name as the method and in the same namespace and when the WCF client was sending a request it failed the serialization - can't find the related question in SO) I had to create a SOAP HTTP client that used underline the HttpClient. I eventually released an open source version (https://github.com/gravity00/SimpleSOAPClient) that we are successfully using in production and supports .NET Core and Xamarin applications. Feel free to give it a try. I recommend version 2.0.0-RC03 due to some major improvements since version 1.x.
Solution 4
I need SOAP for my legacy clients, so I created a separate SOAP library that is compatible with my legacy clients, using .NET framework, hosted in a separate environment. (SOAP.mywebsite.com). Then on www.mywebsite.com (created with asp.net Core, I have a rest interface. The SOAP layer calls the rest interface. The library to call the rest interface is generated using Swashbuckle.
Solution 5
Here u have a little trick I used targeting "framework 452" in an ASP.Net 5.0 Web App.
Unfortunately the new "Add connected service" -> "WCF service" only works when targeting ".Net Core", so I created a basic console app with same name as my web app.
Console apps allow to add "Service reference". Once added VS2015 creates all service references in folder "Service References".
Just move folder contents to Web solution and use a client constructor that accepts HttpBindings
and EndPoint
parameters.
In my case I'm connecting to Echosign service initializing client as follows:
using (EchoSignDocumentService16PortTypeClient service = new EchoSignDocumentService16PortTypeClient(new BasicHttpBinding(BasicHttpSecurityMode.Transport), new EndpointAddress(adddress)))
{
...
}
Related videos on Youtube
Yudhistira Arya
Updated on February 21, 2020Comments
-
Yudhistira Arya about 4 years
How you do SOAP in .NET Core? Are there any equivalents of Apache CXF in .Net Core (not just a simple SOAP client but full featured stack)?
Sorry if this is a very basic question, my search so far doesn't yield any clear answer.
-
Lex Li about 8 yearsWCF client side support is included, but there would be no server side.
-
-
Yudhistira Arya about 8 yearsThis is kinda sad, since for some cases, SOAP is still superior for backend communication between services.
-
Thomas about 8 yearsSad it is. Nevertheless, for a NEW stack (which Core essentially is) it is the right decision. REST takes over as SOAP killed CORBA and RPC before. But a little bit support for existing environment and policies would have been nice.
-
Marqueone over 7 yearsI've been looking for a working solution to not having access to consuming soap services and stumbled on your project, however the examples and tutorial don't seem to mesh with the library. Is this a v1.x vs 2.x issue?
-
João Simões over 7 yearsHi @Marqueone, I can try to help you with that. Feel free to open a GitHub issue with a code sample so I can give it a look.
-
Fanda over 7 yearsI read this many times. But WCF is not just SOAP! I can understand replacement of SOAP by the REST, but what about streams, named pipes, tcp, duplex etc.? REST will never catch these...
-
Thomas over 7 yearsAgree. However, only 10% of usage. And in 2017 heterogeneous world, these do not fit either.
-
Elaine almost 7 yearsServiceModel doesn't exist in .net core though
-
Ricardo Peres over 6 yearsMicrosoft is asking for feedback on this: blogs.msdn.microsoft.com/whereismysolution/2017/09/08/…
-
Thomas over 6 years@Fanda look close to SignalR Core regards async messaging. They are brewing something there.
-
zaitsman over 5 yearsThis is a good project. The only issue i had is that the svcutil generated classes i got have no XmlRoot attributes and so serialization with it doesn't work :(
-
Marc L. about 4 years"...only works when targeting '.Net Core'..." Should be noted that while searches are probably taking folks here, the OP was only asking about .NET Core.