axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Woinoski <micha...@pineneedleconsulting.com>
Subject Using client-config.wsdd to deploy a javax.xml.rpc.handler.Handler
Date Fri, 24 Oct 2003 15:00:46 GMT
I have written a Handler that implements javax.xml.rpc.handler.Handler. When I 
try to deploy it on a client using client-config.wsdd, Axis throws a fault. The 
same client-config.wsdd works fine if I replace the class with a class that 
extends org.apache.axis.handlers.BasicHandler, and I can configure my original 
handler on the server side with deploy.wsdd.

The Axis WSDDDeployableItem class attempts to cast my handler to 
org.apache.axis.Handler, which throws a ClassCastException. Is there some option 
I can set in client-config.wsdd that will deploy the 
javax.xml.rpc.handler.Handler? Or is it only possible by adding the Handler in 
the client programatically, as in the jaxrpc/hello/HelloClient.java sample?

Thanks,
Mike

------------------------- Here's the Fault: ----------------------------------

     AxisFault
      faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
      faultSubcode:
      faultString: org.apache.axis.ConfigurationException: 
java.lang.ClassCastException
     java.lang.ClassCastException
         at 
org.apache.axis.deployment.wsdd.WSDDDeployableItem.makeNewInstance(WSDDDeployableItem.java:338)
         at 
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance(WSDDDeployableItem.java:310)
         at 
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getInstance(WSDDDeployableItem.java:296)
         at 
org.apache.axis.deployment.wsdd.WSDDDeployment.getHandler(WSDDDeployment.java:455)
         at 
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance(WSDDDeployableItem.java:312)
         at 
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getInstance(WSDDDeployableItem.java:296)
         at 
org.apache.axis.deployment.wsdd.WSDDChain.makeNewInstance(WSDDChain.java:164)
         at 
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance(WSDDDeployableItem.java:310)
         at 
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getInstance(WSDDDeployableItem.java:296)
         at 
org.apache.axis.deployment.wsdd.WSDDDeployment.getGlobalRequest(WSDDDeployment.java:531)
         at 
org.apache.axis.configuration.FileProvider.getGlobalRequest(FileProvider.java:294)
         at org.apache.axis.AxisEngine.getGlobalRequest(AxisEngine.java:304)
         at org.apache.axis.client.AxisClient.invoke(AxisClient.java:166)
         at org.apache.axis.client.Call.invokeEngine(Call.java:2564)
         at org.apache.axis.client.Call.invoke(Call.java:2553)
         at org.apache.axis.client.Call.invoke(Call.java:2248)
         at org.apache.axis.client.Call.invoke(Call.java:2171)
         at org.apache.axis.client.Call.invoke(Call.java:1691)
         at 
service.weather.AirportWeatherPortSoapBindingStub.getTemp(AirportWeatherPortSoapBindingStub.java:243)
         at ServiceTestClient.main(ServiceTestClient.java:29)

----------- Here's the client-config.wsdd:-------------------------------------

     <?xml version="1.0" encoding="UTF-8"?>
     <deployment xmlns="http://xml.apache.org/axis/wsdd/"
                 xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
         <!-- the handler that implements javax.xml.rpc.handler.Handler
              causes a fault -->
         <handler name="log" type="java:client.MessageHandler"/>

         <!-- the following BasicHandler subclass works fine -->
         <!--<handler name="log" type="java:client.SOAPMonitor"/>-->

         <globalConfiguration>
             <requestFlow>
                 <handler type="log"/>
             </requestFlow>
             <responseFlow>
                 <handler type="log"/>
             </responseFlow>
         </globalConfiguration>
         <transport name="java"
                    pivot="java:org.apache.axis.transport.java.JavaSender"/>
         <transport name="http"
                    pivot="java:org.apache.axis.transport.http.HTTPSender"/>
         <transport name="local"
                    pivot="java:org.apache.axis.transport.local.LocalSender"/>
     </deployment>

------------------- Here's the handler class: --------------------------------

     package client;

     import java.util.Iterator;
     import javax.xml.namespace.QName;
     import javax.xml.rpc.JAXRPCException;
     import javax.xml.rpc.handler.Handler;
     import javax.xml.rpc.handler.HandlerInfo;
     import javax.xml.rpc.handler.MessageContext;
     import javax.xml.rpc.handler.soap.SOAPMessageContext;
     import javax.xml.soap.*;

     public class MessageHandler implements Handler {
         public MessageHandler() {
         }

         public void init(HandlerInfo config) {
         }

         public boolean handleRequest(MessageContext context) throws 
JAXRPCException {
             log.info("supplier.MessageHandler: In handleRequest");
             SOAPMessage request = ((SOAPMessageContext)context).getMessage();
             handleRequestMessage(request);
             return true;
         }

         public boolean handleResponse(MessageContext context) throws 
JAXRPCException {
             log.info("supplier.MessageHandler: In handleResponse");
             SOAPMessage response = ((SOAPMessageContext)context).getMessage();
             handleResponseMessage(response);
             return true;
         }

         public boolean handleFault(MessageContext context) {
             log.info("supplier.MessageHandler: In handleFault");
             return true;
         }

         public void destroy() { }

         public QName[] getHeaders() {
             return null;
         }

         private void handleRequestMessage(SOAPMessage response) {
             logMessage(response);
         }

         private void handleResponseMessage(SOAPMessage response) {
             logMessage(response);
         }

         private void logMessage(SOAPMessage msg) throws JAXRPCException {
             try {
                 log.info("Message:");
                 log.info(msg.getSOAPPart().getEnvelope().toString());
             }
             catch (SOAPException e) {
                 log.error("Error processing SOAP message: " + e);
                 throw new JAXRPCException(e);
             }
         }

         private static org.apache.log4j.Logger log =
             org.apache.log4j.Logger.getLogger("com.ltree.crs577");

     }


-- 

Mike Woinoski                      Pine Needle Consulting
mailto:michaelw@pineneedleconsulting.com



Mime
View raw message