Re: [Axis2]Re: MTOM and content-type
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/4AAQSkZJRgABAgIAAAD/4QA +RXhpZgAASUkqAAgBAAsAAgAcGgBBQ0QgU3lzdGVtcyBEaWdpdGFsIEltYWdpbmcA//4AHkFDRCBTeXN0ZW1zIERpZ2l0YWwgSW1hZ2luZwD/wAARCABkAJYDASIAAhEBAxEB/9sAhAAHBAUGBQQHBgUGBwcHCAoRCwoJCQoVDxAMERkWGhoYFhgYHB8oIhwdJh4YGCMvIyYpKi0tLRshMTQxKzQoLC0rAQsLCw8NDx4RER5AKyQrQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQED/xACdAAACAwEBAQAEBQIDBgcBABAAAgEDAgIGBgUHCAgHAQIDAAQRBSESMQYTIkFRYQcUMnGBkSNCodHwFTNSU3KxwSQ0NWJ0gpKzFkNUc4OTsuEXJTY3VaLSAQADAQEBAAABAgMABAURAAICAQQCAgMBAhFBAxIhMRNRBCIUQnH/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:C9D026DAE628978D554A777553FD5B7AallowAdaptations=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=0001, 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:Headerns1:TransactionID xmlns:ns1=http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-2; ns1:mustUnderstand=1MyTransaction/ns1:TransactionID/soapenv:Headersoapenv:Bodyns1: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] -- Thilina Gunarathne WSO2, Inc.; http://www.wso2.com/ Home page: http://webservices.apache.org/~thilina/ Blog: http://thilinag.blogspot.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Axis2]Re: MTOM and content-type
Hi Thilina Thanks. I should have include some snippets of my code. Sorry. I am including snippets from my code for you now. I have got : 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); OMText textData = sf.createOMText(dh, false); textData.setOptimize(false); content.addChild(textData); . . . mepClient.execute(true); . . . 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/4AAQSkZJRgABAgIAAAD/4QA +RXhpZgAASUkqAAgBAAsAAgAcGgBBQ0QgU3lzdGVtcyBEaWdpdGFsIEltYWdpbmcA//4AHkFDRCBTeXN0ZW1zIERpZ2l0YWwgSW1hZ2luZwD/wAARCABkAJYDASIAAhEBAxEB/9sAhAAHBAUGBQQHBgUGBwcHCAoRCwoJCQoVDxAMERkWGhoYFhgYHB8oIhwdJh4YGCMvIyYpKi0tLRshMTQxKzQoLC0rAQsLCw8NDx4RER5AKyQrQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQED/xACdAAACAwEBAQAEBQIDBgcBABAAAgEDAgIGBgUHCAgHAQIDAAQRBSESMQYTIkFRYQcUMnGBkSNCodHwFTNSU3KxwSQ0NWJ0gpKzFkNUc4OTsuEXJTY3VaLSAQADAQEBAAABAgMABAURAAICAQQCAgMBAhFBAxIhMRNRBCIUQnH/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:C9D026DAE628978D554A777553FD5B7AallowAdaptations=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=0001, 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:Headerns1:TransactionID xmlns:ns1=http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-2; ns1:mustUnderstand=1MyTransaction/ns1:TransactionID/soapenv:Headersoapenv:Bodyns1: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,
Re: [Axis2]Re: MTOM and content-type
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 [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/4AAQSkZJRgABAgIAAAD/4QA +RXhpZgAASUkqAAgBAAsAAgAcGgBBQ0QgU3lzdGVtcyBEaWdpdGFsIEltYWdpbmcA//4AHkFDRCBTeXN0ZW1zIERpZ2l0YWwgSW1hZ2luZwD/wAARCABkAJYDASIAAhEBAxEB/9sAhAAHBAUGBQQHBgUGBwcHCAoRCwoJCQoVDxAMERkWGhoYFhgYHB8oIhwdJh4YGCMvIyYpKi0tLRshMTQxKzQoLC0rAQsLCw8NDx4RER5AKyQrQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQED/xACdAAACAwEBAQAEBQIDBgcBABAAAgEDAgIGBgUHCAgHAQIDAAQRBSESMQYTIkFRYQcUMnGBkSNCodHwFTNSU3KxwSQ0NWJ0gpKzFkNUc4OTsuEXJTY3VaLSAQADAQEBAAABAgMABAURAAICAQQCAgMBAhFBAxIhMRNRBCIUQnH/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:C9D026DAE628978D554A777553FD5B7AallowAdaptations=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=0001, 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:Headerns1:TransactionID xmlns:ns1=http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-2; ns1:mustUnderstand=1MyTransaction/ns1:TransactionID/soapenv:Headersoapenv:Bodyns1: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]
Re: [Axis2]Re: MTOM and content-type
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 [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/4AAQSkZJRgABAgIAAAD/4QA +RXhpZgAASUkqAAgBAAsAAgAcGgBBQ0QgU3lzdGVtcyBEaWdpdGFsIEltYWdpbmcA//4AHkFDRCBTeXN0ZW1zIERpZ2l0YWwgSW1hZ2luZwD/wAARCABkAJYDASIAAhEBAxEB/9sAhAAHBAUGBQQHBgUGBwcHCAoRCwoJCQoVDxAMERkWGhoYFhgYHB8oIhwdJh4YGCMvIyYpKi0tLRshMTQxKzQoLC0rAQsLCw8NDx4RER5AKyQrQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQED/xACdAAACAwEBAQAEBQIDBgcBABAAAgEDAgIGBgUHCAgHAQIDAAQRBSESMQYTIkFRYQcUMnGBkSNCodHwFTNSU3KxwSQ0NWJ0gpKzFkNUc4OTsuEXJTY3VaLSAQADAQEBAAABAgMABAURAAICAQQCAgMBAhFBAxIhMRNRBCIUQnH/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:C9D026DAE628978D554A777553FD5B7AallowAdaptations=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=0001, 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:Headerns1:TransactionID xmlns:ns1=http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-2; ns1:mustUnderstand=1MyTransaction/ns1:TransactionID/soapenv:Headersoapenv:Bodyns1: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
Re: [Axis2]Re: MTOM and content-type
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/4AAQSkZJRgABAgIAAAD/4QA +RXhpZgAASUkqAAgBAAsAAgAcGgBBQ0QgU3lzdGVtcyBEaWdpdGFsIEltYWdpbmcA//4AHkFDRCBTeXN0ZW1zIERpZ2l0YWwgSW1hZ2luZwD/wAARCABkAJYDASIAAhEBAxEB/9sAhAAHBAUGBQQHBgUGBwcHCAoRCwoJCQoVDxAMERkWGhoYFhgYHB8oIhwdJh4YGCMvIyYpKi0tLRshMTQxKzQoLC0rAQsLCw8NDx4RER5AKyQrQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQED/xACdAAACAwEBAQAEBQIDBgcBABAAAgEDAgIGBgUHCAgHAQIDAAQRBSESMQYTIkFRYQcUMnGBkSNCodHwFTNSU3KxwSQ0NWJ0gpKzFkNUc4OTsuEXJTY3VaLSAQADAQEBAAABAgMABAURAAICAQQCAgMBAhFBAxIhMRNRBCIUQnH/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:C9D026DAE628978D554A777553FD5B7AallowAdaptations=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=0001, 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]
Re: [Axis2]Re: MTOM and content-type
Stefan, The attachments by definition suppose to be Binary, cause only sending pure binary will bring the efficiencies of sending attachments.. If it needs to go as base64, I would advise you to send it in line inside the payload as you did earlier... If you really really needs your attachment to be base64, then you have to convert the Binary to base64 string in you client code.. You can use the Base64 encoder which comes with Axiom.. Then you need to create a DataHandler out of the resulting base64 string.. ~Thilina On 1/2/07, Stefan Kok [EMAIL PROTECTED] wrote: 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 [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/4AAQSkZJRgABAgIAAAD/4QA +RXhpZgAASUkqAAgBAAsAAgAcGgBBQ0QgU3lzdGVtcyBEaWdpdGFsIEltYWdpbmcA//4AHkFDRCBTeXN0ZW1zIERpZ2l0YWwgSW1hZ2luZwD/wAARCABkAJYDASIAAhEBAxEB/9sAhAAHBAUGBQQHBgUGBwcHCAoRCwoJCQoVDxAMERkWGhoYFhgYHB8oIhwdJh4YGCMvIyYpKi0tLRshMTQxKzQoLC0rAQsLCw8NDx4RER5AKyQrQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQED/xACdAAACAwEBAQAEBQIDBgcBABAAAgEDAgIGBgUHCAgHAQIDAAQRBSESMQYTIkFRYQcUMnGBkSNCodHwFTNSU3KxwSQ0NWJ0gpKzFkNUc4OTsuEXJTY3VaLSAQADAQEBAAABAgMABAURAAICAQQCAgMBAhFBAxIhMRNRBCIUQnH/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:C9D026DAE628978D554A777553FD5B7AallowAdaptations=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=0001, 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:Headerns1:TransactionID xmlns:ns1=http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-2;
Re: [Axis2]Re: MTOM and content-type
Thanks for all you help Thilina. Will give ii a go. Stefan On Wed, 2007-01-03 at 09:38 +0600, Thilina Gunarathne wrote: Stefan, The attachments by definition suppose to be Binary, cause only sending pure binary will bring the efficiencies of sending attachments.. If it needs to go as base64, I would advise you to send it in line inside the payload as you did earlier... If you really really needs your attachment to be base64, then you have to convert the Binary to base64 string in you client code.. You can use the Base64 encoder which comes with Axiom.. Then you need to create a DataHandler out of the resulting base64 string.. ~Thilina On 1/2/07, Stefan Kok [EMAIL PROTECTED] wrote: 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 [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/4AAQSkZJRgABAgIAAAD/4QA +RXhpZgAASUkqAAgBAAsAAgAcGgBBQ0QgU3lzdGVtcyBEaWdpdGFsIEltYWdpbmcA//4AHkFDRCBTeXN0ZW1zIERpZ2l0YWwgSW1hZ2luZwD/wAARCABkAJYDASIAAhEBAxEB/9sAhAAHBAUGBQQHBgUGBwcHCAoRCwoJCQoVDxAMERkWGhoYFhgYHB8oIhwdJh4YGCMvIyYpKi0tLRshMTQxKzQoLC0rAQsLCw8NDx4RER5AKyQrQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQED/xACdAAACAwEBAQAEBQIDBgcBABAAAgEDAgIGBgUHCAgHAQIDAAQRBSESMQYTIkFRYQcUMnGBkSNCodHwFTNSU3KxwSQ0NWJ0gpKzFkNUc4OTsuEXJTY3VaLSAQADAQEBAAABAgMABAURAAICAQQCAgMBAhFBAxIhMRNRBCIUQnH/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:C9D026DAE628978D554A777553FD5B7AallowAdaptations=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=0001, cnonce=61849b59f21f00e0ac46d38f9be4f1b2, algorithm=MD5 Host: fqdn:8082 --MIMEBoundaryurn_uuid_D71D1475B0136C8FED11673898742622 content-type:
Re: [Axis2]Re: MTOM and content-type
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/4AAQSkZJRgABAgIAAAD/4QA +RXhpZgAASUkqAAgBAAsAAgAcGgBBQ0QgU3lzdGVtcyBEaWdpdGFsIEltYWdpbmcA//4AHkFDRCBTeXN0ZW1zIERpZ2l0YWwgSW1hZ2luZwD/wAARCABkAJYDASIAAhEBAxEB/9sAhAAHBAUGBQQHBgUGBwcHCAoRCwoJCQoVDxAMERkWGhoYFhgYHB8oIhwdJh4YGCMvIyYpKi0tLRshMTQxKzQoLC0rAQsLCw8NDx4RER5AKyQrQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQED/xACdAAACAwEBAQAEBQIDBgcBABAAAgEDAgIGBgUHCAgHAQIDAAQRBSESMQYTIkFRYQcUMnGBkSNCodHwFTNSU3KxwSQ0NWJ0gpKzFkNUc4OTsuEXJTY3VaLSAQADAQEBAAABAgMABAURAAICAQQCAgMBAhFBAxIhMRNRBCIUQnH/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:C9D026DAE628978D554A777553FD5B7AallowAdaptations=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=0001, 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:Headerns1:TransactionID xmlns:ns1=http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-2; ns1:mustUnderstand=1MyTransaction/ns1:TransactionID/soapenv:Headersoapenv:Bodyns1: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]
[Axis2]Re: MTOM and content-type
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=0001, 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:Headerns1:TransactionID xmlns:ns1=http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-2; ns1:mustUnderstand=1MyTransaction/ns1:TransactionID/soapenv:Headersoapenv:Bodyns1: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] -- Thilina Gunarathne WSO2, Inc.; http://www.wso2.com/ Home page: http://webservices.apache.org/~thilina/ Blog: http://thilinag.blogspot.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]