aspose file tools*
The moose likes Web Services and the fly likes How to configure Axis2 client with generated stubs? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "How to configure Axis2 client with generated stubs?" Watch "How to configure Axis2 client with generated stubs?" New topic
Author

How to configure Axis2 client with generated stubs?

Per Th�rnstrand
Greenhorn

Joined: Aug 21, 2006
Posts: 2
Hi,
I have a client that uses Axis2 to consume a Web Service. I have generated code using the Axis2 Eclipse plug-in.

Now, for a certain reason I would like to use HTTP 1.0 instead of HTTP 1.1.

I have tried the following, but still HTTP 1.1 is used:

//Generated stub
TestServiceStub stub = new TestServiceStub();

ServiceClient client = stub._getServiceClient();
Options options = new Options();
options.setProperty(
org.apache.axis2.transport.http.HTTPConstants.PROTOCOL_VERSION, org.apache.axis2.transport.http.HTTPConstants.HEADER_PROTOCOL_V10);
//Also tried HTTPConstants.HEADER_PROTOCOL_10

client.setOverrideOptions(options);

TestInput parameters = TestInput.Factory.newInstance();
parameters.setId("123");
TestDocument doc = TestDocument.Factory.newInstance();
doc.setTest(parameters);
TestResponseDocument response = stub.Test(doc);
System.out.println(response.getTestResponse().getTestReturn().getName());

Also tried:
...
ServiceClient client = stub._getServiceClient();
Options options = client.getOptions();
options.setProperty(...);
...

What am I doing wrong? Is there another way to configure Axis2 clients that uses the generated code? Via axis2.xml?

Kind Regards

PT
[ August 22, 2006: Message edited by: Per Th�rnstrand ]
Per Th�rnstrand
Greenhorn

Joined: Aug 21, 2006
Posts: 2
Found it!
It turnes out one CAN use axis2.xml to configure a generated client.

In the client code you then do:

ConfigurationContext config =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(null,
AXIS2_CONFIG_FILE_LOCATION);

TestServiceStub stub = new TestServiceStub(config, TARGET_ENDPOINT_URL);
[ August 23, 2006: Message edited by: Per Th�rnstrand ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to configure Axis2 client with generated stubs?
 
Similar Threads
Axis2 http Configuration problem
Invoking CrmService from Java Client problem
axis2 ntlm authentication - No credentials available for NTLM
JAX-WS versus Axis2, WSDL Implementation
Axis2 client to invoke NTLM .NET WCF web services