Vb.net – How to create a proxy class in .NET using a WSDL File

axisPROXYsoapvb.netwsdl

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 /?'

If I use the svcutil.exe I also 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.

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>

Best Answer

Looking into the wsdl file you provided, You'll see references to four xsd (xml xchema document) files: they contain the type definitions and validation rules needed by svcutil to create the proxy.

   <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"/>

So, You need those xsd files too

Related Topic