Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Set credentials in Web Service

Former Member
0 Kudos

Hello Community i have a problem when I call a Web Service, the reason is that always when I call the service always request me to set credentials.

I want to know if someone know how to set credentials since the code.

For example in PHP when I call a web service I do something like this:

$wsdl="http://localhost/wservice/ZWS_CALC.XML?WSDL";

$client=new nusoap_client($wsdl,'wsdl');

$client->setCredentials('Usr', 'Pass', 'basic');

$param=array('INum1'=>'80', 'INum2' => '19', 'IOpci' => 'M');

$resultado = $client->call('ZwsEjecWsdl', $param);

I need to know which could the reemplece of this piece of code in ABAP:

$client->setCredentials('Usr', 'Pass', 'basic');

Thanks in advance.

Regards.

1 ACCEPTED SOLUTION

Ulrich_Schmidt
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Ricardo,

depends on how you call the Web Service.

  • If you use a WebService Consumer, you can set the credentials directly in the Consumer (transaction SOAMANAGER, tab Consumer-Security).
  • If you use a destination of type 'G' (CL_HTTP_CLIENT->CREATE_BY_DESTINATION), you can set the credentials in the destination (transaction SM59).
  • If you use a "direct" HTTP client (CL_HTTP_CLIENT->CREATE_BY_URL), you can set the credentials via method IF_HTTP_CLIENT->AUTHENTICATE.

Best Regards, Ulrich

2 REPLIES 2

Ulrich_Schmidt
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Ricardo,

depends on how you call the Web Service.

  • If you use a WebService Consumer, you can set the credentials directly in the Consumer (transaction SOAMANAGER, tab Consumer-Security).
  • If you use a destination of type 'G' (CL_HTTP_CLIENT->CREATE_BY_DESTINATION), you can set the credentials in the destination (transaction SM59).
  • If you use a "direct" HTTP client (CL_HTTP_CLIENT->CREATE_BY_URL), you can set the credentials via method IF_HTTP_CLIENT->AUTHENTICATE.

Best Regards, Ulrich

Former Member
0 Kudos

Thanks a lot for your quick and correct answer, you're a master.

I'll do the required configuration to do that. But this is the solution.

Thank's again.

Best Regards. Ricardo.