注册
 找回密码
 注册
江西广告网
查看: 215|回复: 0
打印 上一主题 下一主题

wsdl

[复制链接]

该用户从未签到

1
跳转到指定楼层
发表于 2009-2-12 09:00:15 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?注册

x
<wsdl:types /> <wsdl:message name="AddSoapIn"> <wsdl:part name="a" type="s:int" /> <wsdl:part name="b" type="s:int" /> </wsdl:message> <wsdl:message name="AddSoapOut"> <wsdl:part name="AddResult" type="s:int" /> </wsdl:message> <wsdl:portType name="MathServiceSoap"> <wsdlperation name="Add"> <wsdl:input message="tns:AddSoapIn" /> <wsdlutput message="tns:AddSoapOut" /> </wsdlperation> </wsdl:portType> <wsdl:binding name="MathServiceSoap" type="tns:MathServiceSoap"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> <wsdl:operation name="Add"> <soap:operation soapAction="http://idior.cnblogs.com/Math/Add" style="rpc" /> <wsdl:input> <soap:body use="encoded" namespace="http://tempuri.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </wsdl:input> <wsdl:output> <soap:body use="encoded" namespace="http://tempuri.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:types /> <wsdl:message name="AddSoapIn"> <wsdl:part name="a" type="s:int" /> <wsdl:part name="b" type="s:int" /> </wsdl:message> <wsdl:message name="AddSoapOut"> <wsdl:part name="AddResult" type="s:int" /> </wsdl:message> <wsdl:portType name="MathServiceSoap"> <wsdl:operation name="Add"> <wsdl:input message="tns:AddSoapIn" /> <wsdl:output message="tns:AddSoapOut" /> </wsdl:operation> </wsdl:portType> <wsdl:binding name="MathServiceSoap" type="tns:MathServiceSoap"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> <wsdl:operation name="Add"> <soap:operation soapAction="http://idior.cnblogs.com/Math/Add" style="rpc" /> <wsdl:input> <soap:body use="encoded" namespace="http://tempuri.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </wsdl:input> <wsdl:output> <soap:body use="encoded" namespace="http://tempuri.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </wsdl:output> </wsdl:operation> </wsdl:binding>view plaincopy to clipboardprint? [1] [2] [3] 以上是一段wsdl的片断,其中主要定义了一个Add方法。针对粗体字部分,我们得到以下使用该webservice的soap请求。 view plaincopy to clipboardprint? POST /WebService1/Service1.asmx HTTP/1.1 Host: localhost Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://idior.cnblogs.com/Math/Add" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://tempuri.org/" xmlns:types="http://tempuri.org/encodedTypes" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <tns:Add> <a xsi:type="xsd:int">int</a> <b xsi:type="xsd:int">int</b> </tns:Add> </soap:Body> </soap:Envelope> POST /WebService1/Service1.asmx HTTP/1.1 Host: localhost Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://idior.cnblogs.com/Math/Add" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://tempuri.org/" xmlns:types="http://tempuri.org/encodedTypes" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <tns:Add> <a xsi:type="xsd:int">int</a> <b xsi:type="xsd:int">int</b> </tns:Add> </soap:Body> </soap:Envelope>view plaincopy to clipboardprint? 可以看出在WSDL中定义好的SoapAction被放在了Http的请求头中, 为了调用Add这个WebService中的方法,SOAP包中粗体字部分发出的请求恰恰对应了WSDL中定义的<STRONG>operation的name---Add.</STRONG><>那么对于下面的WSDL文件,我们又该发出怎样的SOAP请求呢?</P><RE class=xml name="code"><wsdl:types> <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/"> <s:element name="Add"> <s:complexType> <s:sequence> <s:element minOccurs="1" maxOccurs="1" name="a" type="s:int" /> <s:element minOccurs="1" maxOccurs="1" name="b" type="s:int" /> </s:sequence> </s:complexType> </s:element> <s:element name="AddReponse"> <s:complexType> <s:sequence> <s:element minOccurs="1" maxOccurs="1" name="AddOperationResult" type="s:int" /> </s:sequence> </s:complexType> </s:element> </s:schema> </wsdl:types> <wsdl:message name="AddOperationSoapIn"> <wsdl:part name="parameters" element="tns:Add" /> </wsdl:message> <wsdl:message name="AddOperationSoapOut"> <wsdl:part name="parameters" element="tns:AddReponse" /> </wsdl:message> <wsdl:portType name="MathServiceSoap"> <wsdl:operation name="AddOperation"> <wsdl:input message="tns:AddOperationSoapIn" /> <wsdl:output message="tns:AddOperationSoapOut" /> </wsdl:operation> </wsdl:portType> 上一页 [1] [2] [3] <wsdl:binding name="MathServiceSoap" type="tns:MathServiceSoap"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> <wsdl:operation name="AddOperation"> <soap:operation soapAction="http://idior.cnblogs.com/Math/Add" style="document" /> <wsdl:input> <soap:body use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding></PRE> <RE class=xml name="code"> </PRE> <PRE class=xml name="code">现在为了调用AddOperation(注意 Add改成AddOperation了)方法,你认为Soap Body中对应的那个元素名???是什么呢? <PRE class=xml name="code">POST /WebService1/Service1.asmx HTTP/1.1 Host: localhost Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://idior.cnblogs.com/Math/Add" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <??? xmlnsxmlns="http://tempuri.org/"> <a>int</a> <b>int</b> </???> </soap:Body> </soap:Envelope></PRE> </PRE> 上一页 [1] [2] [3]
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表