Forum Discussion

richie's avatar
richie
Community Hero
7 years ago

Works in Postman but not SoapUI? Exception: Cannot get property 'testCase' on null object

Hi,

 

UPDATED MESSAGE.

 

I have a REST request publishing a flat file record to a service and I'm getting an authentication error when I submit the request via SoapUI, but no error response when I do the same request via POSTMAN.

 

To repeat the same request works in Postman but doesnt in SoapUI.

 

My test case hierarchy is as follows:

 

TestCase (publish flat file record to service)
Step1 - REST (POST) request (flat file record embedded within the step rather than sourcing the flat file via a fileContent property on a datasource object).

 

SoapUI settings are as below:

 

 

Method: POST
Media: text/plain

https://exttest.xxxx.mipaas.io/ext/csm/sit6/ncc/test-flatfile-crm-create-phonecall

Basic Auth
Username: dm-admin
Password: password

 

 

No additional headers added - but the 'Media' setting generates the Content-Type header and setting 'Basic Auth' creates an Authorization header too.

 

 

POSTMAN settings are as below:

 

 

Method: POST
Content-Type:text/plain

https://exttest.xxxx.mipaas.io/ext/csm/sit6/ncc/test-flatfile-crm-create-phonecall

Basic Authorization
Username: dm-admin
Password: password

 

 

I've attached screenshots - 3 of Postman setup and 2 of my SoapUI setup.

 

The logs indicate 'ERROR:java.lang.NullPointerException: Cannot get property 'testCase' on null object' and the stacktrace in the error log references loads of groovy.

 

HOWEVER - I'm not using groovyscript at all in my request - the testcase has only 1 step and its a RESTful POST with the file contents embedded with the request.

 

Would anyone know what I'm doing wrong?

 

I don't know if it makes any difference - but the endpoint I'm posting to is actually a custom api to allow me to test the system - the genuine service is asynchronous so there aren't any responses to assert against, so the development team develop apis to support the soapui testing.

 

I have attached the error log stack trace as well,

 

As always - I welcome all and any help anyone can provide - I just cant see what the problem is.

 

thanks,

 

richie

  • Hi Richie,

     

    Thank you for your post and for the provided details. 

     

    I see that the Content-Type header differs in your requests. Maybe, you need to change the Media Type value in ReadyAPI to 'application/x-www-form-urlencoded'.

     

    But, according to the screenshot and status 401, the issue is related to the authorization. You can try to manually add the Authorization header to ReadyAPI, copy the value from the Postman and send a request.

     

    Also, to determine the cause of the issue, we need to compare full raw requests from ReadyAPI and from Postman. 

    To get a raw request which was sent from a browser (or from another application) you can use Fiddler (http://www.telerik.com/download/fiddler) which is a free tool to capture HTTP(S) traffic.

     

    As for the issue in the logs, please check the Event Handlers for your request: https://support.smartbear.com/readyapi/docs/testing/handling-events.html

  • Nastya_Khovrina's avatar
    Nastya_Khovrina
    SmartBear Alumni (Retired)

    Hi Richie,

     

    Thank you for your post and for the provided details. 

     

    I see that the Content-Type header differs in your requests. Maybe, you need to change the Media Type value in ReadyAPI to 'application/x-www-form-urlencoded'.

     

    But, according to the screenshot and status 401, the issue is related to the authorization. You can try to manually add the Authorization header to ReadyAPI, copy the value from the Postman and send a request.

     

    Also, to determine the cause of the issue, we need to compare full raw requests from ReadyAPI and from Postman. 

    To get a raw request which was sent from a browser (or from another application) you can use Fiddler (http://www.telerik.com/download/fiddler) which is a free tool to capture HTTP(S) traffic.

     

    As for the issue in the logs, please check the Event Handlers for your request: https://support.smartbear.com/readyapi/docs/testing/handling-events.html

    • richie's avatar
      richie
      Community Hero

      adding the authorization header in (despite it already being present in the request) fixed the problem!

       

      Thanks so much!

       

      richie