Forum Discussion

smuradia's avatar
smuradia
New Member
9 years ago

I need to know if SOAPUI sets default values for mandatory elements while sending request

Hi

 

I am using SOAPUI 5.0.0 for calling a webservice. There are few elements in the wsdl which are required as their minoccur is 1 and nillable is false by default.

 

SOAPUI is allowing me to send the request without passing those mandatory elements in the request and I am getting the successful response from the server.

 

Can someone help me to know if SOAPUI sets some default values behind the scenes for those mandatory elements.

  • nmrao's avatar
    nmrao
    Champion Level 3

    Couple of things:

     

    • That is because, if you want to test how the application is behaving if mandatory elements are missing
    • However, you can check the request validation by right click and validate or Alt+v key combinations in the request editor
    • If you want soapui to always check if the request is valid, then it can be done by using change of preferences. Check for Validate Requests in the documentation.
  • KarelHusa's avatar
    KarelHusa
    Champion Level 1

    When you see your xml request in your test step editor, it does not have to be exactly what is sent to the target service. See the following example.

     

    You can have a request XML which includes Groovy variables, as following:

     

     

    When you send a request, the xml is transformed, in this case the variable is substituted with the zip code value:

     

    Here you see the final XML and the HTTP header. Nothing else happens behind the scene.

     

    Your target service probably does not validate the request XML and so it does not complain. The service just provides a correct answer for an incorrect request.