我正在尝试将一些Web服务存根从Metro移动到Axis2,但是在使用wsdl2java生成我的存根之后,每当我尝试进行服务调用时,我都会出现404错误。
16/12/2010 11:14:57 AM org.apache.axis2.deployment.ModuleDeployer deploy
INFO: Deploying module: addressing-1.5.3-jar - file:/C:/Users/xxx/.m2/repository/org/apache/axis2/axis2/1.5.3/axis2-1.5.3-jar.jar
16/12/2010 11:14:57 AM org.apache.axis2.transport.http.HTTPSender sendViaPost
INFO: Unable to sendViaPost to url[xxxx]
org.apache.axis2.AxisFault: Transport error: 404 Error: Not Found
at org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:307)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:200)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:400)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:438)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at au.com.jpaterso.betcalc.axis2.tab.LoginStub.getKey(LoginStub.java:184)
at au.com.jpaterso.betcalc.axis2.tab.Test.main(Test.java:13)
Exception in thread "main" org.apache.axis2.AxisFault: Transport error: 404 Error: Not Found
at org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:307)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:200)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:400)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:438)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at au.com.jpaterso.betcalc.axis2.tab.LoginStub.getKey(LoginStub.java:184)
at au.com.jpaterso.betcalc.axis2.tab.Test.main(Test.java:13)
它尝试连接的URL肯定是正确的,因为我可以通过浏览器/ SoapUI访问它。
非常感谢任何帮助!
谢谢,约瑟夫。
答案 0 :(得分:2)
您没有提供有关尝试部署WS的环境的大量信息。例如。这是一个在Tomcat / JBoss下运行的webapp,还是与Axis2一起部署的独立服务器?
从您发布的跟踪中,我认为与您的服务器存在连接,但您的WS未成功部署。我假设您可以使用独立服务器进行测试,我建议:
转到您的WS存储库。在我的测试机器上,这将是〜/ axis2-x.x.x / repository / services,并确保您的服务在那里(.aar文件或解压缩版本)。
启动服务器并检查您的服务是否已真正部署。在我的安装上,例如服务器将生成以下输出(未完成):
我@ melinuxpc:〜/ axis2-1.5.1 /箱> ./axis2server.sh
使用AXIS2_HOME:xxx
使用JAVA_HOME:xxx
使用JAVA_OPTS:-Xdebug -Xrunjdwp:transport = dt_socket,address = 8000,server = y,suspend = n
在地址:8000处侦听传输dt_socket
[INFO] [SimpleAxisServer]开始
[INFO] [SimpleAxisServer]使用Axis2存储库xxx
[SimpleAxisServer]使用Axis2存储库xxx
[SimpleAxisServer]使用Axis2配置文件xxx
[INFO]已禁用群集
[INFO]部署模块:xxx
[INFO]部署Web服务:MyTestService - file:〜/ axis2-1.5.1 / repository / services / MyTestService /
检查您的Web服务是否已部署且没有错误。您可以“在浏览器中”检查服务的WSDL是否可用。在我的测试机器上,URL将是:
http://localhost:8080/axis2/services/MyTestService?wsdl
虽然可以在以下位置看到包含所有已部署服务的列表:
http://localhost:8080/axis2/services/
不要太快放弃Axis2;)
祝你好运!答案 1 :(得分:2)
使用“axis2-wsdl2code-maven-plugin”为.NET Web服务(.asmx)生成存根时,我也看到了这个错误。
我修复了_serviceClient的“chunked”。只在文件存根的方法构造函数中添加以下代码。
_serviceClient.getOptions().setProperty(HTTPConstants.CHUNKED, "false");