生活随笔
收集整理的這篇文章主要介紹了
soap协议的研究
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
1.開啟tcp代理監(jiān)視
這里我們使用eclipse的代理監(jiān)視
window->show view->others
選擇TCP/IP Monitor
在TCP/IP Monitor視圖中選中Properties或者在eclipse的preferences中找到TCP/IP Monitor
配置
其中54321市監(jiān)視的端口,12345是被監(jiān)視的端口
2.發(fā)出請求
WeatherInterfaceImplService s=new WeatherInterfaceImplService()WeatherInterfaceImpl weatherInterfaceImplPort = s
.getWeatherInterfaceImplPort()System
.out.println(weatherInterfaceImplPort
.queryWeather(
"je"))
調(diào)用到遠程的服務
3.在TCP/IP Monitor視圖中發(fā)生了變化
POST /weathers HTTP/1.1
Accept:
text/xml, multipart/related
Content-Type:
text/xml; charset=utf-8
SOAPAction:
"http://nio/WeatherInterfaceImpl/queryWeatherRequest"
User-Agent:
JAX-WS RI 2.2.9-b130926.1035 svn-revision#5f6196f2b90e9460065a4c2f4e30e065b245e51e
Host:
127.0.0.1:54321
Connection:
keep-alive
Content-Length:
196<?xml version="1.0" ?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:queryWeather xmlns:ns2="http://nio/">
<arg0>廣東</arg0>
</ns2:queryWeather>
</S:Body>
</S:Envelope>
HTTP/1.1 200 OK
Date:
Sat, 27 May 2017 03:14:45 GMT
Transfer-encoding:
chunked
Content-type:
text/xml; charset=utf-8<?xml version="1.0" ?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:queryWeatherResponse xmlns:ns2="http://nio/">
<return>heihei</return>
</ns2:queryWeatherResponse>
</S:Body>
</S:Envelope>
請求和響應的上半部分是客戶端的請求和響應體
下面的部分都是soap協(xié)議體的內(nèi)容
必須的是Envelop元素,此元素將整個XML文檔標示為一條SOAP消息
可選的是Header元素,包含頭部信息
必須的是Body元素,包含所有調(diào)用和響應信息
可選的是Fault元素,提供有關的在處理消息發(fā)生的錯誤的信息
總結
以上是生活随笔為你收集整理的soap协议的研究的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。