Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-5112

Unable to retrieve a document attached in a SOAP MTOM/XOP message sended by WSO2 library

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not A Problem
    • Affects Version/s: 1.5.3, 1.5.4, 1.5.5, 1.6.0
    • Fix Version/s: None
    • Environment:
      Linux Ubuntu 9.04 / 9.10 / 10.04 / 10.10 (32bit)

      Description

      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.11a265da-bf65-1e01-28a9-000c29c7ee2b@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.11a265da-bf65-1e01-28a9-000c29c7ee2b@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.11a262e2-bf65-1e01-28a7-000c29c7ee2b@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.urn:uuid:DE91A0BD9A7540ADAE1312549954961@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.urn:uuid:DE91A0BD9A7540ADAE1312549954961@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.urn:uuid:DE91A0BD9A7540ADAE1312549954965@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);
        }
        }
        }
        }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              alberto13 Alberto Bovo
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: