Based on your description, I understand that you've saved the WSDL document to local file and use Visual Studio or wsdl.exe to generate client proxy based on the local WSDL file, correct?
If so, have you maked sure all the WSDL documents(include the referenced schema documents) have been downloaded to local files? According to the WSDL document, you can find that the main WSDL document contains some <import> element which point to some external
schema documents. Therefore, if you need to download the WSDL document to local(due to network access issues on the development machine), you should also download all the referernced external schema files.
And the error message you posted also indicate the proxy generation tool cannot locate the first external schema file.
Also, another possible means is that you find a machine which can connect to the remote service and use that machine for generrating the service proxy. And then, you can copy the generated proxy code to the development for use.
I finally got the xsd files from the web service host and I was able to generate the proxy class by passing in the xsd paths into the wsdl.exe command prompt as you suggested and it generated it nicely.
securtek
0 Points
2 Posts
How do I create a Proxy Class for a .NET Client using a WSDL File?
Apr 20, 2012 09:28 AM|LINK
Hello, I have been trying to generate a Proxy class in VB.NET using a WSDL file for an Apache Axis SOAP Web Service.
They have provided me the WSDL file and when I use the WSDL.exe command (In Visual Studio 08) and point it to the local path I get an error.
wsdl /language:vb c:\Orders.wsdl
(I am trying to create a .NET Client that consumes the SOAP Web Service Hosted on Apache Axis 2)
The Error
Unable to import binding 'OrdersSoapBinding' from namespace 'urn:company:orders:schemas:OrderTypes:1.00'.
-Unable to import operation 'placeOrder'
-The element 'urn:company:remtp:schemas:PlaceOrderRequest:1.00:PlaceOrderRequest' is missing
if you would like more help, please type 'wsdl /?'
WSDL Code:
<?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="urn:company:orders:schemas:OrderTypes:1.00" xmlns:impl="urn:company:orders:schemas:OrderTypes:1.00" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:poreq="urn:company:remtp:schemas:PlaceOrderRequest:1.00" xmlns:poresp="urn:company:remtp:schemas:PlaceOrderResponse:1.00" xmlns:coreq="urn:company:remtp:schemas:CommitOrderRequest:1.00" xmlns:coresp="urn:company:remtp:schemas:CommitOrderResponse:1.00" xmlns="http://schemas.xmlsoap.org/wsdl/"> <wsdl:types> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:company:orders:schemas:OrderTypes:1.00"> <import namespace="urn:company:remtp:schemas:PlaceOrderRequest:1.00" schemaLocation="../schemas/placeOrderRequest.xsd"/> <import namespace="urn:company:remtp:schemas:PlaceOrderResponse:1.00" schemaLocation="../schemas/placeOrderResponse.xsd"/> <import namespace="urn:company:remtp:schemas:CommitOrderRequest:1.00" schemaLocation="../schemas/commitOrderRequest.xsd"/> <import namespace="urn:company:remtp:schemas:CommitOrderResponse:1.00" schemaLocation="../schemas/commitOrderResponse.xsd"/> </schema> </wsdl:types> <wsdl:message name="placeOrderRequest"> <wsdl:part element="poreq:PlaceOrderRequest" name="parameters"/> </wsdl:message> <wsdl:message name="placeOrderResponse"> <wsdl:part element="poresp:PlaceOrderResponse" name="parameters"/> </wsdl:message> <wsdl:message name="commitOrderRequest"> <wsdl:part element="coreq:CommitOrderRequest" name="parameters"/> </wsdl:message> <wsdl:message name="commitOrderResponse"> <wsdl:part element="coresp:CommitOrderResponse" name="parameters"/> </wsdl:message> <wsdl:portType name="Orders"> <wsdl:operation name="placeOrder"> <wsdl:input message="impl:placeOrderRequest"/> <wsdl:output message="impl:placeOrderResponse"/> </wsdl:operation> <wsdl:operation name="commitOrder"> <wsdl:input message="impl:commitOrderRequest"/> <wsdl:output message="impl:commitOrderResponse"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="OrdersSoapBinding" type="impl:Orders"> <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="placeOrder"> <wsdlsoap:operation soapAction=""/> <wsdl:input name="placeOrderRequest"> <wsdlsoap:body use="literal" /> </wsdl:input> <wsdl:output name="placeOrderResponse"> <wsdlsoap:body use="literal" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="commitOrder"> <wsdlsoap:operation soapAction=""/> <wsdl:input name="commitOrderRequest"> <wsdlsoap:body use="literal" /> </wsdl:input> <wsdl:output name="commitOrderResponse"> <wsdlsoap:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="OrdersService"> <wsdl:port name="Orders" binding="impl:OrdersSoapBinding"> <wsdlsoap:address location="https://companyorders.co.uk/endpoints/services/Orders"/> </wsdl:port> </wsdl:service> </wsdl:definitions>Also, if I use the svcutil.exe I get an error message... svcutil.exe C:\Orders.wsdl /t:code /l:VB /o:"C:\Orders.VB"
What is causing the problem?
Your help will be much appreciated, Thank you.
Steven Cheng...
Contributor
4187 Points
547 Posts
Microsoft
Moderator
Re: How do I create a Proxy Class for a .NET Client using a WSDL File?
Apr 23, 2012 05:37 AM|LINK
Hi securtek,
Based on your description, I understand that you've saved the WSDL document to local file and use Visual Studio or wsdl.exe to generate client proxy based on the local WSDL file, correct?
If so, have you maked sure all the WSDL documents(include the referenced schema documents) have been downloaded to local files? According to the WSDL document, you can find that the main WSDL document contains some <import> element which point to some external schema documents. Therefore, if you need to download the WSDL document to local(due to network access issues on the development machine), you should also download all the referernced external schema files.
<wsdl:types> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:company:orders:schemas:OrderTypes:1.00"> <import namespace="urn:company:remtp:schemas:PlaceOrderRequest:1.00" schemaLocation="../schemas/placeOrderRequest.xsd"/> <import namespace="urn:company:remtp:schemas:PlaceOrderResponse:1.00" schemaLocation="../schemas/placeOrderResponse.xsd"/> <import namespace="urn:company:remtp:schemas:CommitOrderRequest:1.00" schemaLocation="../schemas/commitOrderRequest.xsd"/> <import namespace="urn:company:remtp:schemas:CommitOrderResponse:1.00" schemaLocation="../schemas/commitOrderResponse.xsd"/> </schema> </wsdl:types>And the error message you posted also indicate the proxy generation tool cannot locate the first external schema file.
Also, another possible means is that you find a machine which can connect to the remote service and use that machine for generrating the service proxy. And then, you can copy the generated proxy code to the development for use.
Feedback to us
Microsoft One Code Framework
securtek
0 Points
2 Posts
Re: How do I create a Proxy Class for a .NET Client using a WSDL File?
May 01, 2012 02:31 PM|LINK
Hello Steven,
I finally got the xsd files from the web service host and I was able to generate the proxy class by passing in the xsd paths into the wsdl.exe command prompt as you suggested and it generated it nicely.
wsdl.exe c:\Orders.wsdl c:\placeOrderRequest.xsd c:\placeOrderResponse.xsd c:\commitOrderRequest.xsd c:\commitOrderResponse.xsd /l:VB /o:"C:\Orders.VB"
Thank you for the help.