This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Web Services and the fly likes How to use Handler? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Web Services
Bookmark "How to use Handler?" Watch "How to use Handler?" New topic
Author

How to use Handler?

James Wang
Ranch Hand

Joined: Sep 04, 2003
Posts: 102
I am a beginner of Axis,but I meet some trouble about using handler.
my deploy.wsdd file as follows:
....
<service xmlns:ns="http://ws.bywang.com" name="OrderProcessingService" provider="java:RPC">
<requestFlow>
<handler type="java:com.bywang.ws.handler.ServerHandler2"/>
</requestFlow>
....
without the element requestFlow,my webservice is right,but with it,when invoking my webservice through my Client,the server throw very very much exception,my class file ServerHander2.java is very simple and has been compiled successfully,the file content as follows:
public class ServerHandler2 implements Handler
{
//static Log log =LogFactory.getLog(ServerHandler2.class.getName());
public static final String ECHOHEADER_STRING_ID = "echoHeaderStringHandler.id";
public static final String HEADER_NS = "http://soapinterop.org/echoheader/";
public static final String HEADER_REQNAME = "echoMeStringRequest";
public static final String HEADER_RESNAME = "echoMeStringResponse";
public static final String ACTOR_NEXT = "http://schemas.xmlsoap.org/soap/actor/next";
/**
* Process a MessageContext.
*/
public void invoke(MessageContext context) throws AxisFault
{
System.out.println("invoke");
}
public void init(HandlerInfo handlerinfo)
{
System.out.println("init");
}
public boolean handleRequest(MessageContext messagecontext)
{
System.out.println("request");
return true;
}
public boolean handleResponse(MessageContext messagecontext)
{
System.out.println("response");
return true;
}
public boolean handleFault(MessageContext messagecontext)
{
System.out.println("fault");
return true;
}
public void destroy()
{
System.out.println("destroy");
}
public QName[] getHeaders()
{
return null;
}
}
i feel that I dont do anything,I want the reason,otherwise,when I use the example of Axis about handler,my webservice alse throws very very much exception. please help me thanks.
the exception as follows:
at org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance(WSD
DDeployableItem.java:310)
at org.apache.axis.deployment.wsdd.WSDDDeployableItem.getInstance(WSDDDe
ployableItem.java:296)
at org.apache.axis.deployment.wsdd.WSDDDeployment.getService(WSDDDeploym
ent.java:485)
at org.apache.axis.configuration.FileProvider.getService(FileProvider.ja
va:261)
at org.apache.axis.AxisEngine.getService(AxisEngine.java:273)
at org.apache.axis.MessageContext.setTargetService(MessageContext.java:6
83)
at org.apache.axis.handlers.http.URLMapper.invoke(URLMapper.java:87)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrateg
y.java:71)
supplement:
I user Tomcat as my server,and the exception is threw by the client but not by the Tomcat server,in other words,when running the java Client.java in windows's dos.the dos window appear the exceptions.


James<br /> <br />SCJP,SCWCD,SCBCD,SCDJWS,SCEA
 
GeeCON Prague 2014
 
subject: How to use Handler?