1

我一直在尝试使用 Apache Axis SOAP Web 服务的 WSDL 文件在 VB.NET 中生成代理类。

他们为我提供了 WSDL 文件,当我使用 WSDL.exe 命令(在 Visual Studio 08 中)并将其指向本地路径时出现错误。

wsdl /language:vb c:\Orders.wsdl

(我正在尝试创建一个使用托管在 Apache Axis 2 上的 SOAP Web 服务的 .NET 客户端)

错误

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

如果我使用 svcutil.exe,我还会收到一条错误消息...

svcutil.exe C:\Orders.wsdl /t:code /l:VB /o:"C:\Orders.VB"

是什么导致了问题?

您的帮助将不胜感激,谢谢。

WSDL 代码

    <?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>
4

1 回答 1

3

查看您提供的 wsdl 文件,您将看到对四个 xsd(xml xchema 文档)文件的引用:它们包含 svcutil 创建代理所需的类型定义和验证规则。

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

所以,你也需要那些 xsd 文件

于 2012-04-20T11:06:30.360 回答