首页
诗词
字典
板报
句子
名言
友答
励志
学校
网站地图
Web前端
Dreamweaver
Fireworks
Flash
ASP
asp.net
PHP
JSP
SEO优化
源码建站
CSS
Web开发
Web前端
JavaScript
vbScript
Ajax
网页设计
跨浏览器开发
高性能WEB开发
Web Service
XML SOAP
当前位置:
首页
>
教程频道
>
网站开发
>
Web前端
>
WebService CXF SOAP根本结构
2012-09-03
WebService CXF SOAP基本结构SOAP 1.1 被提交到 W3CJava代码? ?xml?version1.0??????soap:Envelope?
WebService CXF SOAP基本结构
SOAP 1.1 被提交到 W3CJava代码?
<?xml?version="1.0"?>?????
<soap:Envelope?????
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"????
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">?????
????
<soap:Header>?????
??...?????
??...?????
</soap:Header>?????
????
<soap:Body>?????
??...?????
??...?????
??<soap:Fault>?????
????...?????
????...?????
??</soap:Fault>?????
</soap:Body>?????
????
</soap:Envelope>????
??
<?xml?version="1.0"?>??
<soap:Envelope??
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"??
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">??
??
<soap:Header>??
??...??
??...??
</soap:Header>??
??
<soap:Body>??
??...??
??...??
??<soap:Fault>??
????...??
????...??
??</soap:Fault>??
</soap:Body>??
??
</soap:Envelope>??
SOAP Envelope 元素Java代码?
<?xml?version="1.0"?>?????
<soap:Envelope?????
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"????
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">?????
??...?????
??Message?information?goes?here?????
??...?????
</soap:Envelope>????
??
<?xml?version="1.0"?>??
<soap:Envelope??
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"??
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">??
??...??
??Message?information?goes?here??
??...??
</soap:Envelope>??
xmlns:soap 命名空间Java代码?
soap:encodingStyle="URI"??
?Java代码?
<?xml?version="1.0"?>?????
<soap:Envelope?????
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"????
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">?????
...?????
Message?information?goes?here?????
...?????
</soap:Envelope>????
??
<?xml?version="1.0"?>??
<soap:Envelope??
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"??
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">??
...??
Message?information?goes?here??
...??
</soap:Envelope>??
SOAP Header 元素Java代码?
<?xml?version="1.0"?>?????
<soap:Envelope?????
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"????
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">?????
????
<soap:Header>?????
<m:Trans?????
xmlns:m="http://www.w3school.com.cn/transaction/"????
soap:mustUnderstand="1">234</m:Trans>?????
</soap:Header>?????
????
...?????
...?????
????
</soap:Envelope>????
??
<?xml?version="1.0"?>??
<soap:Envelope??
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"??
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">??
??
<soap:Header>??
<m:Trans??
xmlns:m="http://www.w3school.com.cn/transaction/"??
soap:mustUnderstand="1">234</m:Trans>??
</soap:Header>??
??
...??
...??
??
</soap:Envelope>??
??? 上面的例子包含了一个带有一个 "Trans" 元素的头部,它的值是 234,此元素的 "mustUnderstand" 属性的值是 "1"。Java代码?
soap:actor="URI"???
?Java代码?
<?xml?version="1.0"?>?????
<soap:Envelope?????
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"????
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">?????
????
<soap:Header>?????
<m:Trans?????
xmlns:m="http://www.w3school.com.cn/transaction/"????
soap:actor="http://www.w3school.com.cn/appml/">?????
234????
</m:Trans>?????
</soap:Header>?????
????
...?????
...?????
????
</soap:Envelope>????
??
<?xml?version="1.0"?>??
<soap:Envelope??
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"??
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">??
??
<soap:Header>??
<m:Trans??
xmlns:m="http://www.w3school.com.cn/transaction/"??
soap:actor="http://www.w3school.com.cn/appml/">??
234??
</m:Trans>??
</soap:Header>??
??
...??
...??
??
</soap:Envelope>??
mustUnderstand 属性Java代码?
soap:mustUnderstand="0|1"???
soap:mustUnderstand="0|1"Java代码?
<?xml?version="1.0"?>?????
<soap:Envelope?????
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"????
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">?????
????
<soap:Header>?????
<m:Trans?????
xmlns:m="http://www.w3school.com.cn/transaction/"????
soap:mustUnderstand="1">?????
234????
</m:Trans>?????
</soap:Header>?????
????
...?????
...?????
????
</soap:Envelope>????
??
<?xml?version="1.0"?>??
<soap:Envelope??
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"??
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">??
??
<soap:Header>??
<m:Trans??
xmlns:m="http://www.w3school.com.cn/transaction/"??
soap:mustUnderstand="1">??
234??
</m:Trans>??
</soap:Header>??
??
...??
...??
??
</soap:Envelope>??
encodingStyle 属性Java代码?
<?xml?version="1.0"?>?????
<soap:Envelope?????
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"????
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">?????
????
<soap:Body>?????
???<m:GetPrice?xmlns:m="http://www.w3school.com.cn/prices">?????
??????<m:Item>Apples</m:Item>?????
???</m:GetPrice>?????
</soap:Body>?????
????
</soap:Envelope>????
??
<?xml?version="1.0"?>??
<soap:Envelope??
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"??
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">??
??
<soap:Body>??
???<m:GetPrice?xmlns:m="http://www.w3school.com.cn/prices">??
??????<m:Item>Apples</m:Item>??
???</m:GetPrice>??
</soap:Body>??
??
</soap:Envelope>??
?? 上面的例子请求苹果的价格。请注意,上面的 m:GetPrice 和 Item 元素是应用程序专用的元素。它们并不是 SOAP 标准的一部分。Java代码?
<?xml?version="1.0"?>?????
<soap:Envelope?????
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"????
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">?????
????
<soap:Body>?????
???<m:GetPriceResponse?xmlns:m="http://www.w3school.com.cn/prices">?????
??????<m:Price>1.90</m:Price>?????
???</m:GetPriceResponse>?????
</soap:Body>?????
????
</soap:Envelope>????
??
<?xml?version="1.0"?>??
<soap:Envelope??
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"??
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">??
??
<soap:Body>??
???<m:GetPriceResponse?xmlns:m="http://www.w3school.com.cn/prices">??
??????<m:Price>1.90</m:Price>??
???</m:GetPriceResponse>??
</soap:Body>??
??
</soap:Envelope>??
SOAP Fault 元素子元素????????描述???????????<faultcode>?供识别故障的代码<faultstring>可供人阅读的有关故障的说明<faultactor>有关是谁引发故障的信息????<detail>????存留涉及 Body 元素的应用程序专用错误信息
SOAP Fault Codes错误?描述?VersionMismatchSOAP Envelope 元素的无效命名空间被发现MustUnderstandHeader 元素的一个直接子元素(带有设置为 "1" 的mustUnderstand 属性)无法被理解。Client?消息被不正确地构成,或包含了不正确的信息。?Server?服务器有问题,因此无法处理进行下去。?
HTTP 协议Java代码?
POST?/item?HTTP/1.1????
Host:?189.123.345.239????
Content-Type:?text/plain?????
Content-Length:?200????
??
POST?/item?HTTP/1.1??
Host:?189.123.345.239??
Content-Type:?text/plain??
Content-Length:?200??
?Java代码?
200?OK?????
Content-Type:?text/plain?????
Content-Length:?200????
??
200?OK??
Content-Type:?text/plain??
Content-Length:?200??
? 在上面的例子中,服务器返回了一个 200 的状态代码。这是 HTTP 的标准成功代码。Java代码?
400?Bad?Request?????
Content-Length:?0????
??
400?Bad?Request??
Content-Length:?0??
SOAP HTTP BindingJava代码?
Content-Type:?MIMEType;?charset=character-encoding?????
Content-Type: MIMEType; charset=character-encodingJava代码?
POST?/item?HTTP/1.1????
Content-Type:?application/soap+xml;?charset=utf-8????
??
POST?/item?HTTP/1.1??
Content-Type:?application/soap+xml;?charset=utf-8??
Content-LengthJava代码?
Content-Length:?bytes???
Content-Length: bytesJava代码?
POST?/item?HTTP/1.1????
Content-Type:?application/soap+xml;?charset=utf-8????
Content-Length:?250????
POST /item HTTP/1.1Java代码?
POST?/InStock?HTTP/1.1????
Host:?www.example.org?????
Content-Type:?application/soap+xml;?charset=utf-8????
Content-Length:?nnn?????
????
<?xml?version="1.0"?>?????
<soap:Envelope?????
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"????
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">?????
????
??<soap:Body?xmlns:m="http://www.example.org/stock">?????
????<m:GetStockPrice>?????
??????<m:StockName>IBM</m:StockName>?????
????</m:GetStockPrice>?????
??</soap:Body>?????
???????
</soap:Envelope>????
??
POST?/InStock?HTTP/1.1??
Host:?www.example.org??
Content-Type:?application/soap+xml;?charset=utf-8??
Content-Length:?nnn??
??
<?xml?version="1.0"?>??
<soap:Envelope??
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"??
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">??
??
??<soap:Body?xmlns:m="http://www.example.org/stock">??
????<m:GetStockPrice>??
??????<m:StockName>IBM</m:StockName>??
????</m:GetStockPrice>??
??</soap:Body>??
????
</soap:Envelope>??
SOAP 响应:Java代码?
HTTP/1.1?200?OK?????
Content-Type:?application/soap+xml;?charset=utf-8????
Content-Length:?nnn?????
????
<?xml?version="1.0"?>?????
<soap:Envelope?????
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"????
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">?????
????
??<soap:Body?xmlns:m="http://www.example.org/stock">?????
????<m:GetStockPriceResponse>?????
??????<m:Price>34.5</m:Price>?????
????</m:GetStockPriceResponse>?????
??</soap:Body>?????
???????
</soap:Envelope>????
原文:http://yakar.iteye.com/blog/968930
查看更多
下一篇
本文网址:
https://www.reader8.net/jiaocheng/20120903/1366869.html
读书人精选
热点排行
简略实例处理url特殊符号&处理
Dom操作的分门别类
更动FMS 点播目录
webview加载网页时调用浏览器了如何解决
需真网的全世界
谷歌首页“小绿人岗比”源码提供上载
linux c兑现的简单web响应程序(会完善成
jquery自动提醒
SSH下整合CKEditor+CKFinder有关问题
运用 Apache CXF 实现 Web Service 详解