Philipp2706
Philipp2706

Reputation: 39

Why does Axis2 throw "An invalid request URI was provided" when connecting to an .asmx SOAP endpoint?

I am using Axis2 to consume a SOAP web service hosted at an endpoint that looks like this: https://example.com/car.asmx?wsdl

However, when I make a request, I get the following error:

An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set.

org.apache.axis2.AxisFault: An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set.
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:435)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:371)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:417)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at com.mycompany.phi.ws.myService.MyGeneratedStub.identify(MyGeneratedStubfromWSDL.java:229)

Some details of my client:

I generated the client stub from the WSDL file using axis2-wsdl2code-maven-plugin for java 8.

MyGeneratedStubfromWSDL myStub = new MyGeneratedStubfromWSDL(
configurationContext, endpointURl);

I suspect that the issue might be related to the .asmx endpoint or a misconfiguration in Axis2.

What I've Tried:

stub._getServiceClient().getOptions().setAction("SOAPActionFromWSDL");

serviceClient.getOptions().setTo(new EndpointReference(endpointUrl)); serviceClient.setTargetEPR(new EndpointReference(endpointUrl)); serviceClient.getOptions().setProperty("transport.http.URL", endpointUrl); serviceClient.getOptions().setProperty("BaseAddress", "https://example.com"); serviceClient.getOptions().setAction("http://example/services/example/service"); serviceClient.getServiceContext().setProperty("transport.http.address", endpointUrl); serviceClient.getServiceContext().setProperty("endpoint.url", endpointUrl); serviceClient.getAxisService().addParameter("ServiceEndpoint", endpointUrl);

Questions:

Any guidance or suggestions would be greatly appreciated!

Upvotes: 0

Views: 22

Answers (0)

Related Questions