mibuso.com

Microsoft Business Solutions online community
It is currently Mon May 20, 2013 8:08 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Passing credentials to external web service
PostPosted: Fri Feb 10, 2012 10:52 am 
Offline

Joined: Mon Jun 20, 2011 10:48 am
Posts: 7
Country: South Africa (za)
Hi All,

I am calling a web service from within Nav that requires authentication (username and password) to access. How does one send the username and password with the request in order to prevent the authentication dialog popping up to the user.

I call like web service like this, setting AuthUser and AuthPassword on the header, but this seems to make no difference:
Code: Select all
CREATE(autXmlHttp);
autXmlHttp.open('POST', txtServiceURI, 0);
autXmlHttp.setRequestHeader('Content-type', 'text/xml');
autXmlHttp.setRequestHeader('AuthUser', txtUserName);
autXmlHttp.setRequestHeader('AuthPassword', txtPassword);
autXmlHttp.setRequestHeader('SOAPAction', txtServiceAction);
autXmlHttp.setRequestHeader('Timeout', FORMAT(intTimeout));
autXmlHttp.send(autXmlDoc);

Any ideas?


Top
 Profile E-mail  
 
 Post subject: Re: Passing credentials to external web service
PostPosted: Sat Feb 11, 2012 2:19 pm 
Offline
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Thu Oct 16, 2003 8:50 am
Posts: 12265
Location: Brno
Country: Czech Republic (cz)
Depends on if the the user name and password should be same as the user under which it is called or not. If yes, you can try to add the target URL into Extranet URLs list in Internet Explorer to allow automatic credential transfer, but all depends on the infrastructure and authentication type of the target webservice.

_________________
Kamil Sacek
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.


Top
 Profile E-mail WWW  
 
 Post subject: Re: Passing credentials to external web service
PostPosted: Thu Feb 16, 2012 10:30 am 
Offline

Joined: Mon Jun 20, 2011 10:48 am
Posts: 7
Country: South Africa (za)
Thanks for the reply, but in this case the username and password is the same irrespective of logged in user.

EDIT: and excuse the late response. Did not realise I was not subscribed to the post.


Top
 Profile E-mail  
 
 Post subject: Re: Passing credentials to external web service
PostPosted: Thu Feb 16, 2012 11:22 am 
Offline
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Thu Oct 16, 2003 8:50 am
Posts: 12265
Location: Brno
Country: Czech Republic (cz)
If you call webservices, which are using Windows authentication, I think that the credentials (or ticket) will be passed automatically, if the target URL is in Intranet zone in Internet Explorer.

_________________
Kamil Sacek
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.


Top
 Profile E-mail WWW  
 
 Post subject: Re: Passing credentials to external web service
PostPosted: Thu Feb 16, 2012 11:40 am 
Offline

Joined: Mon Jun 20, 2011 10:48 am
Posts: 7
Country: South Africa (za)
Still any idea of how to pass credentials explicitly then?


Top
 Profile E-mail  
 
 Post subject: Re: Passing credentials to external web service
PostPosted: Thu Feb 16, 2012 12:02 pm 
Offline
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Thu Oct 16, 2003 8:50 am
Posts: 12265
Location: Brno
Country: Czech Republic (cz)
Look at all parameters of the Open function you are using... ;-)

_________________
Kamil Sacek
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.


Top
 Profile E-mail WWW  
 
 Post subject: Re: Passing credentials to external web service
PostPosted: Thu Feb 16, 2012 12:46 pm 
Offline

Joined: Mon Jun 20, 2011 10:48 am
Posts: 7
Country: South Africa (za)
Ah, right there all the time :whistle: . I was so convinced the answer lay in the header.

Just for those of you who enjoy NAV's lack of intellisense:
autXmlHttp.open(BSTR bstrMethod, BSTR bstrURL[, VARIANT varAsync][, VARIANT bstrUser][, VARIANT bstrPassword]

Thanks a lot, appreciate it.


Top
 Profile E-mail  
 
 Post subject: Re: Passing credentials to external web service
PostPosted: Thu Feb 16, 2012 1:43 pm 
Offline
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Thu Oct 16, 2003 8:50 am
Posts: 12265
Location: Brno
Country: Czech Republic (cz)
You are welcome!

_________________
Kamil Sacek
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.


Top
 Profile E-mail WWW  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: