axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Masin, Valerie" <VJMa...@docharbor.com>
Subject RE: [Axis2] Attachment on client using generated stub
Date Tue, 17 Apr 2007 17:55:47 GMT
I'm no expert so I don't know if I am answering your question exactly,
but I send attachments this way.
In my wsdl I have something like this:
 <wsdl:types>
  <schema xmlns="http://www.w3.org/2001/XMLSchema" ...>
   <element name="importDocument">
    <complexType>
     <sequence>
      <element name="name" type="xsd:string"/>
      <element name="document" type="xmime:base64Binary"/>
     </sequence>
    </complexType>
   </element>
  </schema>
 </wsdl:types>

 <wsdl:message name="importDocumentRequest">
  <wsdl:part name="parameters" element="impl:importDocument"/>
 </wsdl:message>

which generates this signature:
        public  com.docharbor.webservices.ImportDocumentResponse
importDocument
        (
          java.lang.String param48,javax.activation.DataHandler param49

         )

 
So you are working directly with DataHandlers, not with MessageContext
 
Hope this helps
 
________________________________

From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com] 
Sent: Tuesday, April 17, 2007 4:20 AM
To: Axis-User
Subject: [Axis2] Attachment on client using generated stub



Hello.

 

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

 


Mime
View raw message