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
sfAdmin BanjosfAdmin Banjo 

Add username/pwd in callout issue

Hello,

I have the following parsed code from a WDSL file, it is for a web service from Payment Adviser. 
public class BasicHttpBinding_IRemittanceService {
       
        public String endpoint_x;
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'PaymentAdviser.com.au', 'paymentadviserComAu', 'http://schemas.microsoft.com/2003/10/Serialization/', 'schemasMicrosoftCom200310Serializat', 'http://schemas.datacontract.org/2004/07/PaymentAdviser.Framework.WcfContract.CreditFactoring', 'schemasDatacontractOrg200407Payment'};
I tried adding the username and the password into the inputhttpHeaders_x since there is no revelant username or password variable to input this info into, as follows:
paymentadviserComAu.BasicHttpBinding_IRemittanceService serv = new paymentadviserComAu.BasicHttpBinding_IRemittanceService(); //the callout service class
            serv.endpoint_x  = pay.Enpoint__c;
            Map<String,String> myHeaders = new Map<String,String> ();         
            myHeaders.put('UserName',pay.Username__c);
            myHeaders.put('Password',pay.Password__c );
            serv.inputHttpHeaders_x = myHeaders;
            serv.UploadRemittanceXml(xmlbody);
when I run it I get the following error:

System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: An error occurred when verifying security for the message. faultcode=a:InvalidSecurity faultactor=

Not sure how to get the username and password header in the callout, I checked and there is no class, method or variable in the class for security credentials, so im a bit lost.





 
sharathchandra thukkanisharathchandra thukkani
Check wether there is any API documentation for payment adviser and follow the same.