-----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: [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
iD8DBQFE6YXSYmklbLuW6wYRAlGCAKC/R4cTleBiC3rAERJg/6Xlf3tlMQCeKfHy
2Gz6n/HFrFxGpGd+Ecnw2e4=
=rpoz
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]