Cool :-)

Where is this doc going to go ?


John Hawkins




"Rangika Mendis" <[EMAIL PROTECTED]>

25/01/2005 08:17

Please respond to
"Apache AXIS C Developers List"

To
"Apache AXIS C Developers List" <axis-c-dev@ws.apache.org>
cc
Subject
Design Architecture





ws-attachments - Server Side
==================

 
Purpose -
To handle Attachments at server side.
A sample has been currently written to echo attachments  to the client.

 
The overall architecture is as follows:
 
When Axis C++ server side receives a SOAP message with attachment(s)  it has to extract and store it. This is done inside the
 
Apache module. It extracts the attachments and stores  inside a map. Then at any time if a webservice requests for a particular
 
attachment, the transport (in this case the Apache2 module) will be able to provide it by taking it from its map. Also if a webservice
 
needs to send an attachment back, it needs  support to add them to the Serializer. This functionality is also provided.
 
The details given below explain the functionalities that are needed to deal with attachments (Currently we have focused on echoing
 
attachments to the client.)
 
1. Apache2Transport -
The following methods will be called by getBytes() once it receives the incoming message with base64 encoded attachments.

 
extract_Attachment(pBuffer) -
Extracts the attachments from the pBuffer which has the incoming message.This will extract the attachments one by one and will

 
store them in a map.The mime headers will also be extracted one by one & will be stored in a vector.

extract_SOAPMimeHeaders(pBuffer) -
Extracts the SOAPMimeHeaders from the pBuffer and will store them in a char pointer.This method is required to send the

response to the client.
 
extract_Soap(pBuffer) -
Extracts the soap Message from the pBuffer.The soap part is extracted because the deserializer fails when it receives data in

 
MIME format. It can only handle data in XML format.
 
The above 3 methods are implemented in the AttachmentHelper class.
 
2. The wrapper of the webservice calls the:-
getElementAsString() in the deserializer to get the ID of the required web service. Then it will get the Attachment through the

 
DeSerializer and will send the attachment/s to the webservice to process it.
 
Currently we are expecting the attachment id to be as an element value, but we noticed in Axis Java that it is sent as an Attribute.
 
Axis Java TCP monitor request -
 
 <soapenv:Body>
 <ns1:echo
soapenv:encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="urn:EchoAttachmentsService">
  <source href=""> xsi:type="ns1:DataHandler"/>
 </ns1:echo>
</soapenv:Body>

 
Client TCP monitor request (which we used)-
 
 <soapenv:Body>
 <ns1:EchoAttachment soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="urn:EchoAttachmentsService">  
 <id xsi:type="xsd:string">000001233</id>
   </ns1:EchoAttachment>
</soapenv:Body>

3. After receiving the processed attachment/s the wrapper will pass the Id and the attachment/s to the addAttachment() of  the

 
SoapSerializer. We added the following main methods to the SoapSerializer.
 
addAttachment(const AxisChar* achId, ISoapAttachment* pAttach) -
This will add the attachment(s) to the attachment map in the Serializer.

 
addAttachmentHeader(const AxisChar* achId, const AxisChar* achHeaderName, const AxisChar* achHeaderValue) -
This will add the name & the value of the mime headers to the relavent Attachment.This in turn will store the mime headers in a

vector.
 
addAttachmentBody(const AxisChar* achId, xsd__base64Binary *pAttchBody) -
This will set the body of the given attachment id.

 
Comments regarding this are welcome.
 
Regards,
Nithya & Rangika

Reply via email to