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 Tech Savvy <te...@gmail.com> on 2006/07/05 20:06:30 UTC

MTOM web service

Hi,

Have two question regarding to MTOM:

1. The sample in the guide is using AXIS2 api to code the webservice and
client, e.g. OMElements. In such case a wsdl is not present so this is tied
to AXIS2, i.e. a .NET client can't access the service. Is there a way to
code the webservice use POJO (i.e. RPC style webservice), then generate the
client stub to call it, and still be able to enable MTOM?

2. In the webservice, how do I detect whether a OMText is Base64 encoded?

Re: MTOM web service

Posted by Martin Gainty <mg...@hotmail.com>.
Sunny-

You can read the encoding from the Envelope

        MessageFactory factory = MessageFactory.newInstance();
        SOAPMessage message = factory.createMessage();

        SOAPPart soapPart = message.getSOAPPart();
        SOAPEnvelope envelope = soapPart.getEnvelope();

        String style = envelope.getEncodingStyle();

Take a look at
http://ws.apache.org/axis/java/apiDocs/javax/xml/soap/SOAPElement.html#getEncodingStyle()

HTH,
Martin --
*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.



  ----- Original Message ----- 
  From: Tech Savvy 
  To: axis-user@ws.apache.org 
  Sent: Wednesday, July 05, 2006 2:39 PM
  Subject: Re: MTOM web service


  Thilina,

  Thanks for your reply. What I am trying to do, is to test the MTOM technology with AXIS2. I have successfully run the MTOM example come with AXIS2. However, since the sample is tied to the OMElement APIs, and there's no WSDL generated, I can't prove that a .net client can access the web service with its MTOM implementation. Is there a way to do such a test? The approach I was thinking is to develop a web service with POJO so a WSDL is generate, and I can use it in a .net framework to generate a client, and enable MTOM when making the call...can this be done? 

  On the OMText side, since the WebService will receive a String regardless OTOM is enabled or not, should there be a API call to detected wether the text is a Base64 encoded string? Here's my senario: on my client side I send a OMText to the web serivce. If the OMText is built using a handler, it will be Based64 encoded thus I need to decode it manually to get the original content; if the OMText is a plain "Hello, World", it wont' be encoded. However on the webservice side, it always received a OMText. Now comes the hard part: how do I know if I need to decode the text or not? 

  Thanks.

  Sunny *



  On 7/5/06, Thilina Gunarathne <cs...@gmail.com> wrote:
    See my comments inline..


    On 7/6/06, Tech Savvy < tech.savvy@gmail.com> wrote: 
      Hi,

      Have two question regarding to MTOM:

      1. The sample in the guide is using AXIS2 api to code the webservice and client, e.g. OMElements. In such case a wsdl is not present so this is tied to AXIS2, i.e . a .NET client can't access the service. Is there a way to code the webservice use POJO (i.e. RPC style webservice), then generate the client stub to call it, and still be able to enable MTOM?

    I'm not sure about this.. 


      2. In the webservice, how do I detect whether a OMText is Base64 encoded? 

    If it is in a message you receive then you will not be able to detect it without knowing the schema. If you created it using some binary or by explicitly specifying that it is base64 then the OMText.isBinay() will return true. 

    ~Thilina




Re: MTOM web service

Posted by Thilina Gunarathne <cs...@gmail.com>.
 Hi,
See my comments in line.


On 7/6/06, Tech Savvy <te...@gmail.com> wrote:
>
> Thilina,
>
> Thanks for your reply. What I am trying to do, is to test the MTOM
> technology with AXIS2. I have successfully run the MTOM example come with
> AXIS2. However, since the sample is tied to the OMElement APIs, and there's
> no WSDL generated, I can't prove that a .net client can access the web
> service with its MTOM implementation. Is there a way to do such a test?
>


