File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Connection pooling of SOAPConnection objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Connection pooling of SOAPConnection objects" Watch "Connection pooling of SOAPConnection objects" New topic

Connection pooling of SOAPConnection objects

kulkarniSachin Kulkarni

Joined: Sep 06, 2005
Posts: 1
We have a requirement to pass SOAP Message to the Web service server. Currently we are creating the SOAP messages using SAAJ (SOAP with attachments API for java) APIs provided by SUN. The external system from where we are consuming the webservices has 2 Web servers behind a load balancer to serve the SOAP request. We are using SOAPConnection API of the javax.xml.soap package for connecting to the Web Service. Using this we are able to create SOAPMessage and send to Web Service for execution.

However, the requirement is to create a Connection Pool with the SOAP connections to the Web Service. To do this, we need some clarification

1) Is it worth creating SOAP connection (object) pool with SOAPConnection object? Because, as per the API, the actual connection to the webservice takes only when call() method of the SOAPConnection is invoked.In the same method call the connection and message passing to Web Service service is happening.

2) Is there any techniques in java to pass SOAP Message over HTTP which facilitates connection pooling aswell?
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
From your post it seems that you use HTTP as your transport mechanism. You can't pool HTTP connections. They're opened, a request is sent, a response is received, then they're closed. The only way to reuse them is via a mechanism called HTTP pipelining, which lets you send several requests in a row over the same connection. But that has nothing to do with SOAP, it's pure HTTP, and not generally applicable to SOAP.
Having said that, it might be worthwhile to pool SOAPConnection objects, but I can't imagine that discarding and recreating them introduces a significant overhead over pooling them, because the major time-consuming operation they do is opening the network connection, which -as outlined above- would still have to be done every time.
I agree. Here's the link:
subject: Connection pooling of SOAPConnection objects
It's not a secret anymore!