Skip to Content
0
Former Member
Sep 19, 2005 at 07:06 AM

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

25 Views

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)

{

}

}