Unfortunately writing a WSDL for the sample is still in my to do list :(..
I'll do it soon.
I have done something similar to your requirement during a Interop tutorial.
Best is to get a WSDL with MTOM binding (may be from .net) and generate a
service from that. I recommend you to use ADB.

Code from the interop tutorial can be found at
http://www.dasblonde.net/PermaLink,guid,d4196408-ead8-4f50-bad4-3168dc9bc17f.aspx
But it's bit outdated now.


> The approach I was thinking is to develop a web service with POJO so a
> WSDL is generate, and I can use it in a .net framework to generate a client,
> and enable MTOM when making the call...can this be done?
>

I'm not sure.. Ideal scenerio is to generate an MTOM binding if a
DataHandler is found on the method signature...
Deepal, Ajith,
is this possible.

 On the OMText side, since the WebService will receive a String regardless
> OTOM is enabled or not, should there be a API call to detected wether the
> text is a Base64 encoded string?
>

It'lll be better if we can have. But it's not trivial...

 Here's my senario: on my client side I send a OMText to the web serivce. If
> the OMText is built using a handler, it will be Based64 encoded thus I need
> to decode it manually to get the original content; if the OMText is a plain
> "Hello, World", it wont' be encoded. However on the webservice side, it
> always received a OMText. Now comes the hard part: how do I know if I need
> to decode the text or not?
>

You needs to be aware of the schema. If it says base64 then you have to do
it. In a web service the interface needs to be properly defined. If it is
defined to take in binary, then you can manually set the setBinary(true) for
that OMText and get the dataHandler. If it is defined to take in text, then
treat them as text.

Thanks,
~Thilina


Thanks.

Sunny *

>
>
>
> On 7/5/06, Thilina Gunarathne <csethil@gmail.com > wrote:
> >
> > See my comments inline..
> >
> >  On 7/6/06, Tech Savvy < tech.savvy@gmail.com > wrote:
> > >
> > > Hi,
> > >
> > > Have two question regarding to MTOM:
> > >
> > > 1. The sample in the guide is using AXIS2 api to code the webservice
> > > and client, e.g. OMElements. In such case a wsdl is not present so
> > > this is tied to AXIS2, i.e . a .NET client can't access the service.
> > > Is there a way to code the webservice use POJO (i.e. RPC style
> > > webservice), then generate the client stub to call it, and still be able to
> > > enable MTOM?
> > >
> >
> >  I'm not sure about this..
> >
> >  2. In the webservice, how do I detect whether a OMText is Base64
> > > encoded?
> > >
> >
> >  If it is in a message you receive then you will not be able to detect
> > it without knowing the schema. If you created it using some binary or by
> > explicitly specifying that it is base64 then the OMText.isBinay() will
> > return true.
> >
> > ~Thilina
> >
> >
>


-- 
"May the SourcE be with u"
http://webservices.apache.org/~thilina/
http://thilinag.blogspot.com/
http://www.bloglines.com/blog/Thilina

Re: MTOM web service

Posted by Tech Savvy <te...@gmail.com>.
Thilina,

Thanks for your reply. What I am trying to do, is to test the MTOM
technology with AXIS2. I have successfully run the MTOM example come with
AXIS2. However, since the sample is tied to the OMElement APIs, and there's
no WSDL generated, I can't prove that a .net client can access the web
service with its MTOM implementation. Is there a way to do such a test? The
approach I was thinking is to develop a web service with POJO so a WSDL is
generate, and I can use it in a .net framework to generate a client, and
enable MTOM when making the call...can this be done?

On the OMText side, since the WebService will receive a String regardless
OTOM is enabled or not, should there be a API call to detected wether the
text is a Base64 encoded string? Here's my senario: on my client side I send
a OMText to the web serivce. If the OMText is built using a handler, it will
be Based64 encoded thus I need to decode it manually to get the original
content; if the OMText is a plain "Hello, World", it wont' be encoded.
However on the webservice side, it always received a OMText. Now comes the
hard part: how do I know if I need to decode the text or not?

Thanks.

Sunny *


On 7/5/06, Thilina Gunarathne <cs...@gmail.com> wrote:
>
> See my comments inline..
>
> On 7/6/06, Tech Savvy <te...@gmail.com> wrote:
> >
> > Hi,
> >
> > Have two question regarding to MTOM:
> >
> > 1. The sample in the guide is using AXIS2 api to code the webservice and
> > client, e.g. OMElements. In such case a wsdl is not present so this is
> > tied to AXIS2, i.e . a .NET client can't access the service. Is there a
> > way to code the webservice use POJO (i.e. RPC style webservice), then
> > generate the client stub to call it, and still be able to enable MTOM?
> >
>
> I'm not sure about this..
>
>  2. In the webservice, how do I detect whether a OMText is Base64 encoded?
> >
> >
>
> If it is in a message you receive then you will not be able to detect it
> without knowing the schema. If you created it using some binary or by
> explicitly specifying that it is base64 then the OMText.isBinay() will
> return true.
>
> ~Thilina
>
>

Re: MTOM web service

Posted by Thilina Gunarathne <cs...@gmail.com>.
See my comments inline..

On 7/6/06, Tech Savvy <te...@gmail.com> wrote:
>
> Hi,
>
> Have two question regarding to MTOM:
>
> 1. The sample in the guide is using AXIS2 api to code the webservice and
> client, e.g. OMElements. In such case a wsdl is not present so this is
> tied to AXIS2, i.e. a .NET client can't access the service. Is there a way
> to code the webservice use POJO (i.e. RPC style webservice), then generate
> the client stub to call it, and still be able to enable MTOM?
>

I'm not sure about this..

 2. In the webservice, how do I detect whether a OMText is Base64 encoded?
>

If it is in a message you receive then you will not be able to detect it
without knowing the schema. If you created it using some binary or by
explicitly specifying that it is base64 then the OMText.isBinay() will
return true.

~Thilina