I'm sorry for not being clear enough.
The specific service that I need to develop needs to be able to
remember the request message inorder to generate the response message.
The reason being that most of the response (nearly 80%) is the same as
the request, except with a few additional data coming from the db.

Sample Request xml & Response XML are as below:

<soap:envelope>
<soap:header>…</soap:header>
<soap:body>
<abcRequest>
                <allElements>
                                <e1>Req val</e1>
                                <e2> Req val </e2>
                                <e3> Req val </e3>
                                .....
                               <e20>  </e20>
                </allElements>
</abcRequest>
</soap:body>
</soap:envelope>

Response XML:
<soap:envelope>
<soap:header>…</soap:header>
<soap:body>
<abcResponse>
               <allElements>
                                <e1>Req val</e1>
                                <e2> Req val </e2>
                                <e3> Req val </e3>
                                ........
                               <e20>New DBVal</e20>

                </allElements>
</abcResponse>
</soap:body>
</soap:envelope>

So the idea is that since the response format is the same and its just
a few tag values that need to be updated, we are thinking of saving
the request XML in the context as a Java Object. Can something like
below be done in Axis2’s Skeleton?

MessageContext.getOperationContext().setMyObject(“myObj”,abcRequest);

Then be able to retrieve it back on the way out as below:

AbcRequest abcRequest =
(AbcRequest)MessageContext.getOperationContext().getMyObject(“myObj”);
AllElements[] allElements = abcRequest.getAllElements();

Update required elements in the allElements array with the new DB values.
Get hold of the outgoing response Java Object. Set allElements section
in the response.
Send the response out.

Can this be done in Axis2?

On Wed, Aug 12, 2009 at 2:00 PM, Andreas Veithen
<[email protected]> wrote:
>
> To be honest, I don't really understand the idea behind your approach.
> Either there is something missing in your explanation, or your
> approach is way too complicated.
>
> Andreas
>
> On Wed, Aug 12, 2009 at 16:05, Ramya K Grama<[email protected]> wrote:
> > Thanks for ur tip on the CDATA. I'll look into that and come back with any
> > issues I may have.
> > The other question I have is regarding storing the request xml.
> > Where and how could that be done?
> > I read that OperationContext and SOAPSession can be used to achieve this.
> > But I will need some help with the API.
> >
> >
> >
> > Thanks,
> > wsnewbie
> >
> > On Wed, Aug 12, 2009 at 3:32 AM, Andreas Veithen <[email protected]>
> > wrote:
> >>
> >> You need to take into account that Axis2 by default doesn't preserve
> >> CDATA sections (and converts them to text nodes). You can use the
> >> approach described in [1] to change this.
> >>
> >> Andreas
> >>
> >> [1] http://people.apache.org/~veithen/synapse/faq.html
> >>
> >> On Wed, Aug 12, 2009 at 00:39, Ramya K Grama<[email protected]> wrote:
> >> > Hello,
> >> > I'm using Axis2/Java to create a web service wherein the request and
> >> > response xmls are very much the same except for some additional data
> >> > from
> >> > the db that gets added on to the request as a response.
> >> > Also, there is a lot of CDATA sections in the request that need to be
> >> > sent
> >> > back in the response as is without any modification.
> >> >
> >> > In designing this service, we've come up with the strategy of saving the
> >> > incoming SOAP request.xml(in memory) somewhere so that it can be used to
> >> > recreate the response + updated data from the db (stuffing in empty tags
> >> > with data from db).
> >> >
> >> > Is this a good approach as far as Axis2 is concerned. If so what/how
> >> > would
> >> > be teh best place of storing the request.xml. Are there any
> >> > multi-threading
> >> > issues that i need to be concerned about. What would be a fool-proof and
> >> > optimal approach of doing this in Axis2.
> >> >
> >> > From my initial research, I've found that OperationContext with
> >> > SOAPSession
> >> > scope can be used for this. Am I correct here?
> >> >
> >> > Also, since there are a lot of CDATA sections in the request and
> >> > response
> >> > xmls, is there anything special that needs to be done?
> >> >
> >> > Your feedback will be very helpful in designing my service further.
> >> >
> >> > Thanks,
> >> > wsNewbie.
> >
> >

Reply via email to