visual studio2010编写vb项目如何引用webservice的wsdl

  • Post author:
  • Post category:其他


假如你是一个visual studio 2010上用vb编码的coder,你打算在自己的vb项目上引用同一个局域网内的另一个java项目发布的web service,如何编码呢?

如下图,你看到了自己的vb项目

image

项目上右键,添加web引用

image

image

image

image

下面是导入这个web service所自动创建的代码

image

那么我们刚刚导入的wsdl究竟是很么样子的呢?


<definitions xmlns:wc="http://www.ptc.com/infoengine/soap/rpc/message/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:stk="http://schemas.microsoft.com/soap-toolkit/wsdl-extension" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns="http://schemas.xmlsoap.org/wsdl/" name="IESoap" targetNamespace="http://www.ptc.com/infoengine/soap/rpc/message/">
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" version="1.0" targetNamespace="http://www.ptc.com/infoengine/soap/rpc/message/">
<complexType name="ArrayOfstring">
<complexContent>
<restriction base="soapenc:Array">
<sequence>
<element name="item" minOccurs="0" maxOccurs="unbounded" type="xsd:string"/>
</sequence>
<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
</restriction>
</complexContent>
</complexType>
</schema>
</types>
<message name="IEResponse">
<part name="Collection" type="xsd:string"/>
</message>
<message name="GetAttrRequestMsg">
<part name="partNum" type="xsd:string"/>
<part name="guige" type="xsd:string"/>
</message>
<message name="GetAttrResponseMsg">
<part name="return" type="xsd:string"/>
</message>
<message name="GetPartStateRequestMsg">
<part name="strNumber" type="xsd:string"/>
</message>
<message name="GetPartStateResponseMsg">
<part name="return" type="xsd:string"/>
</message>
<message name="EbCheckInRequestMsg">
<part name="bominfo" type="xsd:string"/>
</message>
<message name="EbCheckInResponseMsg">
<part name="return" type="xsd:string"/>
</message>
<message name="uploadBOMRequestMsg">
<part name="bindata" type="wc:ArrayOfstring"/>
<part name="filename" type="xsd:string"/>
</message>
<portType name="IEService">
<operation name="GetAttr">
<input message="wc:GetAttrRequestMsg"/>
<output message="wc:GetAttrResponseMsg"/>
</operation>
<operation name="GetPartState">
<input message="wc:GetPartStateRequestMsg"/>
<output message="wc:GetPartStateResponseMsg"/>
</operation>
<operation name="EbCheckIn">
<input message="wc:EbCheckInRequestMsg"/>
<output message="wc:EbCheckInResponseMsg"/>
</operation>
<operation name="uploadBOM">
<documentation>JMS Example task.</documentation>
<input message="wc:uploadBOMRequestMsg"/>
<output message="wc:IEResponse"/>
</operation>
</portType>
<binding name="SoapBinding" type="wc:IEService">
<stk:binding preferredEncoding=""/>
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="GetAttr">
<soap:operation soapAction="urn:ie-soap-rpc:com.bplead.eb!GetAttr"/>
<input>
<soap:body use="encoded" namespace="http://www.ptc.com/infoengine/soap/rpc/message/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://www.ptc.com/infoengine/soap/rpc/message/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="GetPartState">
<soap:operation soapAction="urn:ie-soap-rpc:com.bplead.eb!GetPartState"/>
<input>
<soap:body use="encoded" namespace="http://www.ptc.com/infoengine/soap/rpc/message/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://www.ptc.com/infoengine/soap/rpc/message/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="EbCheckIn">
<soap:operation soapAction="urn:ie-soap-rpc:com.bplead.eb!EbCheckIn"/>
<input>
<soap:body use="encoded" namespace="http://www.ptc.com/infoengine/soap/rpc/message/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://www.ptc.com/infoengine/soap/rpc/message/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="uploadBOM">
<soap:operation soapAction="urn:ie-soap-rpc:com.bplead.eb!uploadBOM"/>
<input>
<soap:body use="encoded" namespace="http://www.ptc.com/infoengine/soap/rpc/message/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://www.ptc.com/infoengine/soap/rpc/message/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="IESoapServlet">
<port name="IESoapPort" binding="wc:SoapBinding">
<soap:address location="http://plmdev.tsmi.com/Windchill/servlet/RPC"/>
</port>
</service>
</definitions>

上述wsdl的发布者是局域网内windchill服务器的info*engine

image