Axis2 - always getting 404 errors

匿名 (未验证) 提交于 2019-12-03 01:27:01

问题:

I'm trying to move some Web Service stubs from Metro to Axis2, however after generating my stubs using wsdl2java I'm constently getting 404 errors whenever I try and make a service call.

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) 

The URL that it's trying to connect to is definitely correct as I can access it via my browser/SoapUI.

Any help would be greatly appreciated!

Thanks, Joseph.

回答1:

You didn't provide much information about the environment in which you try to deploy your WS. E.g. is this a webapp running under Tomcat/JBoss or maybe the standalone server deployed with Axis2?

From the trace that you have posted I suppose that there is a connection with your server but your WS is not successfully deployed. I assume that you may use the standalone server for your tests and I suggest:

  1. Go to your WS repository. On my test machine this would be something like ~/axis2-x.x.x/repository/services and make sure that your service is there (either the .aar file or the unpacked version).

  2. Start the server and check if your service is really deployed. On my installation, for example the server will generate the following output (not complete):

    me@melinuxpc:~/axis2-1.5.1/bin> ./axis2server.sh
    Using AXIS2_HOME: xxx
    Using JAVA_HOME: xxx
    Using JAVA_OPTS: -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n Listening for transport dt_socket at address: 8000 [INFO] [SimpleAxisServer] Starting [INFO] [SimpleAxisServer] Using the Axis2 Repository xxx [SimpleAxisServer] Using the Axis2 Repository xxx [SimpleAxisServer] Using the Axis2 Configuration File xxx [INFO] Clustering has been disabled [INFO] Deploying module: xxx [INFO] Deploying Web service: MyTestService - file: ~/axis2-1.5.1/repository/services/MyTestService/

Check if your web service is deployed and there are no errors. You may check if the WSDL of the service is available "in the browser". On my test machine the URL will be:

http://localhost:8080/axis2/services/MyTestService?wsdl

While a list with all deployed services may be seen at:

http://localhost:8080/axis2/services/

And do not be too quick in abandoning Axis2 ;)

Good luck!



回答2:

I also see this error when use "axis2-wsdl2code-maven-plugin" to generate stub for a .NET webservice (.asmx).

I fixed by disable "chunked" of _serviceClient. Only add below code in method Constructor of file stub.

_serviceClient.getOptions().setProperty(HTTPConstants.CHUNKED, "false"); 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!