Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-1294

Problem creating several custom Headers

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.3
    • 2.0.4
    • None
    • None
    • Windows XP SP2, Eclipse 3.3, JAVA 1.6.03

    • Novice

    Description

      Hi all,
      we generated a Java WS Client from given wsdl-files, which should generate a SOAP Request with several Header entries.
      At runtime one of two headers was dropped in the request.

      Excerpt from generated Code:

      <code>
      public interface TelematikSignedPortType {

      @RequestWrapper(localName = "TelematikExecute", targetNamespace = "http://ws.gematik.de/tel/transport/v1.2", className = "de.gematik.ws.tel.transport.v1.TelematikExecuteType")
      @ResponseWrapper(localName = "TelematikExecuteResponse", targetNamespace = "http://ws.gematik.de/tel/transport/v1.2", className = "de.gematik.ws.tel.transport.v1.TelematikExecuteType")
      @WebMethod(operationName = "TelematikExecute", action = "http://ws.gematik.de/tel/transportWSDL/v1.4#telematikexecute")
      public void telematikExecute(
      @WebParam(targetNamespace = "http://ws.gematik.de/tel/transport/v1.2", name = "Payload", mode = Mode.INOUT)
      javax.xml.ws.Holder<de.gematik.ws.tel.transport.v1.TelematikExecuteType.Payload> payload,
      @WebParam(targetNamespace = "http://ws.gematik.de/tel/transport/v1.2", name = "TransportHeader", header = true, mode = Mode.INOUT)
      javax.xml.ws.Holder<de.gematik.ws.tel.transport.v1.TransportHeader> transportHeader,
      @WebParam(targetNamespace = "http://ws.gematik.de/tel/transport/v1.2", name = "TelematikHeader", header = true, mode = Mode.INOUT)
      javax.xml.ws.Holder<de.gematik.ws.tel.transport.v1.TelematikHeader> telematikHeader
      ) throws FaultMessage;
      }
      </code>

      This issue seems to be related to filling the AbstractMessageContainer with MessageParts. This is done several times in the case of headers, overwriting existing indices with the container's current size. As a result the WrapperMsgInfo in WrapperClassOutInterceptor.java gets corrupted index values, so that the first header is overwritten by the second one and so on.

      <code>
      for (MessagePartInfo p : messageInfo.getMessageParts()) {
      if (Boolean.TRUE.equals(p
      .getProperty(ReflectionServiceFactoryBean.HEADER))) {
      MessagePartInfo mpi = wrappedMsgInfo.getMessagePart(p
      .getName());

      // MPI HAS CORRUPTED INDEX!

      if (objs.hasValue(p))

      { newObjs.put(mpi, objs.get(p)); }

      }
      }
      </code>

      Suggested Hotfix AbstractMessageContainer.jaa
      <code>
      public void addMessagePart(MessagePartInfo part) {

      // KEEP EXISTING INDEX IF ANY

      if (messageParts.containsKey(part.getName()))

      { part.setIndex(messageParts.get(part.getName()).getIndex()); }

      else

      { part.setIndex(messageParts.size()); }

      messageParts.put(part.getName(), part);
      }
      </code>

      Thx for looking into this, keep up the good work.
      cheers,
      Timmeh and Simon.

      Attachments

        Activity

          People

            dkulp Daniel Kulp
            timmeh Tim
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: