function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Is it possible to create custom Headers using Apex code?


Salesforce provides some standard SOAP headers such as AllowFieldTruncationHeader, MruHeader etc.

But can we create custom headers using apex code, so that they would be visible in the custom WSDL that gets generated from that APEX code?
Hi Priyanka, 

The standard WSDL-->Apex feature does not support including any WSS or WSP headers in the outgoing SOAP request.

You will need to forgo the WSDL-->Apex generated classes and instead manually construct the request SOAP message and then invoke the web service using the Apex HTTP callout classes.

This thread should be helpful in showing you how to do this -

Hope this helps.