You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Simon Steinacker <si...@healthatnet.at> on 2008/02/19 09:58:11 UTC

Axis2 MTOM + module

Hello!

I have the following problem:
I have a service that does MTOM. In a Module on the client side, i need 
to do some xslt transformation on the soap structure. But when I do that 
(I use Saxon9 for xslt transformation) I need to convert that SOAP 
message to a string to apply that xslt transformer. When I rebuild the 
transformed soap envelope again with the StAXSOAPModelBuilder all MTOM 
information is somehow lost...

I already tried to get the MTOM attachments on the client side inside 
the module, but there the attachmentsmap conveyed in the message context 
is empty.

My question now is: how can I preserve mtom information after in the 
client module when I need to transform the soap string? On the server 
side I managed to do it by reading out the 0th attachments, which is the 
soap envelope and alter this one. Through that the attachments are not 
built into the soap envelope. But on the client module I do not seem to 
have access to the MTOM message... is it somehow possible to intercept 
the MTOM message on the client side?
Btw: the module's handler on the client side is bount to the MessageOut 
phase.

Thanks for your help and input,
Best regards
Simon

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Axis2 MTOM + module

Posted by Thilina Gunarathne <cs...@gmail.com>.
cool :)..

On Feb 19, 2008 8:27 AM, Simon Steinacker
<si...@healthatnet.at> wrote:
> Thanks for the hint with setting the respective OMText node to binary
> and optimization. That works.
> What I do in particular is that I remove the large OMText nodes before
> xslt transformation to keep the string that is transformed within a
> reasonable length and afterwards add the OMText nodes again to the right
> position. Then Axis2 does all the MTOM stuff correctly.
>
> So thanks for your help!
> Simon
>
>
>
> Thilina Gunarathne wrote:
> > Hello,
> >
> >
> >> I have the following problem:
> >> I have a service that does MTOM. In a Module on the client side, i need
> >> to do some xslt transformation on the soap structure. But when I do that
> >> (I use Saxon9 for xslt transformation) I need to convert that SOAP
> >> message to a string to apply that xslt transformer. When I rebuild the
> >> transformed soap envelope again with the StAXSOAPModelBuilder all MTOM
> >> information is somehow lost...
> >>
> > When you convert the whole SOAP message to a String using Axiom API's,
> > the MTOM attachments become text nodes having the attachment content
> > encoded in base64. But if you write the message object model using
> > MTOMWriter, then those text nodes will be written as attachments.. But
> > if you just took out the string, then there won't be any information
> > about MTOM..
> >
> > Also on a side note use the MTOMStAXSOAPModelBuilder if you want to
> > build a MTOM message.. But it will not solve your issue..
> >
> >> I already tried to get the MTOM attachments on the client side inside
> >> the module, but there the attachmentsmap conveyed in the message context
> >> is empty.
> >>
> > Did you try monitoring the actual wire level message & did you see the
> > attachment's in it..
> > One reason might be that the attachments are still not build due to
> > differed building of Axis2. Try calling
> > SOAPEnvelope.buildWithAttachments();
> >
> >
> >> My question now is: how can I preserve mtom information after in the
> >> client module when I need to transform the soap string?
> >>
> > Should be possible if you need only to transform the contents of the
> > root mime part, as you have mentioned below.
> >
> >> On the server
> >> side I managed to do it by reading out the 0th attachments, which is the
> >> soap envelope and alter this one. Through that the attachments are not
> >> built into the soap envelope. But on the client module I do not seem to
> >> have access to the MTOM message... is it somehow possible to intercept
> >> the MTOM message on the client side?
> >>
> > Same as in the server...
> >
> >> Btw: the module's handler on the client side is bount to the MessageOut
> >> phase.
> >>
> > hmm...too bad.. I was under the impression that you are talking about
> > receiving a message in the client side. In this case attachments are
> > not processed and they are not in the MAP.. AttachmentMAP is populated
> > only for incoming messages.
> >
> > Only clear solution I can think of is to manually traverse the rebuilt
> > SOAPMessage and then to mark all the text nodes that contains binary
> > content as follows..
> >
> > textNode.setBinary(true);
> > textNode.setOptimized(true);
> >
> > thanks,
> > Thilina
> >
> >> Thanks for your help and input,
> >> Best regards
> >> Simon
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> >> For additional commands, e-mail: axis-user-help@ws.apache.org
> >>
> >>
> >>
> >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>



-- 
Thilina Gunarathne  - http://thilinag.blogspot.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Axis2 MTOM + module

Posted by Simon Steinacker <si...@healthatnet.at>.
Thanks for the hint with setting the respective OMText node to binary 
and optimization. That works.
What I do in particular is that I remove the large OMText nodes before 
xslt transformation to keep the string that is transformed within a 
reasonable length and afterwards add the OMText nodes again to the right 
position. Then Axis2 does all the MTOM stuff correctly.

