All,
I am invoking a "ping" Web service on another host. The SOAP headers
require a developer key and a password. When I execute my test program
to call the "ping" WS, I get the following:
org.apache.axis2.AxisFault: Server was unable to process request.
Authorization failed.
at
org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java
:486)
at
org.apache.axis2.description.OutInAxisOperationClient.handleResponse(Out
InAxisOperation.java:343)
at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOper
ation.java:389)
at
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInA
xisOperation.java:211)
at
org.apache.axis2.client.OperationClient.execute(OperationClient.java:163
)
at
com.twinhill.clientadvisor.interfaces.clients.InventoryServiceStub.Ping(
InventoryServiceStub.java:1574)
at
com.twinhill.clientadvisor.interfaces.clients.TestCAWebServices.main(Tes
tCAWebServices.java:24)
I debugged this to verify that the request went across the wire, which I
see that it did. So I'm willing to accept that the authorization
failed.
However, I have verified using this tool
(http://www.soapclient.com/soaptest.html) with my WSDL and the developer
key/password combination, I can invoke the WS successfully.
So I'd like to understand more about all of this magical code that got
generated. I used wsdl2java to generate my client code using the "ADB"
data binding.
1) Here is my client test to invoke "ping":
InventoryServiceStub stub =
new InventoryServiceStub
("https://api.channeladvisor.com/ChannelAdvisorAPI/v1/InventoryService.a
smx?WSDL");
InventoryServiceStub.APICredentials0 apiCredentials =
new InventoryServiceStub.APICredentials0();
InventoryServiceStub.APICredentials credential_data =
new InventoryServiceStub.APICredentials();
credential_data.setDeveloperKey("my_key");
credential_data.setPassword("my_pass");
apiCredentials.setAPICredentials(credential_data);
InventoryServiceStub.Ping req = new
InventoryServiceStub.Ping();
InventoryServiceStub.PingResponse resp = stub.Ping(req,
apiCredentials);
System.err.println(resp.getPingResult());
Here's what's confusing. Two classes get generated. One of type
APICredentials0 and one of type APICredentials. As you can see above,
APICredentials allows me to setDeveloperKey and setPassword, which I do.
But then because I have to pass an APICredentials0 object to the WS, I'm
assuming that I need to put the APICredentials object _inside_ of the
APICredentials0 object. That's the only way that I could see to pass
the credentials in.
Is that right or am I doing this completely wrong?
2) What is the easiest way for me to specify to use SOAP 1.1 or 1.2? Is
there a way that I can force that?
Thanks,
Wes
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]