java - WS Soap Handler class never invoked -
i developing jax ws , want add soap handler use ws authentication. added handler chain xml , soap handler class code never call soap handler's method.i use jdk 8 , tomcat 7. can problem? handler chain xml below:
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <!doctype javaee:handler-chains> <javaee:handler-chains xmlns:javaee="http://java.sun.com/xml/ns/javaee" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <javaee:handler-chain> <javaee:handler> <javaee:handler-class>com.vw.authhandler </javaee:handler-class> </javaee:handler> </javaee:handler-chain> </javaee:handler-chains>
my soap handler class below:
import java.io.printstream; import java.io.stringreader; import java.util.collections; import java.util.set; import javax.xml.bind.jaxbcontext; import javax.xml.bind.jaxbexception; import javax.xml.namespace.qname; import javax.xml.soap.soapexception; import javax.xml.soap.soapheader; import javax.xml.ws.handler.messagecontext; import javax.xml.ws.handler.soap.soaphandler; import javax.xml.ws.handler.soap.soapmessagecontext; import org.w3c.dom.element; import org.w3c.dom.node; public class authhandler implements soaphandler<soapmessagecontext> { private static printstream out = system.out; @override public set<qname> getheaders() { return collections.emptyset(); } @override public boolean handlemessage(soapmessagecontext context) { boolean outboundproperty = (boolean) context.get(messagecontext.message_outbound_property); if (!outboundproperty) { system.out.println("hello!"); return true; } return false; } @override public boolean handlefault(soapmessagecontext context) { system.out.println("hello!"); return false; } @override public void close(messagecontext context) { system.out.println("hello!"); } }
my service below:
import javax.ejb.stateless; import javax.jws.handlerchain; import javax.jws.webmethod; import javax.jws.webservice; import javax.jws.soap.soapbinding; import services.loginops; import utilies.loginparameters; @webservice @handlerchain (file = "handlers.xml") @soapbinding(style=soapbinding.style.document,use=soapbinding.use.literal,parameterstyle=soapbinding.parameterstyle.wrapped) public class lservice { @webmethod public loginparameters callstr(string str } ...
Comments
Post a Comment