cancel
Showing results for 
Search instead for 
Did you mean: 

401 Unauthorized error when envoking java stand aline proxy

Former Member
0 Kudos

Hi every body,

i have a wsdl file of a WS that goes through the sap XI.

1) first i have created a java stand alone proxy.

2) then i have created a java project with the following code:

try{

EmployeeStatusReq req=new EmployeeStatusReq();

req.setEmployeeID("049824972");

WSEmployeeStatusService ws=new WSEmployeeStatusServiceImpl();

ws.getLogicalPort("WSEmployeeStatusPort").WSEmployeeStatus(req);

}

catch(Exception e){ System.out.println(e.getMessage()); }

///

when i run the application i get the following error:

Service call exception; nested exception is:

com.sap.engine.services.webservices.jaxrpc.exceptions.InvalidResponseCodeException: Invalid Response Code: (401) Unauthorized. The requested URL was:"http://milano.bezeq.com:8040/sap/xi/engine?type=entry&version=3.0&Sender.Service=WSEmployeeStatus&Interface=http%3A%2F%2Fbezeq.com%2Fxi%2FHR%2FWebServices%5EWSEmployeeStatus"

how can i specify the user name and the password ?

or do i do something wrong ?

please help me,

Morad Zeidan

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi,

No I want to call the method in a pure Java program.

I thought about making jar file and include it where ever i want .

former_member185029
Active Contributor
0 Kudos

Check

<a href="http://www.codeproject.com/useritems/edujini_webservice_java.asp">this</a> link for details.

Ashu

Former Member
0 Kudos

Hi ,

it has no such parameters,

but assuming i have a WSDL file and i want to consume the WS by a java class,

is the way i have done , the right way to do it ??

thanks

morad

former_member185029
Active Contributor
0 Kudos

Hi,

It realy depends on your requirement.

Normally we use web pages to consume services.

Are you going to use webpages to consume your service?

Ashu

Former Member
0 Kudos

hi

sorry i cant understand you ,

where exactly is the request node

former_member185029
Active Contributor
0 Kudos

Hi,

I was thinking of WebDynpro environment.

Anyways, the request object you have with you in the example you have given, will have parameters like _username and _password.

Ashu

Former Member
0 Kudos

Hi Ashu,

I cant set authorization to NONE in the WS itself because its being used in many programs,

i want to keep it as is and send to it in any way the user and the password,

the question is how can i specify the user & pass in the java code.

thanks

morad

former_member185029
Active Contributor
0 Kudos

Hi,

Under request node, you will get parameters like _username and _password.

You will have to populate those values before executing WebService.

Ashu

Former Member
0 Kudos

Hi,

Yes Its set to NONE,

we are talking about Logical port , right ?

former_member185029
Active Contributor
0 Kudos

Hi,

Have you set authentication schema as none?

Ashu

former_member185029
Active Contributor
0 Kudos

Yes,

And in the webservice configuration as well.

Ashu