[WebService Test]: 3. SOAP

1. 什么是SOAP ?

SOAP :(simple object access protocol,简单对象访问协议),它是简单,轻量级的信息交换协议。

作用是:数据交换。

语言:基于XML的WSDL语言。它可以描述方法名,参数类型,返回值,调用WebService地址,接口,协议和复杂数据结构(如,数组,结构体,集合等)。通过这些,使用者可以判断出这个web服务都有哪些函数接口,每个函数的参数是什么,返回值是什么等。有了这些,才能够构造SOAP报文来调用该Web服务的某个函数接口。

优点:SOAP不需HTTPGETPOST,它不受名称/对的限制,我们可以使用它来发送复杂的对象,包括DataSet(缓存中的数据库)、类和其他对象。

缺点: 由于SOAP消息十分冗长,因此如果存在带宽或者传输性能的问题,会导致接收和发送的消息遗失,在此情况下,建议使用POST或GET。

结构: 消息内容一个或多个头模块组成,封装在SOAP envelope中。

下面是一个SOAP报文的例子:

<?xml version="1.0" encoding="utf-8"?>

- < wsdl:deFinitions name =" HPFlights_Service " targetNamespace =" HP.soAQ.SampleApp " xmlns:wsdl =" http://schemas.xmlsoap.org/wsdl/ " xmlns:soap =" http://schemas.xmlsoap.org/wsdl/soap/ " xmlns:wsu =" http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd " xmlns:soapenc =" http://schemas.xmlsoap.org/soap/encoding/ " xmlns:wsam =" http://www.w3.org/2007/05/addressing/Metadata " xmlns:tns =" HP.soAQ.SampleApp " xmlns:wsa =" http://schemas.xmlsoap.org/ws/2004/08/addressing " xmlns:wsp =" http://schemas.xmlsoap.org/ws/2004/09/policy " xmlns:wsap =" http://schemas.xmlsoap.org/ws/2004/08/addressing/policy " xmlns:xsd =" http://www.w3.org/2001/XMLSchema " xmlns:msc =" http://schemas.microsoft.com/ws/2005/12/wsdl/contract " xmlns:wsaw =" http://www.w3.org/2006/05/addressing/wsdl " xmlns:soap12 =" http://schemas.xmlsoap.org/wsdl/soap12/ " xmlns:wsa10 =" http://www.w3.org/2005/08/addressing " xmlns:wsx =" http://schemas.xmlsoap.org/ws/2004/09/mex ">
- < wsdl:types >
- < xsd:schema targetNamespace =" HP.soAQ.SampleApp/Imports ">
  < xsd:import schemaLocation =" http://yaweijun1:24240/HPFlights_SOAP?xsd=xsd0 " namespace =" HP.soAQ.SampleApp " />
  < xsd:import schemaLocation =" http://yaweijun1:24240/HPFlights_SOAP?xsd=xsd1 " namespace =" http://schemas.microsoft.com/2003/10/Serialization/ " />
  </ xsd:schema >
  </ wsdl:types >
- < wsdl:message name =" IHPFlights_Service_CreateFlightOrder_InputMessage ">
  < wsdl:part name =" parameters " element =" tns:CreateFlightOrder " />
  </ wsdl:message >

相关文章

1.使用ajax调用varxhr;functioninvoke(){if(window.ActiveXO...
               好不容易把WebService服务器...
1新建一个工程项目用来做服务端增加一个MyService1类文件pac...
packagecom.transsion.util;importjava.io.BufferedReader;i...
再生产wsdl文件时重写描述文件1usingSystem;2usingSystem.Co...
一般情况下,使用eclipse自带的jax-ws生成webservice会自动生...