标签:
Web of Services refers to message-based design frequently found on the Web and in enterprise software. The Web of Services is based on technologies such as HTTP, XML, SOAP, WSDL, SPARQL, and others.
Web Service可以实现将服务器应用通过web开放给其他Web应用或其他平台调用。其实现的方式就是HTTP, XML, SOAP, WSDL等中介。
SOAP, originally an acronym for Simple Object Access Protocol, is a protocol specification for exchanging structured information in the implementation of web services in computer networks. It uses XML Information Set for its message format, and relies on other application layer protocols, most notably Hypertext Transfer Protocol (HTTP) or Simple Mail Transfer Protocol (SMTP), for message negotiation and transmission.
wsimport -s D:\\MyEclipse2015\\Workspaces\\TheClient\\src -p com.ithaibo.client -keep http://127.0.0.1:8080/Service/ServiceHello?wsdl
// 根据命名空间和方法得到SoapObject对象
SoapObject soapObject = new SoapObject(targetNameSpace,
getSupportProvince);
// 通过SOAP1.1协议得到envelop对象
SoapSerializationEnvelope envelop = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
// 将soapObject对象设置为envelop对象,传出消息envelop.dotNet = true;
envelop.setOutputSoapObject(soapObject);
// 或者envelop.bodyOut = soapObject;
HttpTransportSE httpSE = new HttpTransportSE(WSDL);
// 开始调用远程方法
try {
httpSE.call(targetNameSpace + getSupportProvince, envelop);
// 得到远程方法返回的SOAP对象
SoapObject resultObj = (SoapObject) envelop.getResponse();
// 得到服务器传回的数据
int count = resultObj.getPropertyCount();…
标签:
原文地址:http://www.cnblogs.com/ithaibo-sit/p/4871368.html