cancel
Showing results for 
Search instead for 
Did you mean: 

How to set username and password to webservice having Basic Authentication

former_member219446
Participant
0 Kudos

Hi experts,

I have created web service with "Basic Auth SOAP" as configuration type,

To consume that webservice in webdynpro java, i have chosen adaptive webservice model and selected "No logical destinations" ,

i did not find any setter methods to set the username and password to that webservice.

how can i set the username and password .

Regards,

Srinivas.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Srinivas,

Destionation is mandatory along with user credentials for invoking the webservice.

IWSXXXXReqElement wseleReq = wdContext.nodeXXXX().currentnodeXXXXXElement();

IWSXXSERVive wsservice = wdContext.CurrentElement();

wseleReq .setXXXXInput("INput Value");

wsservice.modelObject()._setUser("webuser");

wsservice.modelObject()._setPassword("essent99");

wsservice.modelObject()._setXXXXDestinationName(wdThis.wdGetWebserviceCompInterface().getXXXDestination("DESTINATION_NAME");

wsserviceService.modelObject()._setEndPoint(wdThis.wdGetWebserviceCompInterface().getEndPoint("DESTINATION_NAME"));

wsservice.modelObject().execute();

Regards,

Lavanya.G

Former Member
0 Kudos

Hi Srinivas,

Once you create a WS model by giving URL,No need to mention the basic authentication in the code .

For that you need to create a destinations in the Visual adminstrator.

Once you create the WS destinations,at runtime it will check the basic authentications and then excute the service.

Pls find the below link for complete information about WS model and advantage.

Note: Advantages of using WS destinations.

Link Name:

What are Web Service destinations in AWS model good for? When to use them and how to configure them?

Link:http://wiki.sdn.sap.com/wiki/display/WDJava/FAQ-Models-AdaptiveWebService

Revert back to me incase if you need any clarification on this.

Regards,

Lavanya.G

Former Member
0 Kudos

HI ,

Create a webservice destinations in the visual administrator.

In VA you need to mention the basic authention to access the webservice.

Follow the below link to create destiantions in VA.

(Follow the steps from Fig 11.)

http://wiki.sdn.sap.com/wiki/display/WDJava/ConsumingABAPWebServiceinJavaWD

Regards,

Lavanya.G

former_member214651
Active Contributor
0 Kudos

Hi,

Once u select "No Logical Destinations", in the next screen, enter the URL and user id and password.

Ensure that the use has the privileges to execute the WS (for testing use Administrator role)

Regards,

Poojith MV

former_member219446
Participant
0 Kudos

Hi Poojith,

when i choose "No logical destinations" it is asking url only, there is no username and password options.

Thanks & Regards,

Srinivas.

former_member214651
Active Contributor
0 Kudos

Hi,

If that is the case, u have an option to set the username and password thru code also.

After u create the object of the model and bind it to the node and before calling the execute statement u can set the username and password like this:

wdContext().current<ModelNodeName>Request()._setUsername("<username>");
wdContext().current<ModelNodeName>Request()._setPassword("<password>");

Hope this helps you.

Regards,

Poojith MV

Former Member
0 Kudos

Hi Srinivas,

Which version of NWDS are you in? This is a bug in NWDS. We faced this issue earlier. As a result we started authenticating the user id and password in the WSDL URL like

&sap-user=<xiuser>&sap-password=<xipass> at the end. In the higer version of NWDS, may be this bug is fixed.

Regards,

Ganesh N

former_member219446
Participant
0 Kudos

Hi Ganesh,

my nwds version :7.0.10

how to set user name and password through coding......

Thanks & Regards

Srinivas