Hi Team,
I am trying to access a rest webservice through powerbuilder 12.5(.net).The rest webservice is secured through basic authentication.I am passing the userid and password through powerbuilder to acess the service,But its returning an error .But while i am trying to accss the same REST webservice through SOAPUI, i am able to get the response.
Please find the below line of code which i have written in powerbuilder.
p_testcleint2 lp_rest
string ls_string
lp_rest=create p_testcleint2
PBWebHttp.WebClientCredential lsCredential //configure credentials
lsCredential = create PBWebHttp.WebClientCredential
lsCredential.AccessAuthentication = PBWebHttp.AuthenticationMode.Basic!
lsCredential.Password='Pa$$word1!'
lsCredential.Username='admin'
lp_rest.restConnectionObject.ClientCredential = lsCredential //add credentials to connection
try
lp_rest.PostMessage()
catch (System.Exception ee)
messagebox("Failure",string(ee.Message))
end try
Error i am getting as below :
The remote server returned an error:(401) unauthorized.
Can you please let me know why this error is coming or do i need to any extra paramert in the lsCredential to handle this.
Thanks in advance.
Regards
Subrat