Vjeran,

When I use the generated stubs to send an attachment we create a new stub for our specific web service. I believe if we then make the attachments to that stub by doing the following...

stub._setProperty(Call.ATTACHMENT_ENCAPSULATION_FORMAT, Call.ATTACHMENT_ENCAPSULATION_FORMAT_MIME);
String file = "c:\\test\\abcde.jpg";
DataHandler buildFile = new DataHandler(new FileDataSource(file));
stub.addAttachment(buildFile);

Then this handler is specific to that instance of the stub, and should be thread safe. Someone correct me if I'm wrong.

-Carlos

Vjeran Marcinko wrote:

Hi folks.

As far as I understood, client stubs generated by WSDL2Java are suposed to be used as stateless thread-safe services, meaning, many simultaneous requests can be called on it. Client methods should just see business interface exposed by this stub.

Everything's fine except when I need to send attachments when calling some remote method on this stub. I know attachments can be added to Call object, but using generated stub, I cannot see Call object since everything is hidden behind business interaface ?

How should I do that then?

I know that I can cast stub instance to Stub, and use addAttachment() method on it, but then it isn't thread-safe, since some other thread can do simulateously the same thing, since they all share the same stub instance. To overcome all this, I currently instantiate new stub each time during each method call, set desired attachments before calling business method, but I am sure I'm paying huge performance penalty that way, right?

Regards,
Vjeran


--
Carlos Carapito
Avvenu Inc.
<[EMAIL PROTECTED]>

Reply via email to