axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Kok <ste...@opensolutions.co.za>
Subject Re: [Axis2]Re: MTOM and content-type
Date Tue, 02 Jan 2007 12:07:03 GMT
Thilina

Thanks. This did work very well. The attachment is binary tough. Do I
need to manipulate options or the data handler to write the attachment
as base64 ?

Regards
Stefan


On Tue, 2007-01-02 at 14:43 +0530, Thilina Gunarathne wrote: 
> Try the following,
> >
> > org.apache.axiom.soap.SOAPFactory sf =
> > OMAbstractFactory.getSOAP11Factory();
> >
> > SOAPEnvelope env = sf.getDefaultEnvelope();
> > SOAPHeader sh = env.getHeader()
> > .
> > .
> > .
> > /* Content */
> > OMElement content = sf.createOMElement("Content", nms);
> > sbmtRequest.addChild(content);
> >
> > FileDataSource fileDataSource = new
> > FileDataSource("/home/stefan/workspace/test/bridge.jpg");
> >
> > DataHandler dh = new DataHandler(fileDataSource);
>        MessageContext mc = new MessageContext();
>        String contentType = mc.addAttachment(dh);
>       content.addAttribute("href",contentType,your namespace);
> > .
> > .
> > .
> > mepClient.execute(true);
> 
> ~Thilina
> 
> 
> > .
> > .
> > .
> >
> > This gives the in line result.
> >
> > Regards
> > Stefan
> >
> >
> > On Tue, 2007-01-02 at 13:47 +0530, Thilina Gunarathne wrote:
> > > Yes.. It is possible..Please see here [1].. You need to construct the
> > > soap envelope using OMElements...  This [2] might be usefull to figure
> > > out OMElements..
> > >
> > > Thilina
> > >
> > > [1] http://ws.apache.org/axis2/1_1/mtom-guide.html#3
> > > [2] http://ws.apache.org/commons/axiom/OMTutorial.html
> > >
> > > On 1/2/07, Stefan Kok <stefan@opensolutions.co.za> wrote:
> > > > Hi Thilina
> > > >
> > > > Thanks. Disabling MTOM and enabling SWA did work great.
> > > >
> > > > Please see the exert from EtherReal below. Note that the attachment is
> > > > placed in the <Content> as base64 string.
> > > >
> > > > .
> > > > .
> > > > .
> > > > <Content>/9j/4AAQSkZJRgABAgIAAAAAAAD/4QA
> > > > +RXhpZgAASUkqAAgAAAABAAsAAgAcAAAAGgAAAAAAAABBQ0QgU3lzdGVtcyBEaWdpdGFsIEltYWdpbmcA//4AHkFDRCBTeXN0ZW1zIERpZ2l0YWwgSW1hZ2luZwD/wAARCABkAJYDASIAAhEBAxEB/9sAhAAHBAUGBQQHBgUGBwcHCAoRCwoJCQoVDxAMERkWGhoYFhgYHB8oIhwdJh4YGCMvIyYpKi0tLRshMTQxKzQoLC0rAQsLCw8NDx4RER5AKyQrQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQED/xACdAAACAwEBAQAAAAAAAAAAAAAEBQIDBgcBABAAAgEDAgIGBgUHCAgHAAAAAQIDAAQRBSESMQYTIkFRYQcUMnGBkSNCodHwFTNSU3KxwSQ0NWJ0gpKzFkNUc4OTsuEXJTY3VaLSAQADAQEBAAAAAAAAAAAAAAABAgMABAURAAICAQQCAgMAAAAAAAAAAAABAhFBAxIhMRNRBCIUQnH/2gAMAwEAAhEDEQA/AOn9RZ6kzSzQoW8ScGk99ZyWUpeBg0Y7uLcUC011bDCzZA7vCqpNUdhiVQfOvRjBolKSGkWrRtGY7hTVUjw+1A7ZPcaTPMrNkAirIJyrDBqm0TcN4IpJj2VLHyotbCUbPE....
> > > > .
> > > > .
> > > > /9k=</Content>
> > > > </SubmitRequest>
> > > > </soapenv:Body>
> > > > </soapenv:Envelope>
> > > >
> > > > The server I am sending to, requires that I send it as <Content
> > > > href="cid:C9... /> Please see the sample below.  Is it possible with
> > > > SWA ?
> > > >
> > > >
> > > > <Content
> > > > href="cid:C9D026DAE628978D554A777553FD5B7A"allowAdaptations="true" />
> > > > </SubmitReq>
> > > > </env:Body>
> > > > </env:Envelope>
> > > >
> > > > Kind regards
> > > > Stefan.
> > > >
> > > >
> > > > On Sun, 2006-12-31 at 07:35 +0600, Thilina Gunarathne wrote:
> > > > > Stefan,
> > > > > Please use Soap with Attachments only.. Then it'll be text/xml..
> > > > > Make sure *not* to enable MTOM at the same time, cause then MTOM
will
> > > > > get priority and the message will be MTOM..
> > > > >
> > > > > See here [1] for more detials...
> > > > >
> > > > > Thilina
> > > > > [1] http://wso2.org/library/264
> > > > >
> > > > > On 12/29/06, Stefan Kok <stefan@opensolutions.co.za> wrote:
> > > > > > Hi All
> > > > > >
> > > > > > I have got axis2 to generate the following for me:
> > > > > >
> > > > > > POST /some HTTP/1.1
> > > > > > SOAPAction: ""
> > > > > > User-Agent: Axis2
> > > > > > Content-Length: 5790
> > > > > > Content-Type: multipart/related;
> > > > > > boundary=MIMEBoundaryurn_uuid_D71D1475B0136C8FED11673898742622;
> > > > > > type="application/xop+xml";
> > > > > > start="<0.urn:uuid:D71D1475B0136C8FED11673898742623@apache.org>";
> > > > > > start-info="text/xml"; charset=UTF-8
> > > > > > Authorization: Digest username="username", realm="somerealm",
> > > > > > nonce="RZTzxw==028733d3cb3ad64a414de383d252b679e8969982", uri="/some",
> > > > > > response="427csaasaawqwqee6be586508c8e91b4", qop=auth, nc=00000001,
> > > > > > cnonce="61849b59f21f00e0ac46d38f9be4f1b2", algorithm="MD5"
> > > > > > Host: fqdn:8082
> > > > > >
> > > > > > --MIMEBoundaryurn_uuid_D71D1475B0136C8FED11673898742622
> > > > > > content-type: application/xop+xml; charset=UTF-8; type="text/xml";
> > > > > > content-transfer-encoding: binary
> > > > > > content-id: <0.urn:uuid:D71D1475B0136C8FED11673898742623@apache.org>
> > > > > >
> > > > > > <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
> > > > > > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header><ns1:TransactionID
xmlns:ns1="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-2" ns1:mustUnderstand="1">MyTransaction</ns1:TransactionID></soapenv:Header><soapenv:Body><ns1:SubmitRequest
xmlns:ns1="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-2"><xop:Include
href="cid:1.urn:uuid:D71D1475B0136C8FED11673898742621@apache.org" xmlns:xop="http://www.w3.org/2004/08/xop/include"
/></ns1:SubmitRequest></soapenv:Body></soapenv:Envelope>
> > > > > > --MIMEBoundaryurn_uuid_D71D1475B0136C8FED11673898742622
> > > > > >
> > > > > > The server that I send this to, requires that the content-type
must be:
> > > > > >
> > > > > > text/xml; charset="utf-8"
> > > > > >
> > > > > > and not
> > > > > >
> > > > > > content-type: application/xop+xml; charset=UTF-8; type="text/xml";
> > > > > >
> > > > > > I have been searching the web for ideas but have not found much.
It must
> > > > > > be multipart/related so I cannot turn off MTOM.
> > > > > >
> > > > > >
> > > > > >
> > > > > > Kind regards
> > > > > > Stefan.
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > > > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > --
> > > > Stefan Kok <stefan@opensolutions.co.za>
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > >
> > > >
> > >
> > >
> > --
> > Stefan Kok <stefan@opensolutions.co.za>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
> 
> 
-- 
Stefan Kok <stefan@opensolutions.co.za>


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


Mime
View raw message