So to give you some background, I am trying to create a client that will interact with a third-party via SOAP. Initially I started to roll this out using javax.xml.soap SAAJ but then realized there are no options for timeouts when creating a SOAPConnection.
I considered AXIS which does have timeouts but have been warned to try and avoid and it's not great performance wise. My higher-ups seems to be putting this as a last restort.
Some have suggested that javax.xml.ws Web Service route works great as you can put in the context properties the time-out settings, only if it is a web service.
So here is the situation, the third-party I'm sending requests to doesn't really have a WSDL file or URL, the original idea was to build up the SOAP request and send it, would have worked great if SAAJ had timeout settings.
So I'm thinking and forgive me for my ignorance, is that could I model and implement the communication like a Web Service instead of the SAAJ javax.xml.soap method of building the request up? If so, can anyone really point me out? Most documents I find seem to rely on generating stubs and classes from a WSDL.
This is all really for the sake of setting a time-out setting for connections to this third-party SOAP API.
Also note, I've seen some people suggest to try and treat it like a HttpConnection where you can set timeouts but the downside I found was it no longer returns a SOAPMessage type object.
So basically I'm trying to change this:
SOAPMessage soapMessage = messageFactory.createMessage();
SOAPConnection soapConnection = soapConnectionFactory.createConnection();
SOAPPart soapPart = soapMessage.getSOAPPart();
SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
SOAPHeader soapHeader = soapEnvelope.getHeader();
SOAPBody soapBody = soapEnvelope.getBody();
....
soapConnection.call(soapMessage, url);
Into something more like web service so I can do this:
requestContext.put(BindingProviderProperties.REQUEST_TIMEOUT, 2000);
requestContext.put(BindingProviderProperties.CONNECT_TIMEOUT, 2000);
myService.callMyRemoteMethodWith(myParameter1, myparameter2);
I really am lacking knowledge about the javax.ws framework so please go lightly :)