org.apache.axis2.AxisFault: Transport error: 501 E

2019-07-23 13:12发布

I am trying to call an Axis2 web service using a code like:

stub = new MyServiceStub("http://server/app/services/MyService");
stub.ping();

Stubs/skeletons are generated with codegen. I can interact correctly with the web service from other clients (even something low level written with SAAJ) but not from a stupid stub call.

I am getting the following error:

org.apache.axis2.AxisFault: Transport error: 501 Error: Not Implemented
at org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:298)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:192)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:77)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:327)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:206)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:396)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:374)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
at my.package.stub.MyServiceStub.ping(MyServiceStub.java:266)

Has someone encountered this and know the solution?

I need to configure the Stub somehow to call the web-service (I'm sure this is a configuration issue). The web-service is already deployed and runs for some time.

Thank you!

2条回答
成全新的幸福
2楼-- · 2019-07-23 13:45

I just managed to fix this issue using details from the following article.

All I did was add the following code before the call:

stub._getServiceClient().getOptions()
        .setProperty(HTTPConstants.HTTP_PROTOCOL_VERSION, HTTPConstants.HEADER_PROTOCOL_10);

Thank you for your time!

查看更多
叼着烟拽天下
3楼-- · 2019-07-23 13:48

Yes, I have try without Axis 2 and only with javax.xml.soap.SOAPConnection and was sucessfull:

connection.setRequestProperty(HTTPConstants.HTTP_PROTOCOL_VERSION, HTTPConstants.HEADER_PROTOCOL_10);
查看更多
登录 后发表回答