开发者

Can you set Axis to use HTTP/1.0 programmatically?

We're trying to use Axis2 to call a web service that cannot use HTTP/1.1 (default transport protocol in Axis2). Is it possible to programmatically set Axis2 to use HTTP/1.0? I know that this can be done with a configuration file, but in our case API use would be much better solution.

Here's some code that we're using:

ServiceClient client = new ServiceClient();
Options opts = new Options();
opts.setTo(new EndpointReference(endpointAddress));
client.setOptions(opts);

I tried to figure out if I could so开发者_JAVA技巧mehow use the Options object to set transport protocol, but didn't yet succeed. :(


Ok, I was a bit trigger-happy with sending the question... I just find out from the Axis documentation that you can set the HTTP version with the following code:

options.setProperty(org.apache.axis2.context.MessageContextConstants.HTTP_PROTOCOL_VERSION,
org.apache.axis2.transport.http.HTTPConstants.HEADER_PROTOCOL_10);

and as the MessageContextConstants.HTTP_PROTOCOL_VERSION seems to be deprecated, I can use the following:

opts.setProperty(HTTPConstants.HTTP_PROTOCOL_VERSION, HTTPConstants.HEADER_PROTOCOL_10);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