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

only the first child is copied in header element

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Duplicate
    • 1.6.0
    • None
    • adb, kernel
    • None
    • Linux 2.6.35.14-95.fc14.i686.PAE
      Java(TM) SE Runtime Environment (build 1.6.0_23-b05)

    Description

      In my wsdl I've the following message:

      <wsdl:operation name="Security_Authenticate">
      <soap:operation soapAction="http://xxxxxxxxxxxxxxxxxxx"/>
      <wsdl:input>
      <soap:header message="aws:Session" part="Session" use="literal"/>
      <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
      <soap:header message="aws:Session" part="Session" use="literal"/>
      <soap:body use="literal"/>
      </wsdl:output>
      </wsdl:operation>

      The Session type used in the header is defined as follow:

      <xs:element name="Session">
      <xs:complexType>
      <xs:sequence>
      <xs:element name="SessionId" type="xs:string">
      <xs:annotation>
      <xs:documentation>This element defines the identifier part of the SessionId.</xs:documentation>
      </xs:annotation>
      </xs:element>
      <xs:element name="SequenceNumber" type="xs:string">
      <xs:annotation>
      <xs:documentation>This element defines the sequence number of the SessionId.</xs:documentation>
      </xs:annotation>
      </xs:element>
      <xs:element name="SecurityToken" type="xs:string">
      <xs:annotation>
      <xs:documentation>This element defines the SecurityToken of the SessionId.</xs:documentation>
      </xs:annotation>
      </xs:element>
      </xs:sequence>
      </xs:complexType>
      </xs:element>

      I'm using adb binding.

      The actual soap message generated is
      <?xml version='1.0' encoding='UTF-8'?>
      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
      <soapenv:Header>
      <ns1:Session xmlns:ns1="http://xxxxxxxxxxxxx.xsd" soapenv:mustUnderstand="0">
      <ns1:SessionId>xxxxx</ns1:SessionId>
      </ns1:Session>
      </soapenv:Header>
      <soapenv:Body>
      <ns38:Security_Authenticate xmlns:ns38="........

      The Session element in the header is wrong because are missing two childs SequenceNumber and SecurityToken

      I had a look on the sources for axis2 and axiom and, in my opinion, the problem is in the method org.apache.axis2.client.Stub.addHeader()

      protected void addHeader(OMElement omElementToadd,
      SOAPEnvelope envelop,
      boolean mustUnderstand){
      SOAPHeaderBlock soapHeaderBlock =
      envelop.getHeader().addHeaderBlock(omElementToadd.getLocalName(),omElementToadd.getNamespace());
      soapHeaderBlock.setMustUnderstand(mustUnderstand);
      OMNode omNode = null;

      // add child elements
      for (Iterator iter = omElementToadd.getChildren(); iter.hasNext()

      { omNode = (OMNode) iter.next(); soapHeaderBlock.addChild(omNode.cloneOMElement()); /** PROBLEM HERE soapHeaderBlock.addChild changes the parent of omNode which is the current element of iter when iter.hasNext() is executed it use the parent of its current element to find the next one but the current element parent is changed (the parent is soapHeaderBlock instead of omElementToadd) PS: if you use axiom-1.2.12 you got a ConcurrentModificationException in the above code!!!! **/ }

      OMAttribute omatribute = null;
      // add attributes
      for (Iterator iter = omElementToadd.getAllAttributes(); iter.hasNext()

      { omatribute = (OMAttribute) iter.next(); soapHeaderBlock.addAttribute(omatribute); }

      }

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              marcoben73 Marco Benuzzi
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: