我一直在尝试使用Apache Axis SOAP Web服务的WSDL文件在VB.NET中生成Proxy类。
他们为我提供了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>
答案 0 :(得分: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文件