Return-Path: Delivered-To: apmail-ws-axis-user-archive@www.apache.org Received: (qmail 35030 invoked from network); 20 Nov 2006 17:34:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Nov 2006 17:34:06 -0000 Received: (qmail 89161 invoked by uid 500); 20 Nov 2006 17:33:54 -0000 Delivered-To: apmail-ws-axis-user-archive@ws.apache.org Received: (qmail 89140 invoked by uid 500); 20 Nov 2006 17:33:54 -0000 Mailing-List: contact axis-user-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-user@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-user@ws.apache.org Received: (qmail 89102 invoked by uid 99); 20 Nov 2006 17:33:54 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Nov 2006 09:33:54 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of csethil@gmail.com designates 64.233.182.184 as permitted sender) Received: from [64.233.182.184] (HELO nf-out-0910.google.com) (64.233.182.184) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Nov 2006 09:33:40 -0800 Received: by nf-out-0910.google.com with SMTP id o63so2282499nfa for ; Mon, 20 Nov 2006 09:33:18 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Nod2oYhVU3zrAe9HI5W/RAy3DWe5IxKaI8lJTn74w7Fo8j8oDMMcRGBaMM/4+YqKcoJd/f3dHdwSvG1yNyQJ6Osqi/SaJipvnOgG3EqDIMjTV7Azleu7rbjSG3JBYColTH2UbEmXJqKjrQ2EO0wKjxk7D1lBwvmqNosw0dyc23U= Received: by 10.48.1.20 with SMTP id 20mr3203259nfa.1164043996608; Mon, 20 Nov 2006 09:33:16 -0800 (PST) Received: by 10.49.67.16 with HTTP; Mon, 20 Nov 2006 09:33:16 -0800 (PST) Message-ID: Date: Mon, 20 Nov 2006 23:33:16 +0600 From: "Thilina Gunarathne" To: axis-user@ws.apache.org Subject: Re: Problem with attachments and Asix2/1.1 In-Reply-To: <4560FAF9.9030203@integraas.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4560FAF9.9030203@integraas.com> X-Virus-Checked: Checked by ClamAV on apache.org Hi Sean, I do not understand your use case.. We normally use MTOM or SwA to avoid the overhead of base64 conversion and to avoid the bloating of data by base64 conversion. They are the mechanisms introduced in order to enable the sending of raw binary data with SOAP. In the case of MTOM/SwA attachments will contain whatever the bytes(binary) you provided as it is. In the MTOM case you need to enableMTOM[1] in order for your binary data to be transferred as an Attachment. I personally recommend the use of MTOM for transferring binary data, unless you are communicating with an legacy server or client. If you really really need is to send binary as *base64* then the best way is to send them in line inside the elements. See here [2] for more info.. ~Thilina [1] http://www.wso2.net/kb/264 [2] http://ws.apache.org/axis2/1_1/mtom-guide.html On 11/20/06, Sean McCarthy wrote: > Hi All, > > I'm trying to create a client for a web service, and I'm having problems > with attachments. > > First, I don't have the wsdl for the service, but the XSD, so I am > creating the WS client from scratch using the OM api. > > I couldn't figure out how MTOM API exactly works from. What I am > supposed to get, is something like: > > --------------------------------------------------------------------------- > POST /soap/SOAPSERVICE HTTP/1.1 > Content-Type: multipart/related; boundary="SOAPTestBoundary" > Host: 192.168.1.40:10100 > Content-Length: 3311 > > --SOAPTestBoundary > Content-Type: text/xml > > xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"> > > > HEADER elements go here > > > > > Body elements go here > > > > > --SOAPTestBoundary > Content-Type: image/gif > Content-Transfer-Encoding: base64 > Content-Id: image.gif > > R0lGODlh (encoded base64 data goes on) > --SOAPTestBoundary-- > --------------------------------- > --------------------------------------------------------------------------- > > But what I get is: > --------------------------------------------------------------------------- > POST /soap/SOAPSERVICE HTTP/1.1 > SOAPAction: "urn:anonOutInOp" > User-Agent: Axis2 > Host: 192.168.1.40:10100 > Content-Length: 2870 > Content-Type: multipart/related; > boundary=MIMEBoundaryurn_uuid_BC683E392CA0BE689211639827237863; > type="text/xml"; > start="<0.urn:uuid:BC683E392CA0BE689211639827237864@apache.org>"; > charset=UTF-8 > > --MIMEBoundaryurn_uuid_BC683E392CA0BE689211639827236611 > content-type: text/xml; charset=UTF-8 > content-transfer-encoding: 8bit > content-id: <0.urn:uuid:BC683E392CA0BE689211639827236612@apache.org> > > > > > > Header Stuff > > > > > Body stuff > > > > --MIMEBoundaryurn_uuid_BC683E392CA0BE689211639827236611 > content-type: image/gif > content-transfer-encoding: binary > content-id: > > GIF89ad (raw data goes on) > --MIMEBoundaryurn_uuid_BC683E392CA0BE689211639827236611-- > --------------------------------- > --------------------------------------------------------------------------- > > What I can't figure out is how do I encode the attachment in base64. If > I enable MTOM it attaches the content as a BASE64 BUT inside the > element. And if I just do SwA I get the raw binary. > > Following the tutorial: > > MessageContext context = new MessageContext(); > > FileDataSource fileDS = new FileDataSource("tests/data/image.gif"); > DataHandler handler = new DataHandler("image.gif", fileDS); > > // Create Envelope > SOAPFactory factory = OMAbstractFactory.getSOAP11Factory(); > SOAPEnvelope env = factory.getDefaultEnvelope(); > env.getHeader().addChild(vodHeader); > env.getBody().addChild(vodBody) > > // ADD Attachment > context.addAttachment("image.gif", handler); > > But i get: > > content-type: image/gif > content-transfer-encoding: binary > content-id: > > Is there any way to tell the DataHandler or Axis to encode before > attaching or should I supply the base64 encoded data? And if I do supply > the encoded data, how do I supply the content-type? > > > Thanks, > > Sean C. McCarthy > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org > For additional commands, e-mail: axis-user-help@ws.apache.org > > > -- http://webservices.apache.org/~thilina/ http://thilinag.blogspot.com/ --------------------------------------------------------------------- To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org For additional commands, e-mail: axis-user-help@ws.apache.org