You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Andreas Veithen (JIRA)" <ji...@apache.org> on 2011/08/05 17:28:27 UTC

[jira] [Commented] (AXIS2-5112) Unable to retrieve a document attached in a SOAP MTOM/XOP message sended by WSO2 library

    [ https://issues.apache.org/jira/browse/AXIS2-5112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13080017#comment-13080017 ] 

Andreas Veithen commented on AXIS2-5112:
----------------------------------------

As indicated by the error message, the client request doesn't conform to the XOP spec (which forms the basis of the MTOM spec). The problem is that the xop:Include element is surrounded by whitespace, while it shouldn't be. This is explicitly forbidden by the XOP spec. Apparently, the WSO2 library applies pretty-printing where it should not.

> Unable to retrieve a document attached in a SOAP MTOM/XOP message sended by WSO2 library
> ----------------------------------------------------------------------------------------
>
>                 Key: AXIS2-5112
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5112
>             Project: Axis2
>          Issue Type: Bug
>          Components: Integration, mtompolicy, transports
>    Affects Versions: 1.5.3, 1.5.4, 1.5.5, 1.6.0
>         Environment: Linux Ubuntu 9.04 / 9.10 / 10.04 / 10.10 (32bit)
>            Reporter: Alberto Bovo
>              Labels: mtom, web-service, wso, xop
>
> Using a axis2 Web Service, when trying to retrieve a document attached in a SOAP MTOM/XOP message builded using WSO2 php library get  this error:
> org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: Expected xop:Include as the sole child of an element information item (see section 3.2 of http://www.w3.org/TR/xop10/)
> This is due to the fact that the  element (<xdsb:Document id="Document01">   </xdsb:Document>)  (OMElement obtained after axis2 processing)  that should contains the base64 value of document, is empty. But observing the same message sniffed from wireshark (protocol analyzer) it seems that the Document is present.
> I am worried about which library is the guilty for this problem: "WSO2" or "axis2"?
> ######Sniffed Message from the network using WIRESHARK:
> POST /axis2/services/Repository HTTP/1.1
> User-Agent: Axis2/C
> Content-Length: 16132
> Content-Type: multipart/related; boundary=MIMEBoundary11a26594-bf65-1e01-28a8-000c29c7ee2b; type="application/xop+xml"; start="<0....@apache.org>"; start-info="application/soap+xml"; charset="UTF-8";action="urn:ihe:iti:2007:ProvideAndRegisterDocumentSet-b"
> Host: 192.168.1.13:9090
> --MIMEBoundary11a26594-bf65-1e01-28a8-000c29c7ee2b
> content-transfer-encoding: binary
> content-id: <0....@apache.org>
> content-type: application/xop+xml; charset=UTF-8; type="application/soap+xml";
> <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
>     <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
>         <wsa:To>http://192.168.1.13:9090/axis2/services/Repository</wsa:To>
>         <wsa:Action>urn:ihe:iti:2007:ProvideAndRegisterDocumentSet-b</wsa:Action>
>         <wsa:MessageID>11a188fe-bf65-1e01-28a6-000c29c7ee2b</wsa:MessageID>
>     </soapenv:Header>
>     <soapenv:Body>
>         <xdsb:ProvideAndRegisterDocumentSetRequest xmlns:xdsb="urn:ihe:iti:xds-b:2007">
>              <lcm:SubmitObjectsRequest ...........varius..xml........</lcm:SubmitObjectsRequest>
>             <xdsb:Document id="Document01">
>                 <xop:Include href="cid:1.11a262e2-bf65-1e01-28a7-000c29c7ee2b@apache.org" xmlns:xop="http://www.w3.org/2004/08/xop/include"/>
>             </xdsb:Document>
>         </xdsb:ProvideAndRegisterDocumentSetRequest>
>     </soapenv:Body>
> </soapenv:Envelope>
> --MIMEBoundary11a26594-bf65-1e01-28a8-000c29c7ee2b
> content-transfer-encoding: binary
> content-id: <1....@apache.org>
> content-type: application/octet-stream
> This is my document.
> It is great!
> --MIMEBoundary11a26594-bf65-1e01-28a8-000c29c7ee2b--
> ######OMElement retrieved inside the web-service axis2code:
> <xdsb:ProvideAndRegisterDocumentSetRequest xmlns:xdsb="urn:ihe:iti:xds-b:2007">
>      <lcm:SubmitObjectsRequest ...........varius..xml........</lcm:SubmitObjectsRequest>
>     <xdsb:Document id="Document01">
>     </xdsb:Document>
> </xdsb:ProvideAndRegisterDocumentSetRequest>
> I try to send (in SOAP MTOM/XOP) a similar message with another client using AXIS2 library and I retrieve CORRECTLY the document attached.
>  
> ######Sniffed Message from the network using WIRESHARK:
> POST /axis2/services/Repository HTTP/1.1
> Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_DE91A0BD9A7540ADAE1312549954960; type="application/xop+xml"; start="<0....@apache.org>"; start-info="application/soap+xml"; action="urn:ihe:iti:2007:ProvideAndRegisterDocumentSet-b"
> User-Agent: Axis2
> Host: 192.168.1.13:9090
> Transfer-Encoding: chunked
> 20f1
> --MIMEBoundaryurn_uuid_DE91A0BD9A7540ADAE1312549954960
> Content-Type: application/xop+xml; charset=UTF-8; type="application/soap+xml"
> Content-Transfer-Encoding: binary
> Content-ID: <0....@apache.org>
> <?xml version='1.0' encoding='UTF-8'?>
> <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
>     <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
>         <wsa:To soapenv:mustUnderstand="true">http://192.168.1.13:9090/axis2/services/Repository</wsa:To>
>         <wsa:MessageID soapenv:mustUnderstand="true">urn:uuid:DE91A0BD9A7540ADAE1312549954954</wsa:MessageID>
>         <wsa:Action soapenv:mustUnderstand="true">urn:ihe:iti:2007:ProvideAndRegisterDocumentSet-b</wsa:Action>
>     </soapenv:Header>
>     <soapenv:Body>
>         <xdsb:ProvideAndRegisterDocumentSetRequest xmlns:xdsb="urn:ihe:iti:xds-b:2007">
>              <lcm:SubmitObjectsRequest ...........varius..xml........</lcm:SubmitObjectsRequest>
>             <xdsb:Document id="Document01">
>                 <xop:Include href="cid:1.urn:uuid:DE91A0BD9A7540ADAE1312549954965@apache.org" xmlns:xop="http://www.w3.org/2004/08/xop/include" />
>             </xdsb:Document>
>         </xdsb:ProvideAndRegisterDocumentSetRequest>
>     </soapenv:Body>
> </soapenv:Envelope>
> 11c
> --MIMEBoundaryurn_uuid_DE91A0BD9A7540ADAE1312549954960
> Content-Type: text/plain
> Content-Transfer-Encoding: binary
> Content-ID: <1....@apache.org>
> This is my document.
> It is great!
> --MIMEBoundaryurn_uuid_DE91A0BD9A7540ADAE1312549954960--
> 0
> ######OMElement retrieved inside the web-service axis2code:
> <xdsb:ProvideAndRegisterDocumentSetRequest xmlns:xdsb="urn:ihe:iti:xds-b:2007">
>     <lcm:SubmitObjectsRequest ...........varius..xml........</lcm:SubmitObjectsRequest>
>     <xdsb:Document id="Document01">VGhpcyBpcyBteSBkb2N1bWVudC4KCkl0IGlzIGdyZWF0IQoK</xdsb:Document>
> </xdsb:ProvideAndRegisterDocumentSetRequest>
> This is the simple WSDL of the axis2 web service:
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:axis2="http://service/ws/xds/iti/a_thon/it/" xmlns:ns1="http://org.apache.axis2/xsd"
> xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
> xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
> xmlns:ns0="http://service/ws/xds/iti/a_thon/it/xsd"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
> xmlns:ihe="urn:ihe:iti:xds-b:2007"
> xmlns:rs="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0"
> xmlns:lcm="urn:oasis:names:tc:ebxml-regrep:xsd:lcm:3.0"
> xmlns:query="urn:oasis:names:tc:ebxml-regrep:xsd:query:3.0"
> name="DocumentRepository"
> targetNamespace="http://service/ws/xds/iti/a_thon/it/">
>     <wsdl:types>
>         <xs:schema xmlns:ns="http://service/ws/xds/iti/a_thon/it/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://service/ws/xds/iti/a_thon/it/xsd">
>             <xs:element name="ProvideAndRegisterDocumentSet" type="xs:string">
>             </xs:element>
>             <xs:element name="ProvideAndRegisterDocumentSetResponse" type="xs:string">
>             </xs:element>
>         </xs:schema>
>     </wsdl:types>
>     <wsdl:message name="ProvideAndRegisterDocumentSetRequest">
>         <wsdl:part name="parameters" element="ns0:ProvideAndRegisterDocumentSet"/>
>     </wsdl:message>
>     <wsdl:message name="ProvideAndRegisterDocumentSetResponse">
>         <wsdl:part name="parameters" element="ns0:ProvideAndRegisterDocumentSetResponse"/>
>     </wsdl:message>
>     <wsdl:portType name="RepositoryPortType">
>         <wsdl:operation name="ProvideAndRegisterDocumentSet">
>             <wsdl:input message="axis2:ProvideAndRegisterDocumentSetRequest" 
>             wsaw:Action="urn:ihe:iti:2007:ProvideAndRegisterDocumentSet-b"/>
>             <wsdl:output message="axis2:ProvideAndRegisterDocumentSetResponse" 
>             wsaw:Action="urn:ihe:iti:2007:ProvideAndRegisterDocumentSet-bResponse"/>
>         </wsdl:operation>
>     </wsdl:portType>
>     <wsdl:binding name="RepositorySOAP12Binding" type="axis2:RepositoryPortType">
>         <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
>         <wsdl:operation name="ProvideAndRegisterDocumentSet">
>             <soap12:operation soapAction="urn:ihe:iti:2007:ProvideAndRegisterDocumentSet-b" style="document"/>
>             <wsdl:input>
>                 <soap12:body use="literal"/>
>             </wsdl:input>
>             <wsdl:output>
>                 <soap12:body use="literal"/>
>             </wsdl:output>
>         </wsdl:operation>
>     </wsdl:binding>
>     <wsdl:service name="Repository">
>         <wsdl:port name="RepositorySOAP12port_http" binding="axis2:RepositorySOAP12Binding">
>             <soap12:address location="http://localhost:8080/axis2/services/Repository"/>
>         </wsdl:port>
>     </wsdl:service>
> </wsdl:definitions>
> axis2 Web Service Class
> public class WebService
>  {
>     public OMElement ProvideAndRegisterDocumentSet(OMElement request)
>     {
>         OMElement risp = null;
>         try
>         {
>         System.out.println("ProvideAndRegisterDocumentSet START --");
>         exploreRequest(request);
>         FileOutputStream out = new FileOutputStream(new File("/home/user/Scrivania/SERVER/requestafterAxis2.txt"));
>         request.serialize(out);
>         risp= request;
>         System.out.println("ProvideAndRegisterDocumentSet STOP --");
>         }
>         catch(Exception ex)
>         {
>             System.err.println("ERRROR!");
>             ex.printStackTrace();
>         }
>         return risp;
>     }
>     private void exploreRequest(OMElement request)
>     {
>         Iterator it = request.getChildElements();
>         while (it.hasNext())
>         {
>             OMNode node = (OMNode) it.next(); 
>             OMElement element;
>             OMText text;
>             if (node.getType() == OMNode.ELEMENT_NODE)
>             {
>                 //System.out.println("NODE ELEMENT");
>                 element = (OMElement) node;
>                 if (element.getLocalName().equals("Document"))
>                 {
>                     text = (OMText) element.getFirstOMChild();
>                     System.out.println("TEXT"+ text.getText());
>                     DataHandler actualDH;
>                     actualDH = (DataHandler) text.getDataHandler();
>                     /**
>                      * Recupera Documento
>                      */
>                     String contentType = actualDH.getContentType();
>                     System.out.println("contentType = " + contentType);
>                     BufferedInputStream bis = null;
>                     BufferedOutputStream bos = null;
>                     try
>                     {
>                         bis = new BufferedInputStream(actualDH.getInputStream());
>                         File file = new File("/home/user/Scrivania/SERVER/documento.pdf");
>                         FileOutputStream out = new FileOutputStream(file);
>                         actualDH.writeTo(out);
>                     } catch (final IOException ex) {
>                         System.out.println("IOException.");
>                         ex.printStackTrace();
>                         //throw e;
>                     }
>                 }                    
>                 exploreRequest(element);
>             }
>         }
>     }
> }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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