3
votes

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?

2

2 Answers

2
votes

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.

2
votes

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?