Reputation: 6404
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.
Upvotes: 3
Views: 16839
Reputation: 53
pretty old question but for anyone wondering in 2024:
dotnet tool install --global dotnet-svcutil
would install a much more recent version that works with dotnet 6 for more info official doc
Upvotes: 0
Reputation: 26033
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.
.csproj
file and add the following node inside the <ItemGroup>
node:<DotNetCliToolReference Include="dotnet-svcutil" Version="1.0.*" />
.csproj
file resides.dotnet restore
.dotnet svcutil https://smp.difi.no/ws/2.0?wsdl -wr
.The tool should now have generated the necessary artifacts inside ServiceReference1\Reference.cs
.
Upvotes: 3