一个JAXM小实验:实现SOAP信息的收发?????? 之前因为一时没找到实现JAXM服务端的教程,只能放下了对它的学习
一个JAXM小实验:实现SOAP信息的收发
?????? 之前因为一时没找到实现JAXM服务端的教程,只能放下了对它的学习,转向了JAX-WS。但现在又必须要用到了,于是下狠心一定要从谷歌的“资料库”里找到个解决办法来。还好,谷歌没让我失望:原来实现一个服务端很简单,写个servlet即可。
?????? 这里罗列两个给我提供最大帮助的链接:《Working with SOAP Messages》、《深入探索SOAP1.1--使用SAAJ1.2.1》。
?????? 我的开发环境是JDK1.6U7、JEE5(主要用到了它的jaxm-api包)、eclipse3.4 jee版、Tomcat6。
?????? 首先建立服务器端的servlet。在eclipse里新建一个dynamic web project(可能其它类型的也可以),再新建一个servlet,我取名ReceiveServlet,继承javax.xml.messaging.JAXMServlet,实现接口javax.xml.messaging.ReqRespListener,具体代码如下:
at org.apache.axis.soap.SOAPConnectionImpl.call(SOAPConnectionImpl.java:95)
at com.SOAPSender.send(SOAPSender.java:37)
at com.SOAPSender.main(SOAPSender.java:19)
Caused by: (500)Internal Server Error
at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:663)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:94)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:147)
at org.apache.axis.client.Call.invokeEngine(Call.java:2719)
at org.apache.axis.client.Call.invoke(Call.java:2702)
at org.apache.axis.client.Call.invoke(Call.java:1816)
at org.apache.axis.soap.SOAPConnectionImpl.call(SOAPConnectionImpl.java:90)
... 2 more
at org.apache.axis.soap.SOAPConnectionImpl.call(SOAPConnectionImpl.java:95)
at com.SOAPSender.send(SOAPSender.java:37)
at com.SOAPSender.main(SOAPSender.java:19)
Caused by: (500)Internal Server Error
at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:663)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:94)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:147)
at org.apache.axis.client.Call.invokeEngine(Call.java:2719)
at org.apache.axis.client.Call.invoke(Call.java:2702)
at org.apache.axis.client.Call.invoke(Call.java:1816)
at org.apache.axis.soap.SOAPConnectionImpl.call(SOAPConnectionImpl.java:90)
... 2 more
没遇到过哦,记得我当时还没用到Axis框架啊~
但是看到异常里提示“服务器内部错误”,建议查看下服务器和服务的部署是否有问题。
能不能把你的工程打包发给我看看。我到邮箱:keevinliang@sina.com,谢谢! 4 楼 jelver 2009-12-09 非常感谢你的资料,有空交流