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

IllegalArgumentException: argument type mismatch with code first RPC when parameter omitted

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.5.4
    • 3.4.10, 3.5.5, 4.0.0, 3.6.0
    • Soap Binding
    • None
    • Unknown

    Description

      When migrating legacy code-first RPC Web application from Axis to CXF, I found an issue with SOAP binding. CXF is passing MessageContentsList.REMOVED_MARKER instead of absent parameter producing "argument type mismatch while invoking ... with params ... java.lang.Object" response faultstring and "java.lang.IllegalArgumentException: argument type mismatch" message in the log.

      @WebService(targetNamespace = "http://test.apache.org/")
      @SOAPBinding(style = javax.jws.soap.SOAPBinding.Style.RPC, use = javax.jws.soap.SOAPBinding.Use.LITERAL)
      public class SoapBindingArgumentTypeMismatch {
          public boolean allocate(Integer projectId,
                  Integer[] targetIds,
                  Integer[] parameterIds) {
              return targetIds == null;
          }
      }

      Expected behavior of this sample Web service is to return true, when the targetIds parameter is absent in the SOAP request, but instead, CXF produces exception and fault response. Below is a sample SOAP request:

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:test="http://test.apache.org/"
          xmlns:SOAP-ENC = "http://schemas.xmlsoap.org/soap/encoding/"
          xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance">
         <soapenv:Header/>
         <soapenv:Body>
            <test:allocate>
               <arg0>1</arg0>
               <arg2 xsi:type = "SOAP-ENC:Array" SOAP-ENC:arrayType = "xsd:int[1]">
                   <item>222</item>
               </arg2>
            </test:allocate>
         </soapenv:Body>
      </soapenv:Envelope>

      Everything else works as expected with CXF and this issue is the only blocker. I did some research and found that bean validation is also affected for both hibernate-validator and Apache bval bean validation providers.

      I verified the behavior with CXF 3.5.2 and 3.5.4, but it seems that other versions have this issue too.

      Attachments

        1. RpcSoapBindingArgumentTypeMismatch.zip
          6 kB
          Alexander Ziubin
        2. allocate.xml
          1.0 kB
          Alexander Ziubin

        Issue Links

          Activity

            People

              Unassigned Unassigned
              aziubin Alexander Ziubin
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: