Java-所需:Tomcat Axis2 JAX-WS傻瓜指南
作者:互联网
我们正在使用Tomcat Axis2 POJO进行Web服务实现,并且遇到了POJO和Axis2的一些问题,这些问题对我们来说是最重要的.
似乎SOAP解析的Axis2和POJO实现会忽略XML元素的名称,而只是根据SOAP消息中XML元素的顺序为参数分配值.这件事会在复杂的API中引起很多问题.
在Axis2的文档沼泽中畅游一番之后,我感到更加困惑,然后我进来了,所以我确实需要一些帮助.
我知道JAX-WS和Axis2没有这些问题(如果我错了,请纠正我),但是我似乎不知道如何开发和部署这种解决方案.
我写了一个POJO,并用JAX-WS批注对其进行批注,我在类上执行了wsgen,并将所有文件与该services.xml文件一起打包在一个aar文件中:
<service name="TESTService" >
<description>
TEST web service
</description>
<messageReceivers>
<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.jaxws.server.JAXWSMessageReceiver" />
<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.jaxws.server.JAXWSMessageReceiver"/>
</messageReceivers>
<parameter name="ServiceClass">com.test.WsdlImpl</parameter>
</service>
当我尝试执行Web服务调用时,在Tomcat中出现异常:
[ERROR] The service class cannot be found for this AxisService. java.lang.RuntimeException: The service class cannot be found for this AxisService. at org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessageReceiver.java:95) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176) at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275) at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:133) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Unknown Source)
请通过解释如何在Tomcat Axis2上部署JAX-WS来帮助我(如果CXF与Tomcat一起使用,我也可以使用它),或者将我定向到涵盖Tomcat Axis2的GOOD教程.
谢谢!!
解决方法:
直接来自Axis2网站的this是涵盖Axis2和Jax-Ws的教程.您可能会收到上述错误,可能是因为缺少axis2-jaxws-1.3.jar.检查您的类路径.
当然,您可以将CXF与Tomcat一起使用,我个人认为,使用它会更好.
标签:axis2,jax-ws,tomcat,web-services,java 来源: https://codeday.me/bug/20191024/1921825.html