• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Axis 2 Client

 
Dhananjay Maan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
I am creating client using Axis2/eclipse. My Code for calling client is as follows:

InventoryStub inventoryStub = new InventoryStub();

Authentication authentication = new Authentication();

authentication.setUserName("XYZ");
authentication.setPassword("XYZ");
authentication.setClientInitials("XYZ");
authentication.setApplication("XYZ");


GetMarkets getMarkets = new GetMarkets();
getMarkets.setAuthentication(authentication);

InventoryStub.GetMarkets request = new InventoryStub.GetMarkets();

InventoryStub.GetMarketsResponse resp = inventoryStub.getMarkets(request);
System.out.println("Response. .. "+ resp.get_return());

But while I am trying to run this file I am getting following error:


org.apache.axis2.AxisFault: Exception occurred while trying to invoke service method getMarkets
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.ccds.inventory.ws.InventoryStub.getMarkets(InventoryStub.java:670)
at test.TestGetMarkets.main(TestGetMarkets.java:35)


Can any body tell, why I am getting this error.

Thanks in advance.
Regards,
Dhananjay

 
Kacee Saxena
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont know whats wrong with yr code. But if your only purpose is to create Client to call the web service , you can use Automatic client generation from WSDL file in Eclipse.
 
Dhananjay Maan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for replying Kacee, I was doing the same as you told but getting this error:

org.apache.axis2.AxisFault: Exception occurred while trying to invoke service method getMarkets
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.ccds.inventory.ws.InventoryStub.getMarkets(InventoryStub.java:670)
at test.TestGetMarkets.main(TestGetMarkets.java:35


Just want to know the reason of this error.
Regards,
Dhananjay
 
Manju Sebastian
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure that getMarket is the proper webservie, also about the parameters and return values. Seems you are calling SOAPmessages, like Request and Response. Just call the stub method, as you arr calling a local method and it should work.

CommandServerService locator = new CommandServerServiceLocator();
CommandServerSoapBindingStub server = (CommandServerSoapBindingStub) locator.getCommandServer(new java.net.URL(SERVICE_URL));

cmd = (LoginCommand)server.executeCommand(null, cmd);
 
Dhananjay Maan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Manju,

The method getMarkets is perfectly fine. Actually I am calling third party Web service and the WSDL provided by them is following SOAP 1.2. Thats why I have to use Axis 2 for creating client as Axis 1.x is not supporting SOAP 1.2. Now I have made some modification in WSDL and create client using Axis 1.4. Its working fine at my end, and I am able to get required result.
But the issue is, I am not able to find out what is the error with Axis 2. Can you provide me an example for the same(Creating Java Client using WSDL (SOAP 1.2)).

--
Dhananjay
 
Manju Sebastian
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its just the compatibility issues right. If it works, fine.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic