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
prafprafprafpraf 

OAuth - Alternative to username-password flow

Hi Team,

I am calling external SAP web service from saleforce using wsdl2apex callouts. I have not recevied any securty esdl file from SAP team.
Now I want to pass Username and Password as a parameter in a header to SAP while invoking thier  method from a class generated by wsdl.
I am not getting any way how to set this in a apex class in salesforce.
Could anyone please help me on this and share any example which will solve my issue.
Thanks in Advance !!!

Regards,
Prafulla

gbu.varungbu.varun

It is too easy.

 

Just use HttpRequest class in Salesforce. Use send username and pwd to the header and make a http request.

prafprafprafpraf
Hi,

Thanks for your reply.
But I have tried that solution as well still it is not working. It is flashing error as --

The requested URL could not be retrieve
Access Control is Denied.
Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':HTML'

Kindly help on this and let me know if nay more details needed.

Thanks and Regards,
Prafulla Bhangale
gbu.varungbu.varun

Hi Prafulla, I was getting same reponse when I was not able to login. If you will be able to successfully hit the web service you will not get this error.