How to use soap web services in Asp.net Core?
Asked Answered
R

1

19

I have got some classes generated by wsdl for soap web services. These are using namespace System.Web.Services. How can I use them in asp.net core?

Ramose answered 20/2, 2015 at 0:49 Comment(0)
T
10

I have answered few days back on following question.

ASP.NET 5 add WCF service reference

In above case there is a WCF service and in your case it is Web Service.

Following thing you should concern or consider.

  1. It will not work with CoreCLR
  2. You have to add reference to "System.Web.Services" following way.

    aspnet50": { "frameworkAssemblies": {
    "System.Web.Services": "" }, "dependencies": { "ClassLibrary2": "1.0.0-*" } }

All other steps are similar that you have to create classlibrary project and add reference of that project or directly add class generated from WSDL to your asp.net 5 project.

Note : For this answer I have used VS 2015 CTP 5.

Troglodyte answered 20/2, 2015 at 1:53 Comment(6)
Probably a better solution for ASP.NET 5 and MVC 6 is to use answer https://mcmap.net/q/488563/-asp-net-5-add-wcf-service-reference from that same question. That will allow you to talk to an ASMX web service without needing System.Web or building a separate assembly. The only downside is that you will need to generate new proxy classes using svcutil.exe since the ones created by wsdl.exe do have the System.Web dependency. svcutil.exe will work for ASMX and WCF services, though. See msdn.microsoft.com/en-us/library/vstudio/… for more on using svcutil with ASMX servicesBreechloader
If you look at this question then it has specific use of utility called WSDL. When class generate using WSDL then it has dependency on System.Web.Services.Troglodyte
Yes, you're correct that if you MUST use the classes generated by wsdl.exe then you'll have the System.Web.Services dependency. If you only care about interacting with the ASMX service, though, using scvutil is a better option because you can use the new ASP.NET 5 stack (and MVC 6 as the question asked) instead of being limited to targeting net45.Breechloader
Since it seems like dnx is changing a lot with each release, I just want to mention that in order for me to build and run a project with System.Web.Service, I had to add dnx451": { "frameworkAssemblies": { "System.Web.Services": "" }, "dependencies": { "ClassLibrary2": "1.0.0-*" } } and remove dnxcore50": { } altogether. This is as of beta7. Im my example, you' might also be noticing dnx451 and dnxcore instead of aspnet45 and aspnet50 that appear in almost all the other posts about this topic on SO. Not sure the reason this was done, but its used all throughout github.com/aspnet.Atingle
@Nulref yes it may change now. I did answer when it was CTP 5Troglodyte
There is now an extension for this blogs.msdn.com/b/webdev/archive/2015/12/15/…Siskind

© 2022 - 2024 — McMap. All rights reserved.