>> >
>> > 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);

/**********/
Base64Binary base64Binary = new Base64Binary();
base64Binary.setBase64Binary(dh);
base64Binary.setContentType(dh.getContentType());

AttachmentType attachmentType = new AttachmentType();
attachmentType.setBinaryData(base64Binary);
attachmentType.setFileName(destination);
attachmentRequest.setAttachmentRequest(attachmentType);

sample.mtom.service.MTOMSampleStub.AttachmentResponse response = 
serviceStub.attachment(attachmentRequest);

MessageContext mc = new MessageContext();
String contentType = mc.addAttachment(dh);
//Not an href
//content.addAttribute("href",contentType,your namespace);

SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
//get the envelope
SOAPEnvelope env = fac.getDefaultEnvelope();

//get the namespace
OMNamespace omNs = fac.createOMNamespace(
    "http://service.soapwithattachments.sample/xsd";, "swa");

//create uploadFile element
OMElement uploadFile = fac.createOMElement("uploadFile", omNs);

//create name element
OMElement nameEle = fac.createOMElement("name", omNs);
nameEle.setText(destinationFile);

//create attachmentID element
OMElement idEle = fac.createOMElement("attchmentID", omNs);
idEle.setText(attachmentID);
  uploadFile.addChild(nameEle);
  uploadFile.addChild(idEle);
  env.getBody().addChild(uploadFile);
  mc.setEnvelope(env);
>> > .
>> > .
>> > .
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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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:[EMAIL PROTECTED]>";
>> > > > > > 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:[EMAIL PROTECTED]>
>> > > > > >
>> > > > > > <?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:[EMAIL PROTECTED]" 
>> > > > > > 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: [EMAIL PROTECTED]
>> > > > > > For additional commands, e-mail: [EMAIL PROTECTED]
>> > > > > >
>> > > > > >
>> > > > >
>> > > > >
>> > > > --
>> > > > Stefan Kok <[EMAIL PROTECTED]>
>> > > >
>> > > >
>> > > > ---------------------------------------------------------------------
>> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > > > For additional commands, e-mail: [EMAIL PROTECTED]
>> > > >
>> > > >
>> > >
>> > >
>> > --
>> > Stefan Kok <[EMAIL PROTECTED]>
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>> 
>> 
> -- 
> Stefan Kok <[EMAIL PROTECTED]>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

Reply via email to