WSDL into .NET core project
10,154
The problem is that your web service endpoint's WSDL uses a different way of storing the XML operation data. As Henk points out, using the wrapped
flag when manually running the dotnet-svcutil tool is the solution here.
- Edit your
.csproj
file and add the following node inside the<ItemGroup>
node:
<DotNetCliToolReference Include="dotnet-svcutil" Version="1.0.*" />
- Open up a PowerShell terminal from within the folder where the
.csproj
file resides. - Run
dotnet restore
. - Run
dotnet svcutil https://smp.difi.no/ws/2.0?wsdl -wr
.
The tool should now have generated the necessary artifacts inside ServiceReference1\Reference.cs
.
Related videos on Youtube
Comments
-
Andrew almost 2 years
I had worked before with WCF apps and there was no issue but now with this service I experienced some issues. I am not sure what is the reason behind but I cannot add https://smp.difi.no/ws/2.0?wsdl in my project.
The error I am also getting is the following:
Cannot import wsdl:port Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on. XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://service.elma.difi.no/']/wsdl:binding[@name='ElmaServiceImplServiceSoapBinding'] XPath to Error Source: //wsdl:definitions[@targetNamespace='http://service.elma.difi.no/']/wsdl:service[@name='ElmaServiceImplService']/wsdl:port[@name='ElmaServiceImplPort'] Cannot import wsdl:binding Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on. XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='no:difi:elma:smp:webservice']/wsdl:portType[@name='difi'] XPath to Error Source: //wsdl:definitions[@targetNamespace='http://service.elma.difi.no/']/wsdl:binding[@name='ElmaServiceImplServiceSoapBinding'] Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter Error: These members may not be derived. XPath to Error Source: //wsdl:definitions[@targetNamespace='no:difi:elma:smp:webservice']/wsdl:portType[@name='difi']
Any idea what is going wrong here? Tried it from SoapUI and works fine but not from VS.
-
Henk Holterman over 5 yearsGoogle
Error: These members may not be derived.
for some pointers. -
Henk Holterman over 5 yearsUsing the not-core framework you can resolve this with /wrapped on the command line, VS seems to do that automatically.
-
Henk Holterman over 5 yearsThere are dotnet core commandline tools, but I have no experience using them.
-
-
Levi Fuller over 4 yearsUnfortunately, if the underlying service is using SOAP 1.0 then you will still receive theses errors. The two options would be to update the service to be compatible with SOAP 1.1 standards or create a separate .NET Framework app and integrate with it.