So thanks for your help!
Simon


Thilina Gunarathne wrote:
> Hello,
>
>   
>> I have the following problem:
>> I have a service that does MTOM. In a Module on the client side, i need
>> to do some xslt transformation on the soap structure. But when I do that
>> (I use Saxon9 for xslt transformation) I need to convert that SOAP
>> message to a string to apply that xslt transformer. When I rebuild the
>> transformed soap envelope again with the StAXSOAPModelBuilder all MTOM
>> information is somehow lost...
>>     
> When you convert the whole SOAP message to a String using Axiom API's,
> the MTOM attachments become text nodes having the attachment content
> encoded in base64. But if you write the message object model using
> MTOMWriter, then those text nodes will be written as attachments.. But
> if you just took out the string, then there won't be any information
> about MTOM..
>
> Also on a side note use the MTOMStAXSOAPModelBuilder if you want to
> build a MTOM message.. But it will not solve your issue..
>   
>> I already tried to get the MTOM attachments on the client side inside
>> the module, but there the attachmentsmap conveyed in the message context
>> is empty.
>>     
> Did you try monitoring the actual wire level message & did you see the
> attachment's in it..
> One reason might be that the attachments are still not build due to
> differed building of Axis2. Try calling
> SOAPEnvelope.buildWithAttachments();
>
>   
>> My question now is: how can I preserve mtom information after in the
>> client module when I need to transform the soap string?
>>     
> Should be possible if you need only to transform the contents of the
> root mime part, as you have mentioned below.
>   
>> On the server
>> side I managed to do it by reading out the 0th attachments, which is the
>> soap envelope and alter this one. Through that the attachments are not
>> built into the soap envelope. But on the client module I do not seem to
>> have access to the MTOM message... is it somehow possible to intercept
>> the MTOM message on the client side?
>>     
> Same as in the server...
>   
>> Btw: the module's handler on the client side is bount to the MessageOut
>> phase.
>>     
> hmm...too bad.. I was under the impression that you are talking about
> receiving a message in the client side. In this case attachments are
> not processed and they are not in the MAP.. AttachmentMAP is populated
> only for incoming messages.
>
> Only clear solution I can think of is to manually traverse the rebuilt
> SOAPMessage and then to mark all the text nodes that contains binary
> content as follows..
>
> textNode.setBinary(true);
> textNode.setOptimized(true);
>
> thanks,
> Thilina
>   
>> Thanks for your help and input,
>> Best regards
>> Simon
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
>>     
>
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Axis2 MTOM + module

Posted by Thilina Gunarathne <cs...@gmail.com>.
Hello,

> I have the following problem:
> I have a service that does MTOM. In a Module on the client side, i need
> to do some xslt transformation on the soap structure. But when I do that
> (I use Saxon9 for xslt transformation) I need to convert that SOAP
> message to a string to apply that xslt transformer. When I rebuild the
> transformed soap envelope again with the StAXSOAPModelBuilder all MTOM
> information is somehow lost...
When you convert the whole SOAP message to a String using Axiom API's,
the MTOM attachments become text nodes having the attachment content
encoded in base64. But if you write the message object model using
MTOMWriter, then those text nodes will be written as attachments.. But
if you just took out the string, then there won't be any information
about MTOM..

Also on a side note use the MTOMStAXSOAPModelBuilder if you want to
build a MTOM message.. But it will not solve your issue..
>
> I already tried to get the MTOM attachments on the client side inside
> the module, but there the attachmentsmap conveyed in the message context
> is empty.
Did you try monitoring the actual wire level message & did you see the
attachment's in it..
One reason might be that the attachments are still not build due to
differed building of Axis2. Try calling
SOAPEnvelope.buildWithAttachments();

> My question now is: how can I preserve mtom information after in the
> client module when I need to transform the soap string?
Should be possible if you need only to transform the contents of the
root mime part, as you have mentioned below.
> On the server
> side I managed to do it by reading out the 0th attachments, which is the
> soap envelope and alter this one. Through that the attachments are not
> built into the soap envelope. But on the client module I do not seem to
> have access to the MTOM message... is it somehow possible to intercept
> the MTOM message on the client side?
Same as in the server...
> Btw: the module's handler on the client side is bount to the MessageOut
> phase.
hmm...too bad.. I was under the impression that you are talking about
receiving a message in the client side. In this case attachments are
not processed and they are not in the MAP.. AttachmentMAP is populated
only for incoming messages.

Only clear solution I can think of is to manually traverse the rebuilt
SOAPMessage and then to mark all the text nodes that contains binary
content as follows..

textNode.setBinary(true);
textNode.setOptimized(true);

thanks,
Thilina
>
> Thanks for your help and input,
> Best regards
> Simon
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>



-- 
Thilina Gunarathne  - http://thilinag.blogspot.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org