Hi,
I am currently in the middle of development of one of our services wherein I need to call a web service that uses Windows Authentication. I am able to do the first request using nlapiRequestURL with the HTTP headers below but I am not sure what to do after that. Based on my research, the base64 message returned during the first request should be decoded and passed again during the next request. I am not sure how to decode the base64 response message. Has anybobdy used nlapiRequestURL to connect to a web service that uses Windows Authentication? I'll appreciate if you can also provide sample codes.
Thanks.
Sample Code:
var soapRequestheaders = new Array();
soapRequestheaders['Authorization'] = 'Negotiate TlRMTV<continuation of base64 message>';
soapRequestheaders['Connection'] = "Keep-Alive";
soapRequestheaders['Content-Type'] = "text/xml; charset=utf-8";
var soapHtmlResponse = nlapiRequestURL(soapUrl,null,soapRequestheaders);
var responseAuthorization = soapHtmlResponse.getHeader("WWW-Authenticate");
/* Decode response authorization here */
soapRequestheaders['Authorization'] = 'Negotiate <decoded response base64 message>';
var soapHtmlResponse = nlapiRequestURL(soapUrl,soapHtmlRequest,soapRequestheaders);
Header 1st Request
GET https://<url> HTTP/1.1
Host: <host>
Connection: Keep-Alive
Authorization: Negotiate TlRMTASDKL<base64 continuation..>
Header 1st Response
HTTP/1.1 401 Unauthorized
Content-Type: text/html; charset=us-ascii
Server: Microsoft-HTTPAPI/2.0
WWW-Authenticate: Negotiate TlRMTVKJDAL<base64 continuation>
Date: Thu, 07 Oct 2010 16:54:39 GMT
Content-Length: 341
Proxy-Support: Session-Based-Authentication
Header 2nd Request
GET https://<url> HTTP/1.1
Host: <host>
Connection: Keep-Alive
Authorization: Negotiate <Base64 decoded value of the response????>