aspose file tools*
The moose likes Web Services and the fly likes problem by invoking web service with axis2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "problem by invoking web service with axis2" Watch "problem by invoking web service with axis2" New topic

problem by invoking web service with axis2

xin sa

Joined: May 02, 2007
Posts: 11
Hello, everybody, i have a erorr by the Invoking web service with axis2, plese help me!

the service code:
public void estConnection(String user, String passwd) throws AxisFault
String connString = Const.getCONNECTIONSTRING();
if(connString == null)
throw new AxisFault("Unknown server defined in web.xml.");

SessionContext session = MessageContext.getCurrentMessageContext().getSessionContext();
Connection conn;
catch(ClassNotFoundException cnfe)
throw new AxisFault("Oracle Driver-class not found.");
conn = DriverManager.getConnection(connString, user, passwd);
catch(SQLException sqle)
throw new AxisFault("Connection as admin could not be established.\n" + connString + " User: " + user);
DBHandler dbHandler = new DBHandler();

the client side code:
private static EndpointReference targetEPR = new EndpointReference("http://"+endpoint()+"/axis2/services/SolverAdminService");

public void estConnection(String user, String passwd)throws RemoteException{

RPCServiceClient serviceClient = new RPCServiceClient();
Options options = serviceClient.getOptions();
QName opSet = new QName("", "estConncetion");
Object response = serviceClient.invokeBlocking(opSet,new Object[] {user,passwd });
if(response instanceof RemoteException)
throw (RemoteException)response;

and if i run the client side package,there is always a erorr the compile is already passed.)

2007-05-29 12:25:24,180 ERROR org.apache.axis2.rpc.receivers.RPCMessageReceiver - Exception occurred while trying to invoke service method estConnection
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(
at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(
at org.apache.axis2.engine.AxisEngine.receive(
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(
at org.apache.axis2.transport.http.AxisServlet.doPost(
at javax.servlet.http.HttpServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.StandardWrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.coyote.http11.Http11Processor.process(
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(
at org.apache.tomcat.util.threads.ThreadPool$
at Source)
Caused by: java.lang.NullPointerException
the line 65 is "session.getProperties().remove(Const.SESSIONUSER);" in the above service-side code.

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 39535
Is "session" null, or "session.getProperties()" ?

Ping & DNS - updated with new look and Ping home screen widget
xin sa

Joined: May 02, 2007
Posts: 11
i think, that session is null.
have you any idears?
xin sa

Joined: May 02, 2007
Posts: 11
Hi, I have found, that Session is null, and i added the following codes:

public static SessionContext createSessionContext(MessageContext messageContext) {

HttpServletRequest request = (HttpServletRequest) messageContext.getProperty(
SessionContext sessionContext = null;

HttpSession httpSession = request.getSession(true);
if (httpSession != null) {
sessionContext =
(SessionContext) httpSession.getAttribute(Constants.SESSION_CONTEXT_PROPERTY);
if (sessionContext == null && httpSession.isNew()) {
String cookieValueString = httpSession.getId();
sessionContext = new SessionContext(null);
httpSession.setAttribute(Constants.SESSION_CONTEXT_PROPERTY, sessionContext);
messageContext.setProperty("SessionId", cookieValueString);
return sessionContext;


SessionContext session = createSessionContext(MessageContext.getCurrentMessageContext());

So this time the session(or SessionContext) is not null, ha, that's good, buuuuut~~, the "session.getProperties()" is null, oooohhhhh.....
has anyone idears? help me
I agree. Here's the link:
subject: problem by invoking web service with axis2
Similar Threads
cannot find symbol
complex data type in axis 2 web service
Web Services problem
not able to call a service from another service using axis2
Calling webservice problem - Urgent Please