1
votes

When trying to generate a proxy code for this wsdl file (from an ASMX web service) , WsdlImporter (and svcutil) is reporting an error. I thought WCF is fully backwards compatible with ASMX web services? Please help

Below is an output from svcutil (I get the same errors using WsdlImporter)

Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.648]
Copyright (c) Microsoft Corporation.  All rights reserved.

Warning: The optional WSDL extension element 'header' from namespace 'http://sch
emas.xmlsoap.org/wsdl/soap/' was not handled.
XPath: //wsdl:definitions[@targetNamespace='http://mycompany.com/Enterprise/WebS
ervice/Finance/']/wsdl:binding[@name='FinanceServiceSoap']/wsdl:operation[@name=
'ProcessNonRefPayment']/wsdl:fault[@name='fault']

Warning: The optional WSDL extension element 'header' from namespace 'http://sch
emas.xmlsoap.org/wsdl/soap/' was not handled.
XPath: //wsdl:definitions[@targetNamespace='http://mycompany.com/Enterprise/WebS
ervice/Finance/']/wsdl:binding[@name='FinanceServiceSoap']/wsdl:operation[@name=
'ProcessRefPayment']/wsdl:fault[@name='fault']

Warning: The optional WSDL extension element 'header' from namespace 'http://sch
emas.xmlsoap.org/wsdl/soap/' was not handled.
XPath: //wsdl:definitions[@targetNamespace='http://mycompany.com/Enterprise/WebS
ervice/Finance/']/wsdl:binding[@name='FinanceServiceSoap']/wsdl:operation[@name=
'SearchPayments']/wsdl:fault[@name='fault']

Warning: The optional WSDL extension element 'header' from namespace 'http://sch
emas.xmlsoap.org/wsdl/soap/' was not handled.
XPath: //wsdl:definitions[@targetNamespace='http://mycompany.com/Enterprise/WebS
ervice/Finance/']/wsdl:binding[@name='FinanceServiceSoap']/wsdl:operation[@name=
'GetPayments']/wsdl:fault[@name='fault']

**Error: Cannot import wsdl:binding**
Detail: The given key was not present in the dictionary.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://mycompany.com
/Enterprise/WebService/Finance/']/wsdl:binding[@name='FinanceServiceSoap12']

**Error: Cannot import wsdl:port**
Detail: There was an error importing a wsdl:binding that the wsdl:port is depend
ent on.
XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://mycompany.com
/Enterprise/WebService/Finance/']/wsdl:binding[@name='FinanceServiceSoap12']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://mycompany.com
/Enterprise/WebService/Finance/']/wsdl:service[@name='FinanceService']/wsdl:port
[@name='FinanceServiceSoap12']
2

2 Answers

3
votes

You didn't ask for this, but it may help you more in the end....

The WSDL you've provided is over-designed and under-architected.

  1. There is a unique namespace for just about every complexType defined in the WSDL. This is unnecessary. You do not need an XML namespace to hold the definition of the Transaction message. Waaaaay too many namespaces. When I looked at it, I saw justification for only one namespace (http:///blahblah/Finance/). You may need more, but certainly you do not need so many. The vast number of namespaces is one reason the wsdl.exe tool crashed - it simply cannot handle it.

  2. There is no modularity. The XML Schema should be separate from the WSDL. For those namespaces that are justified, use a separate .xsd file for each, and perform an xsd:import for those schema. It could be you have a single XSD file.

  3. You've got complexTypes that derive from common base types, but nothing in the base types. No message Id, no message version. This seems like trouble.

  4. The WSDL as provided does not map the porttype to the binding. This is one reason the wsdl.exe will not generate code from it. wsdl.exe looks for a name attribute on the wsdl:input element in the porttype, which must match the name attribute on the wsdl:input on the binding.

  5. You've got too many bindings. Are you really going to need SOAP1.1, SOAP1.2, HTTPGET and HTTPPOST? Really? Pick one and stick with it.

What to do now?
You don't control the ASMX, I suppose, and you don't have access to the code. What I would do is manually re-work that WSDL so that it makes sense - separating all those schema into separate .xsd files. Then start with a simple subset of the WSDL, and get it so that it works. Iteratively add back the more complex pieces until you have what you need.

0
votes

wsdl.exe crashes when importing this WSDL, so there must be something really wrong with. Even a .NET 2.0 client cannot consume it. Could you post the code of the web service?