axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kent Tong (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AXIS2-755) base64Binary is not encoded
Date Sat, 20 May 2006 11:48:30 GMT
    [ http://issues.apache.org/jira/browse/AXIS2-755?page=comments#action_12412636 ] 

Kent Tong commented on AXIS2-755:
---------------------------------

Sorry, the title should be " base64Binary is not decoded".

In addition, I'm NOT using MTOM.

> base64Binary is not encoded
> ---------------------------
>
>          Key: AXIS2-755
>          URL: http://issues.apache.org/jira/browse/AXIS2-755
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Bug

>   Components: databinding
>     Versions: 1.0
>     Reporter: Kent Tong
>  Attachments: FileService2.wsdl
>
> In my WSDL (as attached), I have a message element of type base64Binary like:
> 			<xsd:element name="uploadRequest">
> 				<xsd:complexType>
> 					<xsd:sequence>
> 						<xsd:element name="id" type="xsd:string" />
> 						<xsd:element name="file" type="xsd:base64Binary">
> 						</xsd:element>
> 					</xsd:sequence>
> 				</xsd:complexType>
> 			</xsd:element>
> When the client sends a file to the service, what the service gets is the base64 encoded
representation of the bytes, not the bytes themselves:
> 	public void upload(com.foo.schema.UploadRequest req) throws IOException {
> 		InputStream in = req.getFile().getDataSource().getInputStream(); //this is the encoded
string, not bytes
> 		...
>  	}
> In the generated UploadRequest.java, the factory's parse() method is like:
> 		if (reader.isStartElement() && new javax.xml.namespace.QName("", "file").equals(reader.getName()))
{
> 			java.lang.String content = getElementTextProperly(reader);
> 			object.setFile(org.apache.axis2.databinding.utils.ConverterUtil.convertTobase64Binary(content));
> 			...
> 		}
> The convertTobase64Binary() should decode the string, but it doesn't:
>     public static javax.activation.DataHandler convertTobase64Binary(String s) throws
Exception{
>         // reusing the byteArrayDataSource from the Axiom classes
>         ByteArrayDataSource byteArrayDataSource = new ByteArrayDataSource(s.getBytes());
>         return new DataHandler(byteArrayDataSource);
>     }
> All it does is to convert the string to bytes using the system's default encoding which
is unlikely to be base64 (it may be ISO-8859-1, UTF-8, Big5, ...).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


Mime
View raw message