0

Working on a project in which our customer will be calling Apex classes exposed as SOAP services. Everything is working just fine. We have the Apex class setup as awebservice and the inbound SOAP body contains all the segments and data we need to work with. The challenge I have is that the customer would like to send an 'action' value in the SOAP Header. I am supposed to get this value from the SOAP header and based on this call a method.

There are tons of blogs and help on extracting response header information on HTTP callouts, just not anything on how to use Apex to get Header data on an exposed SOAP class for the inbound call.

1 Answer 1

1

SF doesn't support retrieval of a custom (specific to your implementation) header from either HTTP request or from a SOAP envelope. SOAPAction is a standard SOAP header that must be included in HTTP request (the SOAP spec requires it) and SF uses it. I think you can override its value but you won't be able to retrieve the value in your Apex code.

Your only reasonable option is to include the name of the method in the web service as an additional parameter:

global class MyWebService {
    webservice static ... myMethod(String operation, ...) {
      if (operation == 'blah') {
           // do something
      }
    }
}
1
  • Thank you for the reply @identigral. I had come to this conclusion that access to the inbound SOAP header information is limited or not accessible at all in apex. Jul 9, 2019 at 17:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .