axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roshan Weerasuriya <ros...@opensource.lk>
Subject Re: SoapSerializer was modified to support attachments.
Date Sun, 09 Jan 2005 11:36:02 GMT
hi John,

>I'm a little confused as to the relationship between a soap attachment,
> body and header. How come the IWrapperSoapSerializer has setters for all
> three but there are only interfaces for the attachment. how do I create a
> body or header - we have methods for creating an attachment but not the
> others? What does a body or header look like? can it be anything etc. etc.
> Some doc in the code might be good here?
> 

The following is the structure.

A soap attachment which we receives (or sends) in a MIME message will have 
the Mime Headers and the Mime Body. So as a whole (both MIME headers and 
the body) it represents the SOAP Attachement. So there is a class called 
SoapAttachment (src/soap/SoapAttachment.hpp/cpp) as a placeholder for a 
attachment.

//-----SoapAttachment class-----
class SoapAttachment
{
private:
        SoapAttachementHeaders* m_AttachementHeaders;
        xsd__base64Binary* m_AttachementBody;
public:
                                                                                         
                                                                                  
        void serialize(SoapSerializer& pSZ);
        void addBody(xsd__base64Binary* objBody);
        void addHeader(AxisString name, AxisString value);
        SoapAttachment();
        virtual ~SoapAttachment();
};
//-------------------------------

A user of this class will not have to create a seperate Attachment Headders 
for example, but can just call the addHeader by passing the HeaderName and 
HeaderValue.

The SoapSerializer is having a map to store objects of above SoapAttachment
type. The SoapSerializer also has following new methods:
 - void addAttachmentBody(const AxisChar* achId, xsd__base64Binary* pAttchBody);
 - void addAttachmentHeader(const AxisChar* achId, const AxisChar* achHeaderName, 
    const AxisChar* achHeaderValue);
 - void addAttachment(AxisString id, SoapAttachment* objAttach);

A user of these methods for example a person who calls the addAttachmentHeader 
don't need to worry abt creting any of the Attachement objects etc. The 
SoapSerializer will manage that part (i.e if necessory the SoapSerializer
creates a SoapAttachment object and puts it its SoapAttachment map). You will 
realize this if you look at the code of these 3 methods. But if necessory the
API also provieds the "addAttachment()" methods which is the last of the above
3, to any one who needs to directly set a SoapAttachment object.

Any how the Wrapper class will not be seing the SoapSerializer, but instead
it sees the IWrapperSoapSerializer.hpp. So the following API methods
are added to the  IWrapperSoapSerializer interface:

virtual void addAttachment(const AxisChar* achId, ISoapAttachment*
> > objAttach)=0;
> >
> >  virtual void addAttachmentBody(const AxisChar* achId,
> > xsd__base64Binary* pAttchBody)=0;
> >
> >  virtual void addAttachmentHeader(const AxisChar* achId, const
> > AxisChar* achHeaderName, const AxisChar* achHeaderValue)=0;

If the user of this interface needs to create a object of SoapAttachment
then the following mehods of this interface could be used.

/**
> >     * creates and returns a SoapAttachment object to the caller of
> > this methods.
> >  *  The user can use this object and fill in the attachment details. This
> >  *  method doesn't add the created SoapAttachment object to the
> Serializer.
> >  *  The user will have to add this object explictly by calling the
> > addAttachment
> >  *  method of the IWrapperSoapSerializer interface
> >     *
> >     */
> >  virtual ISoapAttachment* createSoapAttachement()=0;

Here another interface called "ISoapAttachment" is used to avoid static 
linkage of Axis engine/library code to the web service.

With this explanation if you just go through these methods you will get
the idea.


> What is the memory management model for an attachment?
All the attachments are maintained by the SoapSerializer. It will clean
the memory for those attahments in its Destructor.

Roshan


On Fri, 2005-01-07 at 19:06, John Hawkins wrote: 
> 
> Hi,
> 
> I'm a little confused as to the relationship between a soap attachment,
> body and header. How come the IWrapperSoapSerializer has setters for all
> three but there are only interfaces for the attachment. how do I create a
> body or header - we have methods for creating an attachment but not the
> others? What does a body or header look like? can it be anything etc. etc.
> Some doc in the code might be good here?
> 
> And I don't actually understand what an attachment header is (knowing this
> might help me understand the above :-)
> 
> What is the memory management model for an attachment?
> 
> cheers for now,
> John.
> 
> 
> John Hawkins
> 
> 
> 
> "Rangika Mendis" <rangika@opensource.lk> wrote on 07/01/2005 10:41:07:
> 
> > Hi All,
> >
> > We added  functionalities to  the serializer to serialize soap
> > attachments. The following files were added for that purpose.
> >
> > 1. SoapAttachmentHeaders
> > 2. SoapAttachment
> >
> > New API  allows to add Soap Attachment objects to the serializer.
> >
> > The following methods in IWrapperSoapSerializer.hpp can be used  to
> > add attachment details to the Serializer.
> >
> > virtual void addAttachment(const AxisChar* achId, ISoapAttachment*
> > objAttach)=0;
> >
> >  virtual void addAttachmentBody(const AxisChar* achId,
> > xsd__base64Binary* pAttchBody)=0;
> >
> >  virtual void addAttachmentHeader(const AxisChar* achId, const
> > AxisChar* achHeaderName, const AxisChar* achHeaderValue)=0;
> >
> >  /**
> >     * creates and returns a SoapAttachment object to the caller of
> > this methods.
> >  *  The user can use this object and fill in the attachment details. This
> >  *  method doesn't add the created SoapAttachment object to the
> Serializer.
> >  *  The user will have to add this object explictly by calling the
> > addAttachment
> >  *  method of the IWrapperSoapSerializer interface
> >     *
> >     */
> >  virtual ISoapAttachment* createSoapAttachement()=0;
> >
> > These methods will be used by the web service wrapper class.
> >
> > Any comments on this will be greatly appreciated.
> >
> > Regards,
> >
> >  Nithya & Rangika
> >
> >
> 
> 


Mime
View raw message