axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ephemeris Lappis" <>
Subject [Axis2] Attachment on client using generated stub
Date Tue, 17 Apr 2007 08:19:58 GMT


I have not found any example of simple client, using the interface code
generated from WSDL, and calling a service stub to send an attachment.


The service operation signature is :


public TestReport processTestRequest(final TestRequest request, final String
attchmentID) throws TestException


Where TestRequest and TestReport are simple javabeans. The service
implementation uses the message context to retrieve the attachment data
handler for the given id :


MessageContext messageContext = MessageContext.getCurrentMessageContext();

Attachments attachments = messageContext.getAttachmentMap();

DataHandler dataHandler = attachments.getDataHandler(attchmentID);


If I'm not wrong, interpreting what I've seen in samples code, the client
must create the attachment using the message context :


FileDataSource dataSource = new FileDataSource(file);

DataHandler dataHandler = new DataHandler(dataSource);

MessageContext messageContext = new MessageContext();

String attachmentID = messageContext.addAttachment(dataHandler);


But I've not found any way to take into account the message context except
with a sample code that creates from scratch an OperationClient, etc.


What is the better way to do that ?


Thanks for your help.



Ephemeris Lappis


View raw message