I'm trying to write some code so that the endpoint for my wsdl first soap
service can be set at runtime. It mostly works, but the timeouts sometimes
aren't honored. I've determined they get ignored when the protocol for the
endpoint specified in the wsdl (e.g. "http://localhost/endpoint") differs from
the endpoint set at runtime (e.g. "https://remote/endpoint").
Given this wsdl fragment:
<wsdl:service name="MyService">
<wsdl:port binding="[...]" name="[...]">
<soap:address location="http://localhost/endpoint"/>
</wsdl:port>
</wsdl:service>
And this simplified code:
private MyInterface createRemoteService(String endpointUrl, long
connectionTimeout, long receiveTimeout)
{
MyService service = new MyService();
MyInterface provider = service.getMyInterface();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(connectionTimeout);
httpClientPolicy.setReceiveTimeout(receiveTimeout);
Client client = ClientProxy.getClient(provider);
HTTPConduit httpConduit = (HTTPConduit)client.getConduit();
httpConduit.setClient(httpClientPolicy);
client.getRequestContext().put(Message.ENDPOINT_ADDRESS, endpointUrl);
return provider;
}
I find the following:
"wsdl location is http" + "runtime endpoint is http" = timeouts
work
"wsdl location is https" + "runtime endpoint is https" =
timeouts work
"wsdl location is https" + "runtime endpoint is http" =
timeouts ignored and defaults are used
"wsdl location is http" + "runtime endpoint is https" =
timeouts ignored and defaults are used
I tried an alternate method of setting the runtime endpoint:
BindingProvider bindingProvider = (BindingProvider)provider;
bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
endpointUrl);
But that didn't make a difference.
My best idea to work around this is to create two versions of the wsdl. One
with http and one with https. Then check the runtime endpointUrl protocol and
choose the correct one. Then, pass that in to one of the alternate MyService()
constructors that takes a wsdl location url.
But, it'd be great if there were some way to just make it work without that.
Any idea why it doesn't work now?
Thanks,
-Troy
The information contained in this e-mail and in any attachments is intended
only for the person or entity to which it is addressed and may contain
confidential and/or privileged material. Any review, retransmission,
dissemination or other use of, or taking of any action in reliance upon, this
information by persons or entities other than the intended recipient is
prohibited. This message has been scanned for known computer viruses.