WsdlImporter error while importing wsdl from ASMX web service
When trying to generate a proxy for this wsdl file (from ASMX web service) WsdlImporter (and svcutil) reports an error. I thought WCF was completely backward compatible with ASMX web services? Please, help
Below is the output of svcutil (I am getting 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']
a source to share
You didn't ask for this, but it might help you more in the end.
The WSDL you provided is overdeveloped and non-critical.
-
There is a unique namespace for each complex type defined in the WSDL. It's not needed. You do not need an XML namespace to store a transaction description. Waaaaay too many namespaces. When I looked at it, I saw an excuse for just one namespace (
http:///blahblah/Finance/
). You may need more, but of course you don't need that much. The sheer number of namespaces is one of the reasons the wsdl.exe tool crashed - it just can't handle it. -
No modularity. XML schema should be separated from WSDL. For those namespaces that are reasonable, use a separate .xsd file for each and import xsd: for that schema. You may have one XSD file.
-
You have complexTypes that come from common base types, but nothing from base types. No message Id, no message version. It looks like trouble.
-
WSDL, as stated, does not map port type to binding. This is one of the reasons why wsdl.exe will not generate code from it. wsdl.exe looks for the name attribute on the wsdl: input element in the port type, which must match the name attribute on the wsdl: input on the binding.
-
You have too many bindings. Do you really need SOAP1.1, SOAP1.2, HTTPGET and HTTPPOST? Indeed? Pick one and stick with it.
What now?
You do not control ASMX, I suppose, and you do not have access to the code. I would do it manually, reworking the WSDL to make sense - to separate all these schemas from separate .xsd files. Then start with a simple subset of WSDL and get it to work. Add more complex snippets iteratively until you get what you need.
a source to share