Output null values in SOAP request
Application Type
Service
Platform Version
11.8.2 (Build 15398)

I am trying to call an external SOAP web service with a couple of empty parameters. At the moment Outsystems is sending the request without including the empty parameters

  <Body>

    <SearchPremiseByPostcodeFlatOrNumber>

      <sPostcode>kt1 4bu</sPostcode>

    </SearchPremise_ByPostcodeFlatOrNumber>

  <Body>


What I would like is to have the request look like this

  <Body>

    <SearchPremiseByPostcodeFlatOrNumber>

      <sFlatOrBuildingName/>

      <sPremisesNumber/>

      <sPostcode>kt1 4bu</sPostcode>

    </SearchPremise_ByPostcodeFlatOrNumber>

  <Body>

Is this possible? 

Thanks

Mike

mvp_badge
MVP
Solution

Hello Mike,

Yes, that is possible.

Most likely, those fields are defined as non-mandatory (in OutSystems). If so, when they are empty, they will not be sent on the request to the external API.

Please, try to define those fields as mandatory and they should be sent on the request to the API (even if they are empty).


Hope that this helps you!


Kind regards,

Rui Barradas

Thanks Rui, yes you were mostly correct and your answer put me on the correct track. The option I needed to set was on the input parameters of the service call - I needed to set "Send Default Value" to true on each one.

mvp_badge
MVP

Hello again Mike,

I had this problem in the past and I solved it by defining my inputs as Mandatory :)

If you see this approach, you will see that both Is Mandatory and Send Default Value properties are connected.

If you define an input parameter as Mandatory, that Send Default Value property will always be set to Yes and you won't be able to change it. That's why I prefer to maintain the input as Mandatory.

I'm glad that you managed to solve it out :)


Kind regards,

Rui Barradas

mvp_badge
MVP
Solution

Hello Mike,

Yes, that is possible.

Most likely, those fields are defined as non-mandatory (in OutSystems). If so, when they are empty, they will not be sent on the request to the external API.

Please, try to define those fields as mandatory and they should be sent on the request to the API (even if they are empty).


Hope that this helps you!


Kind regards,

Rui Barradas

Thanks Rui, yes you were mostly correct and your answer put me on the correct track. The option I needed to set was on the input parameters of the service call - I needed to set "Send Default Value" to true on each one.

mvp_badge
MVP

Hello again Mike,

I had this problem in the past and I solved it by defining my inputs as Mandatory :)

If you see this approach, you will see that both Is Mandatory and Send Default Value properties are connected.

If you define an input parameter as Mandatory, that Send Default Value property will always be set to Yes and you won't be able to change it. That's why I prefer to maintain the input as Mandatory.

I'm glad that you managed to solve it out :)


Kind regards,

Rui Barradas

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.