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 Greg Fichtenholtz <gr...@yahoo.com> on 2006/08/21 07:52:20 UTC

[Axis2] to to send multipart/related message

Hello,
my goal is to send multipart/related message (SOAP envelope with attachments).
 
My client code looks like this:
 
 public static void main(String[] args)
  throws Exception
 {
     EndpointReference targetEPR = new EndpointReference("http://localhost:8080/axis2/services/AttachService");
     Options options = new Options();
        options.setTo(targetEPR);
        options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
  OMFactory factory = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = factory.createOMNamespace(
                "http://example1.org/example1", "example1");

        OMElement method = factory.createOMElement("echo", omNs);
        OMElement value = factory.createOMElement("image", omNs);
  String inputImageFileName = "C:\\TEMP\\ALSB.jpl";
        Image image = new ImageIO().loadImage(new FileInputStream(inputImageFileName));
        ImageDataSource ds = new ImageDataSource("ALSB.jpl",image);
        DataHandler dh = new DataHandler(ds);
        OMText textData = factory.createOMText(dh, true);
        value.addChild(textData);
        method.addChild(value);

        //Blocking invocation
        ServiceClient sender = new ServiceClient();
        sender.setOptions(options);
        OMElement result = sender.sendReceive(method);
        System.out.println(result);
 }

 
for some reason when I send this, both SOAP Monitor and network sniffer show that the actual data sent on the wire looks like this:
 
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Header />
  <soapenv:Body>
    <example1:echo xmlns:example1="http://example1.org/example1">
      <example1:image>/9j/4AAQSkZJRgABAgAAAQABAAD/2w...</example1:image>
    </example1:echo>
  </soapenv:Body>
</soapenv:Envelope>
 
(I shortened the contents of the image element for brevity)
 
This is not what I expected and not what I want. Could some one please help figure out why multipart/related MIME message is not used in this case?
 
Thanks in advance
Greg

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


Re: [Axis2] to to send multipart/related message

Posted by Greg Fichtenholtz <gr...@yahoo.com>.
Thank you for that explanation.
 
I have an additional somewhat related question regarding attachments:
 
does Axis2 have any support for this:
 
http://www.w3.org/TR/soap12-rep/ (SOAP representation block)
 
If so, are there sample applications I could look at?
 
Thanks in advance
Greg


----- Original Message ----
From: Anne Thomas Manes <at...@gmail.com>
To: axis-user@ws.apache.org
Sent: Monday, August 21, 2006 3:12:37 PM
Subject: Re: [Axis2] to to send multipart/related message


Technically, Greg is correct. But there are extenuating circumstances.

XML InfoSet defines an abstract data model that can be serialized into
multiple formats.
The SOAP 1.1 envelope structure is defined in terms of concrete XML
and XML Schema as opposed to InfoSet. Given that the envelope
structure is a concrete definition, a valid SOAP document must conform
to the prescribed serialization format (XML). The SOAP 1.2 envelope is
defined in terms of InfoSet (an abstract definition), and therefore it
can be serialized into any compliant serialization format. Normally,
it is serialized as XML -- but that isn't a requirement.

XOP/MTOM defines an alternative serialization format in which
xsd:base64binary elements can be serialized as multipart/related MIME
types. Applying MTOM optimization to a SOAP 1.2 envelope would
normally not pass validation.

But -- the SOAP 1.1 Binding for MTOM [1] extends the SOAP
specification, enabling MTOM to work with SOAP 1.1.

[1] http://www.w3.org/Submission/soap11mtom10/

Anne

On 8/21/06, Ajith Ranabahu <aj...@gmail.com> wrote:
> Hi,
>
> 1. Infoset is a general concept - usually it is referred to as the
> 'XML infoset' and SOAP infoset can be thought of as a subset of XML
> infoset
>
> 2. Even If you''ve used the optimization method, Axis2 will not do the
> wire optimization if it is not told to.
>
> You might find parts of the following article useful
> http://www.wso2.net/articles/axis2/java/2006/08/10/binary-with-adb
>
> Ajith
>
> On 8/21/06, Greg Fichtenholtz <gr...@yahoo.com> wrote:
> > Thanks,
> >
> > couple of follow-up questions:
> > 1. I thought SOAP 1.2 only was based on infoset. You will notice that I am trying to use SOAP 1.1 in my example
> >
> > 2. regarding the optimization of OMText: if, in my example, I use
> > OMText textData = factory.createOMText(dh, false);
> > i.e. turn off the OMtext optimization, I still get the old behavior (i.e. binary content being replaced by base64 encoded text)
> >
> > Greg
> >
> > ----- Original Message ----
> > From: Saminda Abeyruwan <sa...@opensource.lk>
> > To: axis-user@ws.apache.org
> > Sent: Monday, August 21, 2006 11:12:25 AM
> > Subject: Re: [Axis2] to to send multipart/related message
> >
> >
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > Hi,
> >
> > In very brief,
> >
> > In infoset all binary content is replaced by base64 characters, if the
> > OMText asked to be optimized or if a DataHandler is given to it.
> >
> > MTOM on the other hand is a wire optimization mechanism. Thus, to
> > achieve this you have to set the prior option to ServiceClient,
> > otherwise the SOAP payload will be serialized with base64.
> >
> > Saminda
> >
> > Greg Fichtenholtz wrote:
> > > Saminda,
> > > Thank you. This worked like a charm.
> > >
> > > Care to explain why I need to enable MTOM to get multipart/related content? I thought that I would get it regardless?
> > > Is this an Axis2 feature?
> > >
> > > Thanks in advance
> > > Greg
> > >
> > >
> > > ----- Original Message ----
> > > From: Saminda Abeyruwan <sa...@opensource.lk>
> > > To: axis-user@ws.apache.org
> > > Sent: Monday, August 21, 2006 3:07:14 AM
> > > Subject: Re: [Axis2] to to send multipart/related message
> > >
> > >
> > > Hi,
> > >
> > > Please set
> > >
> > > options.setProperty(Constants.Configuration.ENABLE_MTOM,
> > > Constants.VALUE_TRUE);
> > >
> > > Thank you
> > >
> > > Saminda
> > >
> > > Greg Fichtenholtz wrote:
> > >
> > >>>Hello,
> > >>>my goal is to send multipart/related message (SOAP envelope with attachments).
> > >>>
> > >>>My client code looks like this:
> > >>>
> > >>> public static void main(String[] args)
> > >>>  throws Exception
> > >>> {
> > >>>     EndpointReference targetEPR = new EndpointReference("http://localhost:8080/axis2/services/AttachService";;;);
> > >>>     Options options = new Options();
> > >>>        options.setTo(targetEPR);
> > >>>        options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
> > >>>  OMFactory factory = OMAbstractFactory.getOMFactory();
> > >>>        OMNamespace omNs = factory.createOMNamespace(
> > >>>                "http://example1.org/example1";;;, "example1");
> > >>>
> > >>>        OMElement method = factory.createOMElement("echo", omNs);
> > >>>        OMElement value = factory.createOMElement("image", omNs);
> > >>>  String inputImageFileName = "C:\\TEMP\\ALSB.jpl";
> > >>>        Image image = new ImageIO().loadImage(new FileInputStream(inputImageFileName));
> > >>>        ImageDataSource ds = new ImageDataSource("ALSB.jpl",image);
> > >>>        DataHandler dh = new DataHandler(ds);
> > >>>        OMText textData = factory.createOMText(dh, true);
> > >>>        value.addChild(textData);
> > >>>        method.addChild(value);
> > >>>
> > >>>        //Blocking invocation
> > >>>        ServiceClient sender = new ServiceClient();
> > >>>        sender.setOptions(options);
> > >>>        OMElement result = sender.sendReceive(method);
> > >>>        System.out.println(result);
> > >>> }
> > >>>
> > >>>
> > >>>for some reason when I send this, both SOAP Monitor and network sniffer show that the actual data sent on the wire looks like this:
> > >>>
> > >>><?xml version='1.0' encoding='utf-8'?>
> > >>><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";;;>
> > >>>  <soapenv:Header />
> > >>>  <soapenv:Body>
> > >>>    <example1:echo xmlns:example1="http://example1.org/example1";;;>
> > >>>      <example1:image>/9j/4AAQSkZJRgABAgAAAQABAAD/2w...</example1:image>
> > >>>    </example1:echo>
> > >>>  </soapenv:Body>
> > >>></soapenv:Envelope>
> > >>>
> > >>>(I shortened the contents of the image element for brevity)
> > >>>
> > >>>This is not what I expected and not what I want. Could some one please help figure out why multipart/related MIME message is not used in this case?
> > >>>
> > >>>Thanks in advance
> > >>>Greg
> > >>>
> > >>>---------------------------------------------------------------------
> > >>>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
> >
> > - ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
> >
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.4.1 (GNU/Linux)
> > Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
> >
> > iD8DBQFE6feJYmklbLuW6wYRAmLRAJ9OVpR24eGVpv6R5lKBg3RvD1S3AQCfX4/T
> > HkLgoJ16WMQE0xj8u0LBWvo=
> > =qUn2
> > -----END PGP SIGNATURE-----
> >
> > ---------------------------------------------------------------------
> > 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
> >
> >
>
>
> --
> Ajith Ranabahu
>
> ---------------------------------------------------------------------
> 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

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


