cancel
Showing results for 
Search instead for 
Did you mean: 

Set Username and password

Former Member
0 Kudos

Dear All,

We are stuck in one of the scenario where we need to add Username and Password in SOAP request itself through code as below,

<soapenv:Header>

      <urn:AuthenticationInfo>

         <urn:userName>ABC</urn:userName>

         <urn:password>XYZ</urn:password>

         <!--Optional:-->

         <urn:authentication>?</urn:authentication>

         <!--Optional:-->

         <urn:locale>?</urn:locale>

         <!--Optional:-->

         <urn:timeZone>?</urn:timeZone>

      </urn:AuthenticationInfo>

   </soapenv:Header>

Now what changes we need to do to in Sender Agreement / SAP PI to make such authentication work ?

Regards,

Alex

Accepted Solutions (1)

Accepted Solutions (1)

KarthikBangeraM
Active Participant
0 Kudos

Hi Alex,

Have you tried another method of handling authentication by providing credentials over the url although not a very good approach. SOAP client needs to add the credentials in the below format (bold letters) while calling the webservice.

http:// <host name> : <port name> /XISOAPAdapter/MessageServlet?senderParty= <name of the sender party> &senderService= <name of the sender service> &interface= <name of the interface> &receiverParty= <name of the receiver party> &receiverService= <name of the receiver service> &interfaceNamespace= <name of the interface namespace>&j_username=<UserName>&j_password=<Password>

Regards,

Karthik


Former Member
0 Kudos

Thanks Karthik. It worked well in SOAPUI hope it works with the Third Party too.

Answers (1)

Answers (1)

former_member186851
Active Contributor
0 Kudos

Hello Alex.

Add Custom soap header using XSLT or Module beans

For XSLT

For Module Beans

Former Member
0 Kudos

Hi Raghu,

Thanks for prompt response onto this.I have used Module Beans way and added following into my request,

<SOAP:Header>

<ns0:authenticationHdr xmlns:ns0='http://customheader.com'>

<UserName>user</UserName>

<Password>password</Password>

</ns0:authenticationHdr>

<SOAP:Header/>

Still I am receiving HTTP/1.1 401 Unauthorized error.

Regards,

Alex

former_member186851
Active Contributor
0 Kudos

Hello Alex,

The user and password combo used in beans are valid?

Former Member
0 Kudos

Yes they're. How will soap consider it as username and password is some kind of mapping is also require ? or this are solely custom headers ?

Regards,

Alex

former_member186851
Active Contributor
0 Kudos

use this bean and disable add soap header option in the soap receiver channel.This header will be added in the XML.

But I am seeing additional fields in the soap header,you added them as well or those are not mandatory?

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Alex,

The 401 issue that you are experiencing is not from the SOAP Header. It is the basic authentication (HTTP Header) that is expected by the SOAP Adapter URL. In SOAP UI, this field can be populated via the username/password field which in turn gets translated into Authorization: Basic xxxxxxx in the HTTP Header.

Regards,

Mark

Former Member
0 Kudos

Hi Mark,

Exactly this basic authentication I want to include in SOAP Request as our third party doesn't have provision to enter username and password separately.

Regards,

Alex

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Alex,

Not sure if my interpretation of not having provision to enter username and password separately is correct. You can always place it in the http header, the below blog explains it.

Another option would be turning off basic authentication for the SOAP adapter entirely.

Regards,

Mark