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

Need a way to preserve parameters wrapper in DocLiteralInInterceptor

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.2.8, 2.3
    • Component/s: Core
    • Labels:
      None

      Description

      In DocLiteralInInterceptor, the following condition determines whether the wrapper is preserved when unmarshalling the parameters.

                      if (msgInfo.getMessageParts().get(0).getTypeClass() != null) {
      

      Currently, the parameters that I will get depending on whether service class (TypeClass) is provided. It is questionable that the condition is suitable for all DataBindings. For example, my endpoint uses SourceDataBinding which does not require to specify service class. So, when service class is provided, I get one parameter that wraps multi parts.

      For example,

      <GetPerson>
        <personId>foo</personId>
        <ssn>1234</ssn>
      </GetPerson>
      

      Otherwise, I get 2 parameters (in the example)

      <personId>foo</personId>
      <ssn>1234</ssn>
      

      We should get consistent behavior regardless of whether service class is provided by users.

      Here is my proposal to add a property to override the built-in condition (as in the attached patch). Free feel to come up with a better fix if you see fit.

          protected boolean shouldWrapParameters(MessageInfo msgInfo, Message message) {
              Object keepParametersWrapperFlag = message.get(KEEP_PARAMETERS_WRAPPER);
              if (keepParametersWrapperFlag == null) {
                  return msgInfo.getMessageParts().get(0).getTypeClass() != null;
              } else {
                  return Boolean.parseBoolean(keepParametersWrapperFlag.toString());
              }
          }
      

        Attachments

        1. CXF-2753.patch
          10 kB
          William Tam

          Activity

            People

            • Assignee:
              njiang Willem Jiang
              Reporter:
              wtam William Tam
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: