Search code examples
apigee

Apigee - How to exclude fields on WSDL call


I am using Apigee REST to SOAP to REST Proxy.

After creating the WSDL proxy and deploying it. I see all the parameters that could be sent to the SOAP endpoint. Let call it param1, param2, param3, all optional. But Validation on it is [0-9A-Fa-f]{8}, so that means each param if not empty must be 8 characters long.

The problem I am having is when param2 is null. Some reason the proxy still includes that within the request causing validation error.

Does anyone know how I can fix this? I basically wants this. http://xxx.apigee.com/myrestendpoint?param1=xxx&param3=xxx

The soap will not include param2, only sending param1 and param3.


Solution

  • I took the approach of Json to Xml to fix my issue described above. Basically it will generate the XML from a json I pass, and modify my BuildSoap to use the Converted Text.

    Example

    {School : {
      teachers : { teacher: [
        {id:123}, {id:456}
      ]}
    }
    

    will become

    <School>
      <teachers>
        <teacher>
          <id>123</id>
        </teacher>
        <teacher>
          <id>456</id>
        </teacher>
      </teachers>
    </school>
    

    And I add that to my BuildSoap

    ...<soap:envelop><soap:body>{xmlFromJson}</soap:body></soap:envelop>