kenlistian

勤学多思

  IT博客 :: 首页 :: 新随笔 ::  :: 聚合  :: 管理 ::
  412 随笔 :: 0 文章 :: 23 评论 :: 0 Trackbacks

http://www.intertwingly.net/stories/2002/03/16/aGentleIntroductionToSoap.html

http://www.soapware.org/bdg

标记,2篇介绍soap格式的文章。

很生动介绍soap的格式。

在采用http方式发送soap格式的xml时,

开始最简单的格式是:

<Envelope
xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<helloWorld/>
</Body>
</Envelope>

其中Envelope 是soap的标识。

这个最简单的,一般而言需要,加上对body中元素所属命名空间,如下

<Envelope
xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<helloWorld xmlns="http://www.soapware.org/">
</Body>
</Envelope>

至于为啥要上,看作者http://www.intertwingly.net/stories/2002/01/25/whatObjectDoesSoapAccess.html说明

进一步:增加SOAP描述,作者说,是约定,大伙都要这么用,而不是缺省命名空间方式处理。
<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Body>
<m:helloWorld xmlns:m="http://www.soapware.org/%22/>
</SOAP:Body>
</SOAP:Envelope>

再进一步:加一个调用方法和调用的参数

<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Body>
<m:getStateName xmlns:m="http://www.soapware.org/">
<statenum>41</statenum>
</m:getStateName>
</SOAP:Body>
</SOAP:Envelope>

再进一步:说明调用soap方法的参数类型

<SOAP:Envelope
xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP:Body>
<m:getStateName xmlns:m="http://www.soapware.org/">
<statenum xsi:type="xsd:int">41</statenum>
</m:getStateName>
</SOAP:Body>
</SOAP:Envelope>

其中加入xsd:int,作者说一般情况下不见得需要(另有wsdl之类可分析参数)。这里只是加入说明格式。

posted on 2008-03-26 23:41 kenlistian 阅读(1290) 评论(0)  编辑 收藏 引用
只有注册用户登录后才能发表评论。