+ Start a Discussion
Carlos HernandoCarlos Hernando 

Webservice callout using user and password


I'm trying to connect to an external webservice to retrieve information.When I try to call this webservice from a SOAP Client I recieve the information, but when I call the same web service from SalesForce I'm receiving the following error:

18:34:11.83 (2083320833)|CALLOUT_RESPONSE|[208]|System.HttpResponse[Status=Error Interno del Servidor, StatusCode=500] 18:34:11.83 (2123598734)|EXCEPTION_THROWN|[61]|System.XmlException: ParseError at [row,col]:[116,206] Message: The element type "HR" must be terminated by the matching end-tag "</HR>".

This is the code I'm currently using 
Blob headerValue = Blob.valueOf('user' +':' +'pass' );
 String authorizationHeader = 'Basic ' + EncodingUtil.base64Encode(headerValue); 
req.setHeader('Authorization', authorizationHeader); 

I also would like to know how I'm suppose to use the WebServiceCallout.invoke (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_System_WebServiceCallout.htm) method with a user authentication.
Hi Carlos,

Try this  - Since its a 'POST' request you will be trying to send data along with it,in that check for 'HR' Tag if exsists close the same or could you please Post the complete code for debug,seeing the error message above we cant justify the issue.


Have a great day ahead,Let the Force be with you!