Re: [Axis2] to to send multipart/related message

Posted by Anne Thomas Manes <at...@gmail.com>.
Technically, Greg is correct. But there are extenuating circumstances.

XML InfoSet defines an abstract data model that can be serialized into
multiple formats.
The SOAP 1.1 envelope structure is defined in terms of concrete XML
and XML Schema as opposed to InfoSet. Given that the envelope
structure is a concrete definition, a valid SOAP document must conform
to the prescribed serialization format (XML). The SOAP 1.2 envelope is
defined in terms of InfoSet (an abstract definition), and therefore it
can be serialized into any compliant serialization format. Normally,
it is serialized as XML -- but that isn't a requirement.

XOP/MTOM defines an alternative serialization format in which
xsd:base64binary elements can be serialized as multipart/related MIME
types. Applying MTOM optimization to a SOAP 1.2 envelope would
normally not pass validation.

But -- the SOAP 1.1 Binding for MTOM [1] extends the SOAP
specification, enabling MTOM to work with SOAP 1.1.

[1] http://www.w3.org/Submission/soap11mtom10/

Anne

On 8/21/06, Ajith Ranabahu <aj...@gmail.com> wrote:
> Hi,
>
> 1. Infoset is a general concept - usually it is referred to as the
> 'XML infoset' and SOAP infoset can be thought of as a subset of XML
> infoset
>
> 2. Even If you''ve used the optimization method, Axis2 will not do the
> wire optimization if it is not told to.
>
> You might find parts of the following article useful
> http://www.wso2.net/articles/axis2/java/2006/08/10/binary-with-adb
>
> Ajith
>
> On 8/21/06, Greg Fichtenholtz <gr...@yahoo.com> wrote:
> > Thanks,
> >
> > couple of follow-up questions:
> > 1. I thought SOAP 1.2 only was based on infoset. You will notice that I am trying to use SOAP 1.1 in my example
> >
> > 2. regarding the optimization of OMText: if, in my example, I use
> > OMText textData = factory.createOMText(dh, false);
> > i.e. turn off the OMtext optimization, I still get the old behavior (i.e. binary content being replaced by base64 encoded text)
> >
> > Greg
> >
> > ----- Original Message ----
> > From: Saminda Abeyruwan <sa...@opensource.lk>
> > To: axis-user@ws.apache.org
> > Sent: Monday, August 21, 2006 11:12:25 AM
> > Subject: Re: [Axis2] to to send multipart/related message
> >
> >
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > Hi,
> >
> > In very brief,
> >
> > In infoset all binary content is replaced by base64 characters, if the
> > OMText asked to be optimized or if a DataHandler is given to it.
> >
> > MTOM on the other hand is a wire optimization mechanism. Thus, to
> > achieve this you have to set the prior option to ServiceClient,
> > otherwise the SOAP payload will be serialized with base64.
> >
> > Saminda
> >
> > Greg Fichtenholtz wrote:
> > > Saminda,
> > > Thank you. This worked like a charm.
> > >
> > > Care to explain why I need to enable MTOM to get multipart/related content? I thought that I would get it regardless?
> > > Is this an Axis2 feature?
> > >
> > > Thanks in advance
> > > Greg
> > >
> > >
> > > ----- Original Message ----
> > > From: Saminda Abeyruwan <sa...@opensource.lk>
> > > To: axis-user@ws.apache.org
> > > Sent: Monday, August 21, 2006 3:07:14 AM
> > > Subject: Re: [Axis2] to to send multipart/related message
> > >
> > >
> > > Hi,
> > >
> > > Please set
> > >
> > > options.setProperty(Constants.Configuration.ENABLE_MTOM,
> > > Constants.VALUE_TRUE);
> > >
> > > Thank you
> > >
> > > Saminda
> > >
> > > Greg Fichtenholtz wrote:
> > >
> > >>>Hello,
> > >>>my goal is to send multipart/related message (SOAP envelope with attachments).
> > >>>
> > >>>My client code looks like this:
> > >>>
> > >>> public static void main(String[] args)
> > >>>  throws Exception
> > >>> {
> > >>>     EndpointReference targetEPR = new EndpointReference("http://localhost:8080/axis2/services/AttachService";;);
> > >>>     Options options = new Options();
> > >>>        options.setTo(targetEPR);
> > >>>        options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
> > >>>  OMFactory factory = OMAbstractFactory.getOMFactory();
> > >>>        OMNamespace omNs = factory.createOMNamespace(
> > >>>                "http://example1.org/example1";;, "example1");
> > >>>
> > >>>        OMElement method = factory.createOMElement("echo", omNs);
> > >>>        OMElement value = factory.createOMElement("image", omNs);
> > >>>  String inputImageFileName = "C:\\TEMP\\ALSB.jpl";
> > >>>        Image image = new ImageIO().loadImage(new FileInputStream(inputImageFileName));
> > >>>        ImageDataSource ds = new ImageDataSource("ALSB.jpl",image);
> > >>>        DataHandler dh = new DataHandler(ds);
> > >>>        OMText textData = factory.createOMText(dh, true);
> > >>>        value.addChild(textData);
> > >>>        method.addChild(value);
> > >>>
> > >>>        //Blocking invocation
> > >>>        ServiceClient sender = new ServiceClient();
> > >>>        sender.setOptions(options);
> > >>>        OMElement result = sender.sendReceive(method);
> > >>>        System.out.println(result);
> > >>> }
> > >>>
> > >>>
> > >>>for some reason when I send this, both SOAP Monitor and network sniffer show that the actual data sent on the wire looks like this:
> > >>>
> > >>><?xml version='1.0' encoding='utf-8'?>
> > >>><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";;>
> > >>>  <soapenv:Header />
> > >>>  <soapenv:Body>
> > >>>    <example1:echo xmlns:example1="http://example1.org/example1";;>
> > >>>      <example1:image>/9j/4AAQSkZJRgABAgAAAQABAAD/2w...</example1:image>
> > >>>    </example1:echo>
> > >>>  </soapenv:Body>
> > >>></soapenv:Envelope>
> > >>>
> > >>>(I shortened the contents of the image element for brevity)
> > >>>
> > >>>This is not what I expected and not what I want. Could some one please help figure out why multipart/related MIME message is not used in this case?
> > >>>
> > >>>Thanks in advance
> > >>>Greg
> > >>>
> > >>>---------------------------------------------------------------------
> > >>>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
> >
> > - ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
> >
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.4.1 (GNU/Linux)
> > Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
> >
> > iD8DBQFE6feJYmklbLuW6wYRAmLRAJ9OVpR24eGVpv6R5lKBg3RvD1S3AQCfX4/T
> > HkLgoJ16WMQE0xj8u0LBWvo=
> > =qUn2
> > -----END PGP SIGNATURE-----
> >
> > ---------------------------------------------------------------------
> > 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
> >
> >
>
>
> --
> Ajith Ranabahu
>
> ---------------------------------------------------------------------
> 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] to to send multipart/related message

Posted by Sanjesh Pathak <sa...@soapknox.com>.
Hi Amit,

You can set up the data source entries in the application server and access
it from the service or it's associated classes in aar file. At least this
set up works in Tomcat.

Sanjesh
http://www.soapknox.com
Real-Time Web Service Monitoring Tool for Axis(2)
Ph: 832 279 3745

-----Original Message-----
From: Kumar, Amit Z (Compliance Tech) [mailto:amit.z.kumar@gs.com] 
Sent: Wednesday, August 23, 2006 10:24 AM
To: axis-user@ws.apache.org
Subject: RE: [Axis2] to to send multipart/related message

Hi Guys, 

I have a webservice in form of .aar file but I wana register few data
source with in required some code with in. 
Can I create web-inf in .aar file and put a web.xml file with datasource
entries?

Or is there another way of doing it in web services?


Regards
Amit
30, Hudson St.
Goldman Sachs
PH: 212 902 0395
"Willing to learn what you are willing to share."

---------------------------------------------------------------------
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] to to send multipart/related message

Posted by "Kumar, Amit Z (Compliance Tech)" <am...@gs.com>.
Hi Guys, 

I have a webservice in form of .aar file but I wana register few data
source with in required some code with in. 
Can I create web-inf in .aar file and put a web.xml file with datasource
entries?

Or is there another way of doing it in web services?


Regards
Amit
30, Hudson St.
Goldman Sachs
PH: 212 902 0395
"Willing to learn what you are willing to share."

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


Re: [Axis2] to to send multipart/related message

Posted by Ajith Ranabahu <aj...@gmail.com>.
Hi,

1. Infoset is a general concept - usually it is referred to as the
'XML infoset' and SOAP infoset can be thought of as a subset of XML
infoset

2. Even If you''ve used the optimization method, Axis2 will not do the
wire optimization if it is not told to.

You might find parts of the following article useful
http://www.wso2.net/articles/axis2/java/2006/08/10/binary-with-adb

Ajith

On 8/21/06, Greg Fichtenholtz <gr...@yahoo.com> wrote:
> Thanks,
>
> couple of follow-up questions:
> 1. I thought SOAP 1.2 only was based on infoset. You will notice that I am trying to use SOAP 1.1 in my example
>
> 2. regarding the optimization of OMText: if, in my example, I use
> OMText textData = factory.createOMText(dh, false);
> i.e. turn off the OMtext optimization, I still get the old behavior (i.e. binary content being replaced by base64 encoded text)
>
> Greg
>
> ----- Original Message ----
> From: Saminda Abeyruwan <sa...@opensource.lk>
> To: axis-user@ws.apache.org
> Sent: Monday, August 21, 2006 11:12:25 AM
> Subject: Re: [Axis2] to to send multipart/related message
>
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> In very brief,
>
> In infoset all binary content is replaced by base64 characters, if the
> OMText asked to be optimized or if a DataHandler is given to it.
>
> MTOM on the other hand is a wire optimization mechanism. Thus, to
> achieve this you have to set the prior option to ServiceClient,
> otherwise the SOAP payload will be serialized with base64.
>
> Saminda
>
> Greg Fichtenholtz wrote:
> > Saminda,
> > Thank you. This worked like a charm.
> >
> > Care to explain why I need to enable MTOM to get multipart/related content? I thought that I would get it regardless?
> > Is this an Axis2 feature?
> >
> > Thanks in advance
> > Greg
> >
> >
> > ----- Original Message ----
> > From: Saminda Abeyruwan <sa...@opensource.lk>
> > To: axis-user@ws.apache.org
> > Sent: Monday, August 21, 2006 3:07:14 AM
> > Subject: Re: [Axis2] to to send multipart/related message
> >
> >
> > Hi,
> >
> > Please set
> >
> > options.setProperty(Constants.Configuration.ENABLE_MTOM,
> > Constants.VALUE_TRUE);
> >
> > Thank you
> >
> > Saminda
> >
> > Greg Fichtenholtz wrote:
> >
> >>>Hello,
> >>>my goal is to send multipart/related message (SOAP envelope with attachments).
> >>>
> >>>My client code looks like this:
> >>>
> >>> public static void main(String[] args)
> >>>  throws Exception
> >>> {
> >>>     EndpointReference targetEPR = new EndpointReference("http://localhost:8080/axis2/services/AttachService";;);
> >>>     Options options = new Options();
> >>>        options.setTo(targetEPR);
> >>>        options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
> >>>  OMFactory factory = OMAbstractFactory.getOMFactory();
> >>>        OMNamespace omNs = factory.createOMNamespace(
> >>>                "http://example1.org/example1";;, "example1");
> >>>
> >>>        OMElement method = factory.createOMElement("echo", omNs);
> >>>        OMElement value = factory.createOMElement("image", omNs);
> >>>  String inputImageFileName = "C:\\TEMP\\ALSB.jpl";
> >>>        Image image = new ImageIO().loadImage(new FileInputStream(inputImageFileName));
> >>>        ImageDataSource ds = new ImageDataSource("ALSB.jpl",image);
> >>>        DataHandler dh = new DataHandler(ds);
> >>>        OMText textData = factory.createOMText(dh, true);
> >>>        value.addChild(textData);
> >>>        method.addChild(value);
> >>>
> >>>        //Blocking invocation
> >>>        ServiceClient sender = new ServiceClient();
> >>>        sender.setOptions(options);
> >>>        OMElement result = sender.sendReceive(method);
> >>>        System.out.println(result);
> >>> }
> >>>
> >>>
> >>>for some reason when I send this, both SOAP Monitor and network sniffer show that the actual data sent on the wire looks like this:
> >>>
> >>><?xml version='1.0' encoding='utf-8'?>
> >>><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";;>
> >>>  <soapenv:Header />
> >>>  <soapenv:Body>
> >>>    <example1:echo xmlns:example1="http://example1.org/example1";;>
> >>>      <example1:image>/9j/4AAQSkZJRgABAgAAAQABAAD/2w...</example1:image>
> >>>    </example1:echo>
> >>>  </soapenv:Body>
> >>></soapenv:Envelope>
> >>>
> >>>(I shortened the contents of the image element for brevity)
> >>>
> >>>This is not what I expected and not what I want. Could some one please help figure out why multipart/related MIME message is not used in this case?
> >>>
> >>>Thanks in advance
> >>>Greg
> >>>
> >>>---------------------------------------------------------------------
> >>>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
>
> - ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
>
> iD8DBQFE6feJYmklbLuW6wYRAmLRAJ9OVpR24eGVpv6R5lKBg3RvD1S3AQCfX4/T
> HkLgoJ16WMQE0xj8u0LBWvo=
> =qUn2
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> 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
>
>


-- 
Ajith Ranabahu

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


Re: [Axis2] to to send multipart/related message

Posted by Greg Fichtenholtz <gr...@yahoo.com>.
Thanks,
 
couple of follow-up questions:
1. I thought SOAP 1.2 only was based on infoset. You will notice that I am trying to use SOAP 1.1 in my example
 
2. regarding the optimization of OMText: if, in my example, I use 
OMText textData = factory.createOMText(dh, false);
i.e. turn off the OMtext optimization, I still get the old behavior (i.e. binary content being replaced by base64 encoded text)
 
Greg

----- Original Message ----
From: Saminda Abeyruwan <sa...@opensource.lk>
To: axis-user@ws.apache.org
Sent: Monday, August 21, 2006 11:12:25 AM
Subject: Re: [Axis2] to to send multipart/related message


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

In very brief,

In infoset all binary content is replaced by base64 characters, if the
OMText asked to be optimized or if a DataHandler is given to it.

MTOM on the other hand is a wire optimization mechanism. Thus, to
achieve this you have to set the prior option to ServiceClient,
otherwise the SOAP payload will be serialized with base64.

Saminda

Greg Fichtenholtz wrote:
> Saminda,
> Thank you. This worked like a charm. 
>  
> Care to explain why I need to enable MTOM to get multipart/related content? I thought that I would get it regardless?
> Is this an Axis2 feature? 
>  
> Thanks in advance
> Greg
>  
> 
> ----- Original Message ----
> From: Saminda Abeyruwan <sa...@opensource.lk>
> To: axis-user@ws.apache.org
> Sent: Monday, August 21, 2006 3:07:14 AM
> Subject: Re: [Axis2] to to send multipart/related message
> 
> 
> Hi,
> 
> Please set
> 
> options.setProperty(Constants.Configuration.ENABLE_MTOM,
> Constants.VALUE_TRUE);
> 
> Thank you
> 
> Saminda
> 
> Greg Fichtenholtz wrote:
> 
>>>Hello,
>>>my goal is to send multipart/related message (SOAP envelope with attachments).
>>> 
>>>My client code looks like this:
>>> 
>>> public static void main(String[] args)
>>>  throws Exception
>>> {
>>>     EndpointReference targetEPR = new EndpointReference("http://localhost:8080/axis2/services/AttachService";;);
>>>     Options options = new Options();
>>>        options.setTo(targetEPR);
>>>        options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
>>>  OMFactory factory = OMAbstractFactory.getOMFactory();
>>>        OMNamespace omNs = factory.createOMNamespace(
>>>                "http://example1.org/example1";;, "example1");
>>>
>>>        OMElement method = factory.createOMElement("echo", omNs);
>>>        OMElement value = factory.createOMElement("image", omNs);
>>>  String inputImageFileName = "C:\\TEMP\\ALSB.jpl";
>>>        Image image = new ImageIO().loadImage(new FileInputStream(inputImageFileName));
>>>        ImageDataSource ds = new ImageDataSource("ALSB.jpl",image);
>>>        DataHandler dh = new DataHandler(ds);
>>>        OMText textData = factory.createOMText(dh, true);
>>>        value.addChild(textData);
>>>        method.addChild(value);
>>>
>>>        //Blocking invocation
>>>        ServiceClient sender = new ServiceClient();
>>>        sender.setOptions(options);
>>>        OMElement result = sender.sendReceive(method);
>>>        System.out.println(result);
>>> }
>>>
>>> 
>>>for some reason when I send this, both SOAP Monitor and network sniffer show that the actual data sent on the wire looks like this:
>>> 
>>><?xml version='1.0' encoding='utf-8'?>
>>><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";;>
>>>  <soapenv:Header />
>>>  <soapenv:Body>
>>>    <example1:echo xmlns:example1="http://example1.org/example1";;>
>>>      <example1:image>/9j/4AAQSkZJRgABAgAAAQABAAD/2w...</example1:image>
>>>    </example1:echo>
>>>  </soapenv:Body>
>>></soapenv:Envelope>
>>> 
>>>(I shortened the contents of the image element for brevity)
>>> 
>>>This is not what I expected and not what I want. Could some one please help figure out why multipart/related MIME message is not used in this case?
>>> 
>>>Thanks in advance
>>>Greg
>>>
>>>---------------------------------------------------------------------
>>>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

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



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFE6feJYmklbLuW6wYRAmLRAJ9OVpR24eGVpv6R5lKBg3RvD1S3AQCfX4/T
HkLgoJ16WMQE0xj8u0LBWvo=
=qUn2
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
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] to to send multipart/related message

Posted by Saminda Abeyruwan <sa...@opensource.lk>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

In very brief,

In infoset all binary content is replaced by base64 characters, if the
OMText asked to be optimized or if a DataHandler is given to it.

MTOM on the other hand is a wire optimization mechanism. Thus, to
achieve this you have to set the prior option to ServiceClient,
otherwise the SOAP payload will be serialized with base64.

Saminda

Greg Fichtenholtz wrote:
> Saminda,
> Thank you. This worked like a charm. 
>  
> Care to explain why I need to enable MTOM to get multipart/related content? I thought that I would get it regardless?
> Is this an Axis2 feature? 
>  
> Thanks in advance
> Greg
>  
> 
> ----- Original Message ----
> From: Saminda Abeyruwan <sa...@opensource.lk>
> To: axis-user@ws.apache.org
> Sent: Monday, August 21, 2006 3:07:14 AM
> Subject: Re: [Axis2] to to send multipart/related message
> 
> 
> Hi,
> 
> Please set
> 
> options.setProperty(Constants.Configuration.ENABLE_MTOM,
> Constants.VALUE_TRUE);
> 
> Thank you
> 
> Saminda
> 
> Greg Fichtenholtz wrote:
> 
>>>Hello,
>>>my goal is to send multipart/related message (SOAP envelope with attachments).
>>> 
>>>My client code looks like this:
>>> 
>>> public static void main(String[] args)
>>>  throws Exception
>>> {
>>>     EndpointReference targetEPR = new EndpointReference("http://localhost:8080/axis2/services/AttachService";);
>>>     Options options = new Options();
>>>        options.setTo(targetEPR);
>>>        options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
>>>  OMFactory factory = OMAbstractFactory.getOMFactory();
>>>        OMNamespace omNs = factory.createOMNamespace(
>>>                "http://example1.org/example1";, "example1");
>>>
>>>        OMElement method = factory.createOMElement("echo", omNs);
>>>        OMElement value = factory.createOMElement("image", omNs);
>>>  String inputImageFileName = "C:\\TEMP\\ALSB.jpl";
>>>        Image image = new ImageIO().loadImage(new FileInputStream(inputImageFileName));
>>>        ImageDataSource ds = new ImageDataSource("ALSB.jpl",image);
>>>        DataHandler dh = new DataHandler(ds);
>>>        OMText textData = factory.createOMText(dh, true);
>>>        value.addChild(textData);
>>>        method.addChild(value);
>>>
>>>        //Blocking invocation
>>>        ServiceClient sender = new ServiceClient();
>>>        sender.setOptions(options);
>>>        OMElement result = sender.sendReceive(method);
>>>        System.out.println(result);
>>> }
>>>
>>> 
>>>for some reason when I send this, both SOAP Monitor and network sniffer show that the actual data sent on the wire looks like this:
>>> 
>>><?xml version='1.0' encoding='utf-8'?>
>>><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
>>>  <soapenv:Header />
>>>  <soapenv:Body>
>>>    <example1:echo xmlns:example1="http://example1.org/example1";>
>>>      <example1:image>/9j/4AAQSkZJRgABAgAAAQABAAD/2w...</example1:image>
>>>    </example1:echo>
>>>  </soapenv:Body>
>>></soapenv:Envelope>
>>> 
>>>(I shortened the contents of the image element for brevity)
>>> 
>>>This is not what I expected and not what I want. Could some one please help figure out why multipart/related MIME message is not used in this case?
>>> 
>>>Thanks in advance
>>>Greg
>>>
>>>---------------------------------------------------------------------
>>>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

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



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFE6feJYmklbLuW6wYRAmLRAJ9OVpR24eGVpv6R5lKBg3RvD1S3AQCfX4/T
HkLgoJ16WMQE0xj8u0LBWvo=
=qUn2
-----END PGP SIGNATURE-----

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


Re: [Axis2] to to send multipart/related message

Posted by Greg Fichtenholtz <gr...@yahoo.com>.
Saminda,
Thank you. This worked like a charm. 
 
Care to explain why I need to enable MTOM to get multipart/related content? I thought that I would get it regardless?
Is this an Axis2 feature? 
 
Thanks in advance
Greg
 

----- Original Message ----
From: Saminda Abeyruwan <sa...@opensource.lk>
To: axis-user@ws.apache.org
Sent: Monday, August 21, 2006 3:07:14 AM
Subject: Re: [Axis2] to to send multipart/related message


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Please set

options.setProperty(Constants.Configuration.ENABLE_MTOM,
Constants.VALUE_TRUE);

Thank you

Saminda

Greg Fichtenholtz wrote:
> Hello,
> my goal is to send multipart/related message (SOAP envelope with attachments).
>  
> My client code looks like this:
>  
>  public static void main(String[] args)
>   throws Exception
>  {
>      EndpointReference targetEPR = new EndpointReference("http://localhost:8080/axis2/services/AttachService";);
>      Options options = new Options();
>         options.setTo(targetEPR);
>         options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
>   OMFactory factory = OMAbstractFactory.getOMFactory();
>         OMNamespace omNs = factory.createOMNamespace(
>                 "http://example1.org/example1";, "example1");
> 
>         OMElement method = factory.createOMElement("echo", omNs);
>         OMElement value = factory.createOMElement("image", omNs);
>   String inputImageFileName = "C:\\TEMP\\ALSB.jpl";
>         Image image = new ImageIO().loadImage(new FileInputStream(inputImageFileName));
>         ImageDataSource ds = new ImageDataSource("ALSB.jpl",image);
>         DataHandler dh = new DataHandler(ds);
>         OMText textData = factory.createOMText(dh, true);
>         value.addChild(textData);
>         method.addChild(value);
> 
>         //Blocking invocation
>         ServiceClient sender = new ServiceClient();
>         sender.setOptions(options);
>         OMElement result = sender.sendReceive(method);
>         System.out.println(result);
>  }
> 
>  
> for some reason when I send this, both SOAP Monitor and network sniffer show that the actual data sent on the wire looks like this:
>  
> <?xml version='1.0' encoding='utf-8'?>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
>   <soapenv:Header />
>   <soapenv:Body>
>     <example1:echo xmlns:example1="http://example1.org/example1";>
>       <example1:image>/9j/4AAQSkZJRgABAgAAAQABAAD/2w...</example1:image>
>     </example1:echo>
>   </soapenv:Body>
> </soapenv:Envelope>
>  
> (I shortened the contents of the image element for brevity)
>  
> This is not what I expected and not what I want. Could some one please help figure out why multipart/related MIME message is not used in this case?
>  
> Thanks in advance
> Greg
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFE6YXSYmklbLuW6wYRAlGCAKC/R4cTleBiC3rAERJg/6Xlf3tlMQCeKfHy
2Gz6n/HFrFxGpGd+Ecnw2e4=
=rpoz
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
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] to to send multipart/related message

Posted by Saminda Abeyruwan <sa...@opensource.lk>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Please set

options.setProperty(Constants.Configuration.ENABLE_MTOM,
Constants.VALUE_TRUE);

Thank you

Saminda

Greg Fichtenholtz wrote:
> Hello,
> my goal is to send multipart/related message (SOAP envelope with attachments).
>  
> My client code looks like this:
>  
>  public static void main(String[] args)
>   throws Exception
>  {
>      EndpointReference targetEPR = new EndpointReference("http://localhost:8080/axis2/services/AttachService");
>      Options options = new Options();
>         options.setTo(targetEPR);
>         options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
>   OMFactory factory = OMAbstractFactory.getOMFactory();
>         OMNamespace omNs = factory.createOMNamespace(
>                 "http://example1.org/example1", "example1");
> 
>         OMElement method = factory.createOMElement("echo", omNs);
>         OMElement value = factory.createOMElement("image", omNs);
>   String inputImageFileName = "C:\\TEMP\\ALSB.jpl";
>         Image image = new ImageIO().loadImage(new FileInputStream(inputImageFileName));
>         ImageDataSource ds = new ImageDataSource("ALSB.jpl",image);
>         DataHandler dh = new DataHandler(ds);
>         OMText textData = factory.createOMText(dh, true);
>         value.addChild(textData);
>         method.addChild(value);
> 
>         //Blocking invocation
>         ServiceClient sender = new ServiceClient();
>         sender.setOptions(options);
>         OMElement result = sender.sendReceive(method);
>         System.out.println(result);
>  }
> 
>  
> for some reason when I send this, both SOAP Monitor and network sniffer show that the actual data sent on the wire looks like this:
>  
> <?xml version='1.0' encoding='utf-8'?>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
>   <soapenv:Header />
>   <soapenv:Body>
>     <example1:echo xmlns:example1="http://example1.org/example1">
>       <example1:image>/9j/4AAQSkZJRgABAgAAAQABAAD/2w...</example1:image>
>     </example1:echo>
>   </soapenv:Body>
> </soapenv:Envelope>
>  
> (I shortened the contents of the image element for brevity)
>  
> This is not what I expected and not what I want. Could some one please help figure out why multipart/related MIME message is not used in this case?
>  
> Thanks in advance
> Greg
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFE6YXSYmklbLuW6wYRAlGCAKC/R4cTleBiC3rAERJg/6Xlf3tlMQCeKfHy
2Gz6n/HFrFxGpGd+Ecnw2e4=
=rpoz
-----END PGP SIGNATURE-----

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