cancel
Showing results for 
Search instead for 
Did you mean: 

How can I pass username and password in a client bean to call a webservice?

Former Member
0 Kudos

Hi,

I have created a Client Java Bean for a web service (an automatically created Service from a Bapi) that requires username and password. How can I pass username and password in the code?

Thank you!

Julia

This is my code:

public Z_FlightGetlist port;

/**

  • Business Method.

*/

public String test1234() {

try{

BAPI_FLIGHT_GETLIST list = new BAPI_FLIGHT_GETLIST();

list.setAIRLINE("KLM");

port.BAPI_FLIGHT_GETLIST(list);

return "ok";

}

catch(Throwable e){

return "error"+e;

}

}

public void ejbCreate() throws CreateException {

try{

InitialContext ic = new InitialContext();

Z_FlightGetlistService s = (Z_FlightGetlistService)ic.lookup ("java:comp/env/FlightProxy");

Z_FlightGetlist vi = (Z_FlightGetlist)s.getLogicalPort(Z_FlightGetlist.class);

this.port = vi;

}

catch(Throwable e)

{

}

}

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182372
Active Contributor
0 Kudos

Hello Julia,

Check this document

http://help.sap.com/saphelp_nw04/helpdata/en/50/a5d13f83a14d21e10000000a1550b0/frameset.htm

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Hi,

thank you for your answer. I can't access this document by this link. Can you please send it to Julia.Seifert@pdb.sbs.de?

Thank you

Julia

former_member182372
Active Contributor
0 Kudos

Hello Julia,

I`m wondering that you don`t have access to help.sap.com! It is a public resource and you don`t need any efforts to access it.

Best regards, Maksim Rashchynski.