axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Veithen (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (AXIS2-4684) Unable to write OutputStream from the bainary node
Date Tue, 20 Apr 2010 18:19:50 GMT

     [ https://issues.apache.org/jira/browse/AXIS2-4684?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Andreas Veithen resolved AXIS2-4684.
------------------------------------

    Resolution: Invalid

Your code calls toString on the InputStream retrieved from the DataSource. Since nothing in
the Java specs requires an InputStream to override toString, it is normal that you get org.apache.axiom.attachments.utils.BAAInputStream@1c05ffd.

> Unable to write OutputStream from the bainary node
> --------------------------------------------------
>
>                 Key: AXIS2-4684
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4684
>             Project: Axis2
>          Issue Type: Test
>          Components: om
>    Affects Versions: 1.4.1
>         Environment: Windows
>            Reporter: Satyanarayana Murthy Godavarti
>             Fix For: 1.4.1
>
>
> I am having an issue writing the code from the binary node to the output Stream. The
server is sending the binary attachment. The receiver (in this case Axis2 client) is unable
to extract the content from the binary node to OutputStream. Here is the detailed information.
I am using Axis2 1.4.1 version.
> Server is sending the following binary data to Axi2 client
> 			soapPart.append("<mtom:AttachmentRequest xmlns:mtom=\"http://ws.apache.org/axis2/mtomsample/\">");
> 			soapPart.append("<mtom:fileName></mtom:fileName>");
> 			soapPart.append("<mtom:binaryData xmlns:xm=\"http://www.w3.org/2005/05/xmlmime\"
xm:contentType=\"application/?\">");
> 			soapPart.append("<xop:Include href=\"cid:1.urn:uuid:3DCB4A1548F7A276D21211131302838@apache.org\"
xmlns:xop=					             \"http://www.w3.org/2004/08/xop/include\"></xop:Include>");
> 			soapPart.append("</mtom:binaryData>");
> 			soapPart.append("</mtom:AttachmentRequest>");
> 			soapPart.append("</soapenv:Body>");
> 			soapPart.append("</soapenv:Envelope>");
> 			XQPart part0 = XQmsg.createPart(soapPart.toString(), "application/xop+xml");
> 			part0.setContentId("<0.urn:uuid:4DCB4A1548F7A276D21211131302838@apache.org>");
> 			XQPart part1 = XQmsg.createPart(binaryoutputStream.toByteArray(), "application/octet-stream");
> 			part1.setContentId("<1.urn:uuid:3DCB4A1548F7A276D21211131302838@apache.org>");
> 			XQmsg.setHeaderValue("JMS_SonicMQ_XQ.setContentType", "multipart/related; type=\"application/xop+xml\"");
> 			XQmsg.setHeaderValue("Content-Length", binaryoutputStream.toByteArray().length+soapPart.toString().length()+1000);
> 			XQmsg.addPartAt(part0, 0);
> 			XQmsg.addPartAt(part1, 1);
> Axis2 client is receiving the following response
> <ns1:StandardOutput xmlns:ns1="http://www.siemens.com/energy/soups/schemas/common#"
xmlns="http://www.siemens.com/energy/soups/schemas/common#"><ns1:EventLog><ns1:bscName>null</ns1:bscName><ns1:creationTime>2010-04-15T14:46:25.195-05:00</ns1:creationTime><ns1:detailedMessageText><mtom:AttachmentRequest
xmlns:mtom="http://ws.apache.org/axis2/mtomsample/"><mtom:fileName></mtom:fileName><mtom:binaryData
xmlns:xm="http://www.w3.org/2005/05/xmlmime" xm:contentType="application/?">H4sIAAAAAAAAAOWXbW+bMBDHv0rVvXZs4+fIQwLbaJPatWq6ado7mngtUoAOQ9Oq2nefSfpE92bS3iUSAu58/Hx3fzgJfdKWq6Lt/LIM/dF9qOZheePr8qRdln3VNh+Pb/r+dg7hZrOZhcrXvgmzZVtD3/ju+gGGdrgNcPdMgG9hZ/YrvMMfjt75ZvdhdXx0X6+bMK//m/5MiolPWBsya7trmCCE4ffTk8WWAKom9GWz9MepzjpfjjwzdHc+1dHf9ZdV7dMEYQQQBZhfYjpHKB4/NHxd1308L3p/mxKOkIYvpl7HtE7bVfWz8qsXDFKXGM0Zn9MRMwnRrum7h0Vf9kPYZjBes/Pzi7Nvzm633C7ASdhz/WP+qR4r2N3VF58tTh8RYRYTkgGUcQkoKRTIM5QAJwujuLUuN+K3hrtovRiuTBvp7XoH+dSGfuJ4ohZYFo6RHGDDKKAFkSBTmQIFzXDBrMixKV6p8C8MfL8RfE0cTisae3zeVk0/tsT/GnyU68tQX/kuxbEnU4++K9eDxylmlGj4ZGj4lgHfCb2vuisiXY4VQAwJQCm3QOaJAwnLiTJIMKzwHupOFTts3SWTXCiVAINc/N4zjoDC8TUgIpec2NxyRfZQd5Tww9Y9k4YLJjDg0mJAOc+BslZGUwiHlMEO2T3UXaEDn/O2yIxBcbozmVhAcZQ8c8wBkSSFFDzLea72T3cpD1x2JxNiElcA5ew45oUAOSFx6uPEGWsEtdztn+yY/fOYn/wbpH8A6NklxdUMAAA=</mtom:binaryData></mtom:AttachmentRequest></ns1:detailedMessageText><ns1:id>NA</ns1:id><ns1:messageName>requestLoadForecast</ns1:messageName><ns1:messageText>SUCCESS</ns1:messageText><ns1:resultCode>0</ns1:resultCode><ns1:serviceName>requestLoadForecast</ns1:serviceName><ns1:severity>NA</ns1:severity></ns1:EventLog></ns1:StandardOutput>
> Axis2 client to read the binary node and writing to the OutputStream
> OMElement dataElement = res.getFirstElement();
> OMNode node = dataElement.getNextOMSibling();
> if(node instanceof OMText){}
> Else
> {
> 	OMElement binNode =(OMElement) dataElement.getNextOMSibling();
> 	OMText bin = (OMText)binNode.getFirstOMChild();
> 											
> 	if(bin.isBinary())
> 	{
> 		InputStream stream = (InputStream)dataHandler.getDataSource().getInputStream();
> 		ByteArrayInputStream bis1=new ByteArrayInputStream(stream.toString().getBytes());
> 		ByteArrayOutputStream baaout = new ByteArrayOutputStream();
> 		int i=0;
> 		while((i = bis1.read()) != -1)
> 		{
> 			baaout.write(i);
> 			System.out.print((byte)i);
> 		}
> 							
> 		String xml = new String(baaout.toByteArray());
> 		System.out.println("Client XML is :"+xml.toString());		
> 	}
> }
> Output is 
> Client XML is :org.apache.axiom.attachments.utils.BAAInputStream@1c05ffd

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


Mime
View raw message