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
Imran MohammedImran Mohammed 

How to add web service security header while invoking external web service?



I want to know how can i send username and password as security header which will be part of http header request.

I have WSDL, from which i generated Apex stubs.

The generated Apex stubs does not have any functionality related to security header.

I am getting ann error message, "error discovered processing the wsse:security header".


Can any one let know what is the reason for getting the error message?


Thanks in advance for any help.


Imran - just to be clear, your requirement is to set WS-Security SOAP Headers when invoking an external web service via Apex (using WSDL2Apex), correct? Is so, Salesforce unfortunately does not support setting SOAP headers (like WS-Security) that are not explicitly included in the WSDL markup. You can set HTTP headers of course, but not SOAP headers.

There may be workaround though - you should be able to manually insert the WSS headers into the SOAP payload. Check out this discussion thread -

Christian Monje Marcos 15Christian Monje Marcos 15
Good night. Good night,

Did you finally get the integration? Can you help me and tell me how you got it?

Thank you very much.