webservice--SOAP
来源:互联网 发布:mac截图 编辑:程序博客网 时间:2024/05/22 06:36
SOAP
一、定义
l SOAP即简单对象访问协议,他是使用http发送的XML格式的数据,它可以跨平台,跨防火墙,SOAP不是webservice的专有协议。
l SOAP=http+xml
二、协议格式
l 必需有Envelope 元素,此元素将整个 XML 文档标识为一条 SOAP 消息
l 可选的 Header 元素,包含头部信息
l 必需有Body元素,包含所有的调用和响应信息
l 可选的 Fault 元素,提供有关在处理此消息所发生错误的信息
三、TCP/IP Monitor
1、代理原理
2、配置
3、测试
在浏览器中输入代理服务地址,能正常访问,代表代理服务器设置成功
四、SOAP1.1
POST /weather HTTP/1.1Accept: text/xml, multipart/relatedContent-Type: text/xml; charset=utf-8SOAPAction: "http://ws.jaxws.ws.itcast.cn/WeatherInterfaceImpl/queryWeatherRequest"User-Agent: JAX-WS RI 2.2.4-b01Host: 127.0.0.1:54321Connection: keep-aliveContent-Length: 214<?xml version="1.0" ?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:queryWeather xmlns:ns2="http://ws.jaxws.ws.itcast.cn/"><arg0>北京</arg0></ns2:queryWeather></S:Body></S:Envelope>
HTTP/1.1 200 OKTransfer-encoding: chunkedContent-type: text/xml; charset=utf-8Date: Thu, 26 Nov 2015 03:14:29 GMT<?xml version="1.0" ?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:queryWeatherResponse xmlns:ns2="http://ws.jaxws.ws.itcast.cn/"><return>晴</return></ns2:queryWeatherResponse></S:Body></S:Envelope>
五、SOAP1.2
l 如何发布SOAP1.2服务端
Ø Jaxws不支持SOAP1.2服务端发布,直接发布会报如下异常
Ø 如果想发布SOAP1.2服务端,需要在服务端引入第三方JAR(jaxws-ri-2.2.8)
Ø 在实现类上加入如下注解
@BindingType(SOAPBinding.SOAP12HTTP_BINDING)
请求:
POST /weather HTTP/1.1Accept: application/soap+xml, multipart/relatedContent-Type: application/soap+xml; charset=utf-8;action="http://ws.jaxws.ws.itcast.cn/WeatherInterfaceImpl/queryWeatherRequest"User-Agent: JAX-WS RI 2.2.4-b01Host: 127.0.0.1:54321Connection: keep-aliveContent-Length: 212<?xml version="1.0" ?><S:Envelope xmlns:S="http://www.w3.org/2003/05/soap-envelope"><S:Body><ns2:queryWeather xmlns:ns2="http://ws.jaxws.ws.itcast.cn/"><arg0>北京</arg0></ns2:queryWeather></S:Body></S:Envelope>
HTTP/1.1 200 OKTransfer-encoding: chunkedContent-type: application/soap+xml; charset=utf-8Date: Thu, 26 Nov 2015 03:25:24 GMT<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://www.w3.org/2003/05/soap-envelope"><S:Body><ns2:queryWeatherResponse xmlns:ns2="http://ws.jaxws.ws.itcast.cn/"><return>晴</return></ns2:queryWeatherResponse></S:Body></S:Envelope>
六、SOAP1.1和SOAP1.2区别
l 相同点:
Ø 请求发送方式相同:都是使用POST
Ø 协议内容相同:都有Envelope和Body标签
l 不同点:
Ø 数据格式不同:content-type不同
n SOAP1.1:text/xml;charset=utf-8
n SOAP1.2:application/soap+xml;charset=utf-8
Ø 命名空间不同:
n SOAP1.1:http://schemas.xmlsoap.org/soap/envelope/
n SOAP1.2:http://www.w3.org/2003/05/soap-envelope
七、UDDI
UDDI是一种目录服务,企业可以使用它对 Web services 进行注册和搜索。
UDDI,英文为"Universal Description, Discovery and Integration",可译为“通用描述、发现与集成服务”。
UDDI 并不像 WSDL和 SOAP 一样深入人心,因为很多时候,使用者知道 Web服务的位置(通常位于公司的企业内部网中)。
- SOAP,WebService
- WebService,SOAP
- webservice soap
- webservice soap
- WebService SOAP
- WebService,SOAP
- webservice soap
- webservice--SOAP
- 【soap】利用soap实现webservice
- 浅谈restful webservice SOAP webservice
- SOAP Webservice和RESTful Webservice
- SOAP Webservice和RESTful Webservice
- SOAP Webservice和RESTful Webservice
- 浅谈restful webservice SOAP webservice
- SOAP Webservice和RESTful Webservice
- SOAP Webservice和RESTful Webservice
- SOAP Webservice和RESTful Webservice
- SOAP Webservice和RESTful Webservice
- 1038. Recover the Smallest Number (30)
- 心得 - 面向对象和面向过程的区别
- picasso使用
- SQL Server数据类型转换方法
- java.net.SocketTimeoutException: 60000 millis timeout while waiting for channel to be ready for read
- webservice--SOAP
- PAT BASIC LEVEL 1036. 跟奥巴马一起编程(15)
- zndle的测试博客
- --wps知识点--不断总结
- 关于Android的.so文件你所需要知道的 - 简书
- PAT BASIC LEVEL 1037. 在霍格沃茨找零钱(20)
- MySQL 使用数据库(三)
- MVC 绑定数据
- Volley框架