Hi Stephan van Hulst,
Thanks for replying, actually this is not a new project and we wanted to add a handler. Below i have attached all details:-
Handler class:-
package org.apache.axis2.handlers.creditsoap;
import java.util.Iterator;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPMessage;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.engine.Handler;
import org.apache.axis2.handlers.AbstractHandler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.commons.lang.StringUtils;
public class MyHandler extends AbstractHandler implements Handler{
private static final Log log1 = LogFactory.getLog(MyHandler.class);
@Override
public InvocationResponse invoke(MessageContext arg0) throws AxisFault {
log.info(arg0.getClass());
log.info(arg0.getLogIDString());
log.info(arg0.getEnvelope().toString());
log.info(arg0.getCurrentMessageContext());
log.info(arg0.getCurrentMessageContext().getAxisService());
return InvocationResponse.CONTINUE;
}
}
HandlerModule class:-
package org.apache.axis2.handlers.creditsoap;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.description.AxisDescription;
import org.apache.axis2.description.AxisModule;
import org.apache.axis2.modules.Module;
import org.apache.neethi.Assertion;
import org.apache.neethi.Policy;
public class MyHandlerModule implements Module{
@Override
public void applyPolicy(Policy arg0, AxisDescription arg1) throws AxisFault {
// TODO Auto-generated method stub
}
@Override
public boolean canSupportAssertion(Assertion arg0) {
// TODO Auto-generated method stub
return true;
}
@Override
public void engageNotify(AxisDescription arg0) throws AxisFault {
// TODO Auto-generated method stub
}
@Override
public void init(ConfigurationContext arg0, AxisModule arg1) throws AxisFault {
// TODO Auto-generated method stub
}
@Override
public void shutdown(ConfigurationContext arg0) throws AxisFault {
// TODO Auto-generated method stub
}
}
module.xml:-
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~
http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<module name="creditsoap" class="org.apache.axis2.handlers.creditsoap.MyHandlerModule">
<InFlow>
<handler name="InFlowCreditSoapHandler" class="org.apache.axis2.handlers.creditsoap.MyHandler">
<order phase="creditSoapPhase"/>
</handler>
</InFlow>
<OutFlow>
<handler name="OutFlowCreditSoapHandler" class="org.apache.axis2.handlers.creditsoap.MyHandler">
<order phase="creditSoapPhase"/>
</handler>
</OutFlow>
<OutFaultFlow>
<handler name="FaultOutFlowCreditSoapHandler" class="org.apache.axis2.handlers.creditsoap.MyHandler">
<order phase="creditSoapPhase"/>
</handler>
</OutFaultFlow>
<InFaultFlow>
<handler name="FaultInFlowCreditSoapHandler" class="org.apache.axis2.handlers.creditsoap.MyHandler">
<order phase="creditSoapPhase"/>
</handler>
</InFaultFlow>
</module>
axis2.xml:-
<phaseOrder type="InFlow">
<!-- System predefined phases -->
<phase name="Transport">
<handler name="RequestURIBasedDispatcher"
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
<order phase="Transport"/>
</handler>
<handler name="SOAPActionBasedDispatcher"
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
<order phase="Transport"/>
</handler>
</phase>
<phase name="Addressing">
<handler name="AddressingBasedDispatcher"
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
<order phase="Addressing"/>
</handler>
</phase>
<phase name="Security"/>
<phase name="PreDispatch"/>
<phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
<handler name="RequestURIBasedDispatcher"
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
<handler name="SOAPActionBasedDispatcher"
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
<handler name="RequestURIOperationDispatcher"
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
<handler name="SOAPMessageBodyBasedDispatcher"
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
<handler name="HTTPLocationBasedDispatcher"
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
<handler name="GenericProviderDispatcher"
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
<handler name="MustUnderstandValidationDispatcher"
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
</phase>
<phase name="RMPhase"/>
<!-- System predefined phases -->
<!-- After Postdispatch phase module author or service author can add any phase he want -->
<phase name="creditSoapPhase"/>
<phase name="OperationInPhase">
<handler name="MustUnderstandChecker"
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">