0

I am integrating Salesforce with a program called IFS. I have the WSDL from IFS and have imported it into Salesforce. My problem is that the WSDL does not have anything about logging into IFS. I do not know how to pass the username and password to log in. When I make the connection I get a 401 unauthorized error. Anyone know how to pass the security to IFS?

2
  • Credentials that you have , do they look like windows domain credentials? domain\username?
    – Roman
    Commented Jul 14, 2017 at 18:14
  • You will probably need to consult the documentation for "IFS" in order to determine how to properly pass the values along to the system. Commented Jul 14, 2017 at 18:25

2 Answers 2

0

As far as i know IFS is build on windows stack, so most likely it uses NTLM authentication. You can try this tool: https://github.com/natewallace/ApexNTLM.

Example of usage

 MSDCredentials__c mc = MSDCredentials__c.getValues('MSD Credentials');
        String username = mc.Domain__c + '\\' + mc.Username__c;
        String password = mc.Password__c;  
        HttpClient httpObj = new HttpClient(username,password,True);
        MSDIntegrationURL__c urlVar; 

        HttpRequest req = new HttpRequest();
        String body = createXMLRequest(request);    
        req.setBody(body);

        String ep;
        ep = urlVar.EndPointURL__c;
        Map<String,String> headerMap = new Map<String,String>();
        headerMap.put('SOAPAction',urlVar.SOAPAction__c);
        headerMap.put('Content-Type','text/xml;charset=UTF-8');
        headerMap.put('Accept-Encoding','gzip,deflate');

        req.setEndpoint(ep);
        req.setMethod('POST')

        Httpresponse res = new Httpresponse();

        res = httpObj.send(req,headerMap);
1
  • I tried this and am still getting a 401 error. The username and password look just like a username and password they don't have a domain tied to them.
    – Travis
    Commented Jul 26, 2017 at 23:55
0

I found the error. It takes Basic Authentication. so in the example https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_restful_http_httprequest.htm#apex_System_HttpRequest_setTimeout they show how to do username and password. I was doing it right but had the word "BASIC" all caps like in the example and IFS only reads it if is "Basic". Don't you love it when you spend weeks and it is something stupid like an issue with capitalization.

You must log in to answer this question.

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