Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to configure Axis2 client with generated stubs?

 
Per Th�rnstrand
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic