You might want to create a custom provider...

On 7/19/05, Anand Ganapathy <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I am using Axis 1.2.1 Final and I am building a
> service using JMS transport. My messages have a soap
> header and body. In the header is a field that
> specifies which service is being invoked. I parse this
> header in a handler and then set the target service.
> 
> For some reason, if the header is deserialized, axis
> fails with the error:
> 
> lns:ns2="http://xml.apache.org/axis/";>No such
> operation 'getInventory'
>         at
> org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider
> .java:179)
> 
> However if I make a clone the Message in the handler
> and deserialize the new message, everything works
> fine.
> 
> I am sure there is a better way to do this, basically
> I want my handler to extract the field that specifies
> the service from the header and set the target service
> but I do not want to clone the message.
> 
> Here is my handler code that throws the no method
> exception:
> 
> public class ProcessHeader extends BasicHandler {
>     public void invoke(MessageContext msgContext)
> throws AxisFault
>     {
>         try {
>             System.out.println("In custom handler
> code....");
> 
>             if (msgContext.getService() == null ) {
>                 Message message =
> msgContext.getCurrentMessage();
> 
>             SOAPHeaderElement she =
> (SOAPHeaderElement)message.getSOAPHeader()
> etFirstChild();
>             p2.tmf854.MTOSI_Header_T header =
> (p2.tmf854.MTOSI_Header_T)she.ge
> bjectValue(p2.tmf854.MTOSI_Header_T.class);
>             System.out.println("Service name is
> "+header.getDomain());
> 
> msgContext.setTargetService(header.getDomain());
> 
>             }
>         } catch (Exception e) {
>             e.printStackTrace();
>             throw AxisFault.makeFault(e);
>         }
> 
> If I add another line like:
> 
> Message newMessage = new
> Message(message.getSOAPPartAsBytes());
> and do a newMessage.getValueAsType everything works
> fine.
> 
> Thanks,
> Anand.
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>

Reply via email to