Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-105899

NullPointerException is thrown when making a SOAP service call to Portal_UserService - addUser

    Details

      Description

      Description
      A NullPointerException is thrown when a SOAP Service call is made to the addUser operation with fewer arguments.

      Context
      The addUser operation has overloaded methods, where one method has fewer arguments than the other method.

      The bug is reproduced when making a service call to the method with fewer arguments.

      Issue
      When making a SOAP Service call with the addUser operation to the method with fewer arguments, the call actually ends up at the method with more arguments.

      As a result, a NullPointerException is encountered, due to the unexpected additional arguments that are now being provided as nulls.

      Steps to Reproduce

      1. Startup Liferay with 7.2 DXP with Fix Pack 3
      2. Setup Postman (or any other tool that can send SOAP requests)
      3. Create Request in Postman
        • Option 1: Import the attached script into Postman (see section below - Additional Resource: Postman Script)
        • Option 2: Prepare a POST request to: http://localhost:8080/api/axis/Portal_UserService?wsdl
          • Navigate to 'Authorization' tab
            • Input the test Liferay user's credentials (e.g. test@liferay.com//test)
          • Navigate to 'Headers' tab
            • Add the following Header:
              • Key: SOAPAction
              • Value:
          • Navigate to the 'Body' tab
            • Input the following SOAP body:
              <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:http.service.portal.liferay.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
                 <soapenv:Header/>
                 <soapenv:Body>
                    <urn:addUser soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
                       <companyId xsi:type="xsd:long">20101</companyId>
                       <autoPassword xsi:type="xsd:boolean">false</autoPassword>
                       <password1 xsi:type="xsd:string">test</password1>
                       <password2 xsi:type="xsd:string">test</password2>
                       <autoScreenName xsi:type="xsd:boolean">false</autoScreenName>
                       <screenName xsi:type="xsd:string">testSoapUser</screenName>
                       <emailAddress xsi:type="xsd:string">testSoapUser@liferay.com</emailAddress>
                       <facebookId xsi:type="xsd:long">0</facebookId>
                       <openId xsi:type="xsd:string"></openId>
                       <locale xsi:type="xsd:string"></locale>
                       <firstName xsi:type="xsd:string">TestSoapUser</firstName>
                       <middleName xsi:type="xsd:string"></middleName>
                       <lastName xsi:type="xsd:string">Test</lastName>
                       <prefixId xsi:type="xsd:long">0</prefixId>
                       <suffixId xsi:type="xsd:long">0</suffixId>
                       <male xsi:type="xsd:boolean">true</male>
                       <birthdayMonth xsi:type="xsd:int">1</birthdayMonth>
                       <birthdayDay xsi:type="xsd:int">1</birthdayDay>
                       <birthdayYear xsi:type="xsd:int">2019</birthdayYear>
                       <jobTitle xsi:type="xsd:string">User</jobTitle>
                       <groupIds xsi:type="urn:ArrayOf_xsd_long" soapenc:arrayType="xsd:long[]"/>
                       <organizationIds xsi:type="urn:ArrayOf_xsd_long" soapenc:arrayType="xsd:long[]"/>
                       <roleIds xsi:type="urn:ArrayOf_xsd_long" soapenc:arrayType="xsd:long[]"/>
                       <userGroupIds xsi:type="urn:ArrayOf_xsd_long" soapenc:arrayType="xsd:long[]"/>
                       <sendEmail xsi:type="xsd:boolean">false</sendEmail>
                       <serviceContext xsi:type="ser:ServiceContext" xmlns:ser="http://service.kernel.portal.liferay.com"/>
                    </urn:addUser>
                 </soapenv:Body>
              </soapenv:Envelope>
            • Note: Modify the companyId to your Liferay Instance's companyId, if needed
      4. Click Send

      Expected Results:
      No errors are encountered and the user: TestSoapUser is successfully created

      Actual Results:
      NullPointerException is encountered


      Additional Resource: Postman Script
      Here is also a copy of the Postman script that's based on the steps above: SOAP - NPE - POC.postman_collection.json

      This can be imported within Postman: https://learning.getpostman.com/docs/postman/collections/data-formats/#importing-postman-data

      Additional Test Results - Works with 7.2 DXP SP1 (Fix Pack 2)

      • Startup Liferay with 7.2 DXP SP1
      • Follow steps 2-4

      Result:
      No errors are encountered and the user: TestSoapUser is successfully created

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              della.wang Della Wang
              Reporter:
              eric.yan Eric Yan
              Participants of an Issue:
              Recent user:
              Joel Garman
              Engineering Assignee:
              Eric Yan
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                46 weeks, 2 days ago

                  Packages

                  Version Package
                  7.0.0 DXP FP89
                  7.0.10.13 DXP SP13
                  7.0.X
                  7.1.10 DXP FP17
                  7.1.10.4 SP4
                  7.1.X
                  7.2.10 DXP FP4
                  7.2.X
                  7.3.0 CE GA1
                  7.3.10 DXP GA1
                  Master