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 <[EMAIL PROTECTED]> To: [email protected] 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 <[EMAIL PROTECTED]> > To: [email protected] > 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: [EMAIL PROTECTED] >>>For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> > > - --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -----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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
