Reputation: 2136
I'm attempting to add this SOAP endpoint located here: http://ds.hitpromo.net/product
However I get the following error:
Scaffolding Code ... Error:Error: Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter Error: The datatype 'http://schemas.xmlsoap.org/soap/encoding/:Array' is missing. XPath to Error Source: //wsdl:definitions[@targetNamespace='urn:ProductControllerwsdl']/wsdl:portType[@name='ProductControllerPortType'] Error: 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='urn:ProductControllerwsdl']/wsdl:portType[@name='ProductControllerPortType'] XPath to Error Source: //wsdl:definitions[@targetNamespace='urn:ProductControllerwsdl']/wsdl:binding[@name='ProductControllerBinding'] Error: 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='urn:ProductControllerwsdl']/wsdl:binding[@name='ProductControllerBinding'] XPath to Error Source: //wsdl:definitions[@targetNamespace='urn:ProductControllerwsdl']/wsdl:service[@name='ProductControllerService']/wsdl:port[@name='ProductControllerPort'] Error: No endpoints compatible with .Net Core apps were found. An error occurred in the tool.
Failed to generate service reference.
As I understand it, it's because .NET's SOAP generation code doesn't understand to include the types from xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/"
I've read about manually including it but the directions are unclear (including other StackOverflow answers on this subject), downloading the WSDL and using import/include hasn't worked.
Any ideas?
Upvotes: 3
Views: 1327
Reputation: 789
I solved this downloading the WSDL file to a specific path. After that I downloaded the https://schemas.xmlsoap.org/soap/encoding/ XML file like this.
Then I executed svcutil referencing both files and everything worked:
svcutil mywsdl.xml schemas.xmlsoap.org_soap_encoding_.xml
Note: dotnet-svcutil didn't work, I used the original svcutil.exe executable. But the result worked with .NET core.
Upvotes: 1
Reputation: 2356
A couple things you could try:
1.) Create a local copy of the wsdl and remove the offending xml namespace. Then when adding the service reference point it to your local copy.
2.) Try pulling in the service as a Web Reference instead of as a Service Reference. Add Service Reference => Advanced => Add Web Reference.
3.) You might have to go back to .Net 4.x as .Net Core support for SOAP services may not be mature enough to handle legacy WSDLs.
I had a situation that was somewhat similar using .Net 4.5 and WCF - here is a link: How can I create custom XML namespace attributes when consuming a legacy SOAP service?
Upvotes: 2
Reputation: 196
I tried the given address http://ds.hitpromo.net/product
and successfully added it as a service reference to a project without any problems.
Maybe adding it as a Web Reference might help you out. Can you try "Add Service Reference" => Select "Advanced" => Then Select "Add Web Reference" and add it from there.
In the past adding the endpoint as a web reference solved some similar issues for me.
Upvotes: 2