/**
* saves service response to file
*
* @param response
* @throws Exception
*/
private void saveFile(SOAPMessage msg, String filename) throws Exception {
if( msg != null ) {
if(StringUtils.isEmpty(wsresponsefile)) {
wsresponsefile = "testResponse.xml";
}
System.out.println("Saving service response: " + filename);
FileOutputStream fos = null;
try {
fos = new FileOutputStream(filename);
msg.writeTo(fos);
}
catch(Exception e) {
e.printStackTrace();
}
finally {
IOUtils.close(fos);
}
}
}
private SOAPMessage createSOAPMsgFromFile(String filename) throws Exception {
if ( ! StringUtils.isEmpty(filename) ) {
System.out.println("Loading request payload: " + filename);
FileInputStream fis = null;
try {
fis = new FileInputStream(filename);
return MessageFactory.newInstance().createMessage(null, fis);
}
catch (Exception e) {
e.printStackTrace();
}
finally {
IOUtils.close(fis);
}
}
return null;
}
public static void main(String[] a) throws Exception {
new SoapClient().testWebService();
}
}
{code}
SOAP request --------------
{code}
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<sc:getPersonRequest xmlns:sc="http://www.t50.com/portable"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.t50.com/portable GetPerson.xsd ">
<person>
<firstName>john</firstName>
<lastName>wang</lastName>
<age>86</age>
</person>
</sc:getPersonRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
{code}
SOAP response --------------
{code}
<?xml version="1.0" ?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:getPersonResponse xmlns:ns2="http://www.t50.com/portable">
<person>
<firstName>john</firstName>
<lastName>wang</lastName>
<age>30001</age>
</person>
</ns2:getPersonResponse>
</S:Body>
</S:Envelope>
{code}
分享到:
相关推荐
基于jax-ws 实现的web service client和server端的demo程序。 注:如果使用的是 myeclipse 时 server 部署到tomcat 启动的时候会报错 解决办法:找到myeclipse安装目录下的 plugins 目录里 查找 webservices-rt.jar,...
The Java API for XML Web Services (JAX-WS) is a Java programming language API for creating web services, particularly SOAP services.... It's a part of the Java SE and Java EE platforms.
JAX-WS自学笔记 本人自学JAX-WS笔记和简单例子,文档标题结构如下: JAX-WS使用教程 1、JAX-WS概述 2、创建Web Service 2.1 从java开始 2.1.1 运行wsgen 2.1.2 生成的WSDL和XSD 2.1.3 目录结构 2.2 从WSDL...
JAX-WS 2.2 RI 所包含的JAR包集合,包含25个JAR包,列表如下: FastInoset.jar gmbal-api-only.jar ha-api.jar javax.annotation.jar javax.mail_1.4.jar jaxb-api.jar jaxb-impl.jar jaxb-xjc.jar jaxws-api...
亲测可用,Jax-ws所需要的JAR包,拷贝到tomcat安装路径的lib里,实现了webservice发布到tomcat,赞!
MyEclipse8_0中使用 JAX-WS 部署 WebService 实例 - 外衣 - 博客频道 - CSDN_NET.mht
JAX-WS2.0 API
JAX-WS方式开发和部署webservice应用,JAX-WS方式开发和部署webservice应用,JAX-WS方式开发和部署webservice应用,JAX-WS方式开发和部署webservice应用,JAX-WS方式开发和部署webservice应用
可以更好的了解 jax-ws的实验过程。了解其原理
Jax-WS的简单实例 Jax-WS的简单实例
webService部署tomcat需要的jax-ws 的完整jar包
jax-ws webservice完整demo,包含所有jax-ws 2.2jar包。
JAX-WS 2.2 RI 所包含的JAR包集合,包含25个JAR包,列表如下: FastInoset.jar gmbal-api-only.jar ha-api.jar javax.annotation.jar javax.mail_1.4.jar jaxb-api.jar jaxb-impl.jar jaxb-xjc.jar jaxws-api...
javax.xml.ws.Service 报错需要的包,亲测可以用,直接下载在ide里buildpath一下就可以,四个jar包 ,整合了其他的jar所以配置简单
如果基于一个JAX-WS进行WebService开发,有很多教程,但是具体怎么更自动地生成一些文件,实现客户端与服务端的交互,都讲得不大清楚,为了让大家更方便地部署,我将服务端、客户端文件的生成与部署全过程以及测试...
使用JAX-WS(JWS)发布WebService 使用myeclipse开发java的webservice的两种方式 方式一: (此方式只能作为调试,有以下bug:jdk1.6u17?以下编译器不支持以Endpoint.publish方式发布document方式的soap,必须在...
JAX-WS规范是一组XML web services的JAVA API
Learn how to design and develop distributed web services in Java using RESTful architectural principals and the JAX-RS specification in Java EE 6. With this hands-on reference, you'll focus on ...
JAX-WS Web service 开发初步