webservice 实现

参考资料

http://blog.csdn.net/majian_1987/article/details/23269641

服务端和验证类见参考。

采用JaxWsProxyFactoryBean方式实现,客户端需要有服务端的Service接口类和参数及返回对象。

采用SOAPUI 测试的时候,头信息不会自动生成, 需要手动添加, 查看AddSoapHeader类里面XMLUtils.printDOM()生成的头信息,

<?xml version="1.0" encoding="utf-8"?>
<soap:Header>
<auth:authentication xmlns:auth="http://gd.chinamobile.com//authentication">
  <auth:systemID>1</auth:systemID>
  <auth:userID>test</auth:userID>
  <auth:password>test444</auth:password>
</auth:authentication>
</soap:Header>
 

  将 <soapenv:Header> 中的内容 COPY 到SOAPUI的XML<soapenv:Header>中,

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hy="http://hy.com/">
   <soapenv:Header>
      <auth:authentication xmlns:auth="http://gd.chinamobile.com//authentication">
      	<auth:systemID>1</auth:systemID>
      	<auth:userID>test</auth:userID>
      	<auth:password>test</auth:password>
      </auth:authentication>
  </soapenv:Header> 
   
   <soapenv:Body>
      <hy:getResponse>
         <!--Optional:-->
         <arg0>Hello</arg0>
      </hy:getResponse>
   </soapenv:Body>
</soapenv:Envelope>

猜你喜欢

转载自jxdwuao.iteye.com/blog/2086894