Discussion

Getting (401)Unauthorized while invoking Webservic

Hi,

When I try to run the activity, which is making a call to SAOP-Connector, I am getting "(401)Unauthorized" message. Could you please help me in resolving this error.

Thanks in advance
Ganesh MVN

**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

Comments

Keep up to date on this post and subscribe to comments

August 13, 2012 - 1:38am

Service authentication not work in Pega62SP2, exactly the same issue reported before...

Pega
August 13, 2012 - 10:47am

For PRPC-to-PRPC SOAP using HTTP basic authentication:
1. Check the "Requires Authentication" checkbox on the Service Package
2. Check the "Use Authentication" checkbox on the SOAP connector
3. Add references to two text properties to the "Username Property" and "Password Property" (don't use a property of type "password") fields on the SOAP connector.
4. Make sure the two properties for the connector contain valid PRPC user credentials for the target system at when invoking the connector.

Pega
October 28, 2010 - 8:52am

You likely need to send authentication credentials as a HTTP basic auth header.

August 8, 2011 - 2:28am

I have the same issue, could you give further details, regarding how to "send authentication credentials as a HTTP basic auth header"?

-----
I have tried the following, but still get this issue.
1. create operator "88888/install"
2. assign operator with same access group as configured in service package
3. don't check "Requires Authentication?" on service package
4. service client side, Java code set operator (user name & password):
org.apache.axis.client.Call _call = super._createCall();
//set user name and password
_call.setUsername("88888");
_call.setPassword("install");
5. run client code
5.1 If command out the two lines in step4(command out set username & password), the service invoked successfully
5.2 If not command out the two lines in step4, the service call failed with error message:

AxisFault
faultCode: {http://xml.apache.org/axis/}HTTP
faultSubcode:
faultString: (401)Unauthorized
faultActor:
faultNode:
faultDetail:
{}:return code: 401
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Draft//EN">
<HTML>
<HEAD>
<TITLE>Error 401--Unauthorized</TITLE>
<META NAME="GENERATOR" CONTENT="WebLogic Server">
</HEAD>
<BODY bgcolor="white">
<FONT FACE=Helvetica><BR CLEAR=all>
<TABLE border=0 cellspacing=5><TR><TD><BR CLEAR=all>
<FONT FACE="Helvetica" COLOR="black" SIZE="3"><H2>Error 401--Unauthorized</H2>
</FONT></TD></TR>
</TABLE>
<TABLE border=0 width=100% cellpadding=10><TR><TD VALIGN=top WIDTH=100% BGCOLOR=white><FONT FACE="Courier New"><FONT FACE="Helvetica" SIZE="3"><H3>From RFC 2068 <i>Hypertext Transfer Protocol -- HTTP/1.1</i>:</H3>
</FONT><FONT FACE="Helvetica" SIZE="3"><H4>10.4.2 401 Unauthorized</H4>
</FONT><P><FONT FACE="Courier New">The request requires user authentication. The response MUST include a WWW-Authenticate header field (section 14.46) containing a challenge applicable to the requested resource. The client MAY repeat the request with a suitable Authorization header field (section 14.8). If the request already included Authorization credentials, then the 401 response indicates that authorization has been refused for those credentials. If the 401 response contains the same challenge as the prior response, and the user agent has already attempted authentication at least once, then the user SHOULD be presented the entity that was given in the response, since that entity MAY include relevant diagnostic information. HTTP access authentication is explained in section 11.</FONT></P>
</FONT></TD></TR>
</TABLE>

</BODY>
</HTML>

{http://xml.apache.org/axis/}HttpErrorCode:401

(401)Unauthorized
at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:744)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at Services.MTEKSvcPortal.SOAP.PegaRULES.ServicesBindingStub.getMyList(ServicesBindingStub.java:291)
at Services.MTEKSvcPortal.SOAP.PegaRULES.ServicesTypeProxy.getMyList(ServicesTypeProxy.java:63)
at Services.MTEKSvcPortal.SOAP.PegaRULES.TestSOAP.main(TestSOAP.java:43)

quote:


Originally posted by TANDP

You likely need to send authentication credentials as a HTTP basic auth header.

August 8, 2011 - 7:21am

Your SOAP request message must contain a user name and password value either in the (1)HTTP header (using HTTP Basic Authentication), or (2) as header or (3)parameter values of the SOAP request envelope.
Option 1. user-name/password inrequest HTTP header (using HTTP Basic Authentication)
In Connect-SOAP -> Request Tab fill-in the HEADER FIELDS:

Name: Authorization
Description:
Map From: Constant
Map From Key: "Basic ODg4ODg6aW5zdGFsbA=="

(ODg4ODg6aW5zdGFsbA== is the Base64 encoded string for 88888:install)
Option 2. user-name/password in request message header
In Connect-SOAP ->Service Tab check ‘Use Authentication?' check box and select the properties that contains the user name /password.

Please note that no matter which way you pass the user-id/password.
Requires Authentication? Check box in service package must be checked to enable authentication.

February 28, 2012 - 11:16pm

I have the same issue, I used my pega user for Authentication, but no luck, I'm ok using a pega user or is it needed set up an special user?

Thanks in advance.

August 8, 2011 - 10:52pm

Hi DASP3,

I tried with your suggestion, but still get the same error; I have a very detailed document to describe my steps and have screen shots, could you give me your email, so I can send the doc to you and for your reference.

BTW, I used Pega 6.1 SP2.

quote:


Originally posted by DASP3

Your SOAP request message must contain a user name and password value either in the (1)HTTP header (using HTTP Basic Authentication), or (2) as header or (3)parameter values of the SOAP request envelope.
Option 1. user-name/password inrequest HTTP header (using HTTP Basic Authentication)
In Connect-SOAP -> Request Tab fill-in the HEADER FIELDS:

Name: Authorization
Description:
Map From: Constant
Map From Key: "Basic ODg4ODg6aW5zdGFsbA=="

(ODg4ODg6aW5zdGFsbA== is the Base64 encoded string for 88888:install)
Option 2. user-name/password in request message header
In Connect-SOAP ->Service Tab check ‘Use Authentication?' check box and select the properties that contains the user name /password.

Please note that no matter which way you pass the user-id/password.
Requires Authentication? Check box in service package must be checked to enable authentication.


October 12, 2015 - 4:04pm

I dont see option to set user name and password in 6.2 SP2.

There is a check box in service package Requires authentication. Once check box is checked, while running service it is asking username and password. But where do we set reference username and password?