RE: Sending binary data(not using MTOM) using DataHandler
wsdl:definitions xmlns:xsd=http://www.w3.org/2001/XMLSchema; name=XSD_base64Binary ... assume the element you are referencing in your xsd is type=xsd:base64Binary datatype xsd:element name=asNonNillableElementResponse xsd:complexType xsd:sequence xsd:element name=nonNillableElement type=xsd:base64Binary nillable=false minOccurs=1 maxOccurs=1 / /xsd:sequence /xsd:complexType /xsd:element ? Martin could you display your full wsdl __ Disclaimer and Confidentiality/Verzicht und Vertraulichkeitanmerkung / Note de déni et de confidentialité This message is confidential. If you should not be the intended receiver, then we ask politely to report. Each unauthorized forwarding or manufacturing of a copy is inadmissible. This message serves only for the exchange of information and has no legal binding effect. Due to the easy manipulation of emails we cannot take responsibility over the the contents. Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. From: sanjay.gu...@billwiseinc.com To: axis-user@ws.apache.org Date: Tue, 21 Apr 2009 12:18:16 -0700 Subject: Sending binary data(not using MTOM) using DataHandler Hi, I have written a service that returns DataHandler containing the binary data(pdf file). When I call that service by using the classes generated by wsdl2java I only get 12k of the binary data. I have seen as reference to 12K buffer wrap issue. I would appreciate if anybody can give me some pointers on how to resole this issue. BTW the service is written in grails and exposed using AXIS2 plugin and all other services(the one not dealing with binary data) work without any issue. Thanks Sanjay _ Windows Live™ Hotmail®:…more than just e-mail. http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_more_042009
RE: Sending binary data(not using MTOM) using DataHandler
Hi Martin, Thanks for your reponse. wsdl file is attached. Type is xs:base64Binary in the wsdl. The wsdl was auto generated by grails axis2 plugin. Thanks Sanjay From: Martin Gainty [mailto:mgai...@hotmail.com] Sent: Tuesday, April 21, 2009 1:22 PM To: axis-user@ws.apache.org Subject: RE: Sending binary data(not using MTOM) using DataHandler wsdl:definitions xmlns:xsd=http://www.w3.org/2001/XMLSchema; name=XSD_base64Binary ... assume the element you are referencing in your xsd is type=xsd:base64Binary datatype xsd:element name=asNonNillableElementResponse xsd:complexType xsd:sequence xsd:element name=nonNillableElement type=xsd:base64Binary nillable=false minOccurs=1 maxOccurs=1 / /xsd:sequence /xsd:complexType /xsd:element ? Martin could you display your full wsdl __ Disclaimer and Confidentiality/Verzicht und Vertraulichkeitanmerkung / Note de déni et de confidentialité This message is confidential. If you should not be the intended receiver, then we ask politely to report. Each unauthorized forwarding or manufacturing of a copy is inadmissible. This message serves only for the exchange of information and has no legal binding effect. Due to the easy manipulation of emails we cannot take responsibility over the the contents. Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. From: sanjay.gu...@billwiseinc.com To: axis-user@ws.apache.org Date: Tue, 21 Apr 2009 12:18:16 -0700 Subject: Sending binary data(not using MTOM) using DataHandler Hi, I have written a service that returns DataHandler containing the binary data(pdf file). When I call that service by using the classes generated by wsdl2java I only get 12k of the binary data. I have seen as reference to 12K buffer wrap issue. I would appreciate if anybody can give me some pointers on how to resole this issue. BTW the service is written in grails and exposed using AXIS2 plugin and all other services(the one not dealing with binary data) work without any issue. Thanks Sanjay Windows Live(tm) Hotmail®:...more than just e-mail. Check it out.http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_more_042009 invoice.wsdl Description: invoice.wsdl
RE: Sending binary data(not using MTOM) using DataHandler
org.apache.ws.axis2.GetInvoiceImageResponse.java: public static GetInvoiceImageResponse parse(javax.xml.stream.XMLStreamReader reader) } else if(reader.hasText()) { //Do the usual conversion java.lang.String content = reader.getText(); object.set_return( org.apache.axis2.databinding.utils.ConverterUtil.convertToBase64Binary(content)); reader.next(); } } which calls org.apache.axis2.databinding.utils.ConverterUtil public static javax.activation.DataHandler convertToBase64Binary(String s) { // reusing the byteArrayDataSource from the Axiom classes ByteArrayDataSource byteArrayDataSource = new ByteArrayDataSource( Base64.decode(s) ); return new DataHandler(byteArrayDataSource); } which calls org.apache.axiom.om.util.Base64.java public static byte[] decode(String data) { char[] ibuf = new char[4]; int ibufcount = 0; byte[] obuf = new byte[data.length() / 4 * 3 + 3]; int obufcount = 0; for (int i = 0; i data.length(); i++) { char ch = data.charAt(i); if (ch == S_BASE64PAD || ch S_DECODETABLE.length S_DECODETABLE[ch] != Byte.MAX_VALUE) { ibuf[ibufcount++] = ch; if (ibufcount == ibuf.length) { ibufcount = 0; obufcount += decode0(ibuf, obuf, obufcount); } } } if (obufcount == obuf.length) return obuf; byte[] ret = new byte[obufcount]; System.arraycopy(obuf, 0, ret, 0, obufcount); return ret; } looks as if convertToBase64Binary call to Base64.decode byte[] obuf = new byte[data.length() / 4 * 3 + 3]; is dividing the data length by 15 what is the expected processing Base64.decode for Base64Binary input ? Martin Gainty __ Disclaimer and Confidentiality/Verzicht und Vertraulichkeitanmerkung / Note de déni et de confidentialité This message is confidential. If you should not be the intended receiver, then we ask politely to report. Each unauthorized forwarding or manufacturing of a copy is inadmissible. This message serves only for the exchange of information and has no legal binding effect. Due to the easy manipulation of emails we cannot take responsibility over the the contents. Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. From: mgai...@hotmail.com To: axis-user@ws.apache.org Subject: RE: Sending binary data(not using MTOM) using DataHandler Date: Tue, 21 Apr 2009 16:21:49 -0400 wsdl:definitions xmlns:xsd=http://www.w3.org/2001/XMLSchema; name=XSD_base64Binary ... assume the element you are referencing in your xsd is type=xsd:base64Binary datatype xsd:element name=asNonNillableElementResponse xsd:complexType xsd:sequence xsd:element name=nonNillableElement type=xsd:base64Binary nillable=false minOccurs=1 maxOccurs=1 / /xsd:sequence /xsd:complexType /xsd:element ? Martin could you display your full wsdl __ Disclaimer and Confidentiality/Verzicht und Vertraulichkeitanmerkung / Note de déni et de confidentialité This message is confidential. If you should not be the intended receiver, then we ask politely to report. Each unauthorized forwarding or manufacturing of a copy is inadmissible. This message serves only for the exchange of information and has no legal binding effect. Due to the easy manipulation of emails we cannot take
RE: Sending binary data(not using MTOM) using DataHandler
Hi Martin, I am not sure about question but during debugging I noted that reader.getText() only gives 16211 bytes which possibly gets translated into 12188 binary bytes. I don't understand this code well. Don't you think that reader.getText() call should gives all bytes. I did check the size inside my server side code just before the return and size is proper. Thanks Sanjay From: Martin Gainty [mailto:mgai...@hotmail.com] Sent: Tuesday, April 21, 2009 7:06 PM To: axis-user@ws.apache.org Subject: RE: Sending binary data(not using MTOM) using DataHandler org.apache.ws.axis2.GetInvoiceImageResponse.java: public static GetInvoiceImageResponse parse(javax.xml.stream.XMLStreamReader reader) } else if(reader.hasText()) { //Do the usual conversion java.lang.String content = reader.getText(); object.set_return( org.apache.axis2.databinding.utils.ConverterUtil.convertToBase64Binary(content)); reader.next(); } } which calls org.apache.axis2.databinding.utils.ConverterUtil public static javax.activation.DataHandler convertToBase64Binary(String s) { // reusing the byteArrayDataSource from the Axiom classes ByteArrayDataSource byteArrayDataSource = new ByteArrayDataSource( Base64.decode(s) ); return new DataHandler(byteArrayDataSource); } which calls org.apache.axiom.om.util.Base64.java public static byte[] decode(String data) { char[] ibuf = new char[4]; int ibufcount = 0; byte[] obuf = new byte[data.length() / 4 * 3 + 3]; int obufcount = 0; for (int i = 0; i data.length(); i++) { char ch = data.charAt(i); if (ch == S_BASE64PAD || ch S_DECODETABLE.length S_DECODETABLE[ch] != Byte.MAX_VALUE) { ibuf[ibufcount++] = ch; if (ibufcount == ibuf.length) { ibufcount = 0; obufcount += decode0(ibuf, obuf, obufcount); } } } if (obufcount == obuf.length) return obuf; byte[] ret = new byte[obufcount]; System.arraycopy(obuf, 0, ret, 0, obufcount); return ret; } looks as if convertToBase64Binary call to Base64.decode byte[] obuf = new byte[data.length() / 4 * 3 + 3]; is dividing the data length by 15 what is the expected processing Base64.decode for Base64Binary input ? Martin Gainty __ Disclaimer and Confidentiality/Verzicht und Vertraulichkeitanmerkung / Note de déni et de confidentialité This message is confidential. If you should not be the intended receiver, then we ask politely to report. Each unauthorized forwarding or manufacturing of a copy is inadmissible. This message serves only for the exchange of information and has no legal binding effect. Due to the easy manipulation of emails we cannot take responsibility over the the contents. Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. From: mgai...@hotmail.com To: axis-user@ws.apache.org Subject: RE: Sending binary data(not using MTOM) using DataHandler Date: Tue, 21 Apr 2009 16:21:49 -0400 wsdl:definitions xmlns:xsd=http://www.w3.org/2001/XMLSchema; name=XSD_base64Binary ... assume the element you are referencing in your xsd is type=xsd:base64Binary datatype xsd:element name=asNonNillableElementResponse xsd:complexType xsd:sequence xsd:element name=nonNillableElement type=xsd:base64Binary nillable=false minOccurs=1 maxOccurs=1 / /xsd:sequence /xsd:complexType /xsd:element ? Martin could you display your full wsdl