1

i created below custom Apex Soap Webservice then i am able to get wsdl and shared to client for call SF, but i want to add some custom headers to my apex soap webservice, so that client must be add those headers and values for respect headers with http request to SF. is there any way to add custom headers and expose as wsdl.

global class MycustomWebService {
webservice static Id createrequest(String fname, String lName) {
    mycustomobj__c customobj = new mycustomobj__c(lastName__c = lName, firstName__c= fname);
    insert customobj;
    return customobj.id;
}
}

below headers needs to add :

<pnc:MessageHeader>            
        <pnc:FlowofBusiness>?</pnc:FlowofBusiness>
        <pnc:CountryCode>USA</pnc:CountryCode>
        <pnc:buyer>?</pnc:buyer>            
        <pnc:Seller>?</pnc:Seller>            
        <pnc:Transactionid>?</pnc:Transactionid>
</pnc:MessageHeader> 
2
  • What headers does your client want to add?
    – identigral
    Commented Oct 5, 2020 at 16:08
  • @identigral added headers in question, please check
    – sdandamud1
    Commented Oct 5, 2020 at 16:19

1 Answer 1

1

MessageHeader is not a standard SOAP element (that would be Envelope or Header) and therefore Salesforce won't be able to read it or send it to your Apex method.

You could route your web service calls through an API Gateway or similar middleware that understands MessageHeader. The middleware may be able to translate your payload to standard SOAP header(s) or include them in a body of a SOAP message. Mulesoft is a Salesforce product that can do this.

You must log in to answer this question.

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