Java Axis2 - 总是出现 404 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4456342/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 17:46:49  来源:igfitidea点击:

Axis2 - always getting 404 errors

javaweb-servicesaxis2

提问by Joseph Paterson

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.

我正在尝试将一些 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)

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

它尝试连接的 URL 绝对正确,因为我可以通过浏览器/SoapUI 访问它。

Any help would be greatly appreciated!

任何帮助将不胜感激!

Thanks, Joseph.

谢谢,约瑟夫。

回答by Lachezar Balev

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?

您没有提供有关尝试部署 WS 的环境的太多信息。例如,这是在 Tomcat/JBoss 下运行的 web 应用程序还是使用 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:

根据您发布的跟踪,我认为与您的服务器有连接,但您的 WS 未成功部署。我假设您可以使用独立服务器进行测试,我建议:

  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/

  1. 转到您的 WS 存储库。在我的测试机器上,这将类似于 ~/axis2-xxx/repository/services 并确保您的服务在那里(.aar 文件或解压版本)。

  2. 启动服务器并检查您的服务是否真正部署。例如,在我的安装中,服务器将生成以下输出(不完整):

    me@melinuxpc:~/axis2-1.5.1/bin> ./axis2server.sh
    使用 AXIS2_HOME: xxx
    使用 JAVA_HOME: xxx
    使用 JAVA_OPTS: -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n在地址侦听传输 dt_socket:8000 [INFO] [SimpleAxisServer] 正在启动 [INFO] [SimpleAxisServer] 使用 Axis2 存储库 xxx [SimpleAxisServer] 使用 Axis2 存储库 xxx [SimpleAxisServer] 使用 Axis2 配置文件 xxx [INFO] 集群已被禁用[INFO] 部署模块:xxx [INFO] 部署 Web 服务:MyTestService - 文件:~/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:

检查您的 Web 服务是否已部署并且没有错误。您可以在“浏览器”中检查服务的 WSDL 是否可用。在我的测试机器上,URL 将是:

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

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

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

虽然可以在以下位置看到包含所有已部署服务的列表:

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

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

And do not be too quick in abandoning Axis2 ;)

并且不要太快放弃 Axis2 ;)

Good luck!

祝你好运!

回答by user3089834

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

当使用“axis2-wsdl2code-maven-plugin”为 .NET webservice (.asmx) 生成存根时,我也看到了这个错误。

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

我通过禁用 _serviceClient 的“分块”来修复。仅在文件存根的方法构造函数中添加以下代码。

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