// This class was generated by the JAXRPC SI, do not edit.
// Contents subject to change without notice.
// JAX-RPC Standard Implementation (1.1, build EA-R39)

package com.agiledeveloper.ws;

import com.sun.xml.rpc.server.http.MessageContextProperties;
import com.sun.xml.rpc.streaming.*;
import com.sun.xml.rpc.encoding.*;
import com.sun.xml.rpc.encoding.soap.SOAPConstants;
import com.sun.xml.rpc.encoding.soap.SOAP12Constants;
import com.sun.xml.rpc.encoding.literal.*;
import com.sun.xml.rpc.soap.streaming.*;
import com.sun.xml.rpc.soap.message.*;
import com.sun.xml.rpc.soap.SOAPVersion;
import com.sun.xml.rpc.soap.SOAPEncodingConstants;
import com.sun.xml.rpc.wsdl.document.schema.SchemaConstants;
import javax.xml.namespace.QName;
import java.rmi.RemoteException;
import java.util.Iterator;
import java.lang.reflect.*;
import java.lang.Class;
import com.sun.xml.rpc.server.*;
import javax.xml.rpc.handler.HandlerInfo;
import com.sun.xml.rpc.client.HandlerChainImpl;

public class LifetimeIF__Lifetime__Tie
    extends com.sun.xml.rpc.server.TieBase implements SerializerConstants {
    
    
    public LifetimeIF__Lifetime__Tie() throws Exception {
        super(new jaxrpc.generated.lifetime.Lifetime_SerializerRegistry().getRegistry());
        initialize(internalTypeMappingRegistry);
    }
    
    /*
     * This method does the actual method invocation for operation: getInfo
     */
    private void invoke_getInfo(StreamingHandlerState state) throws Exception {
        
        com.agiledeveloper.ws.LifetimeIF_getInfo_RequestStruct myLifetimeIF_getInfo_RequestStruct = null;
        Object myLifetimeIF_getInfo_RequestStructObj =
            state.getRequest().getBody().getValue();
        
        if (myLifetimeIF_getInfo_RequestStructObj instanceof SOAPDeserializationState) {
            myLifetimeIF_getInfo_RequestStruct = (com.agiledeveloper.ws.LifetimeIF_getInfo_RequestStruct)((SOAPDeserializationState)myLifetimeIF_getInfo_RequestStructObj).getInstance();
        } else {
            myLifetimeIF_getInfo_RequestStruct = (com.agiledeveloper.ws.LifetimeIF_getInfo_RequestStruct)myLifetimeIF_getInfo_RequestStructObj;
        }
        
        try {
            java.lang.String result = 
                ((com.agiledeveloper.ws.LifetimeIF) getTarget()).getInfo();
            com.agiledeveloper.ws.LifetimeIF_getInfo_ResponseStruct myLifetimeIF_getInfo_ResponseStruct =
                new com.agiledeveloper.ws.LifetimeIF_getInfo_ResponseStruct();
            SOAPHeaderBlockInfo headerInfo;
            myLifetimeIF_getInfo_ResponseStruct.setResult(result);
            
            SOAPBlockInfo bodyBlock = new SOAPBlockInfo(ns1_getInfo_getInfoResponse_QNAME);
            bodyBlock.setValue(myLifetimeIF_getInfo_ResponseStruct);
            bodyBlock.setSerializer(ns2_myLifetimeIF_getInfo_ResponseStruct__Lifetime__SOAPSerializer);
            state.getResponse().setBody(bodyBlock);
        } catch (javax.xml.rpc.soap.SOAPFaultException e) {
            SOAPFaultInfo fault = new SOAPFaultInfo(e.getFaultCode(),
                e.getFaultString(), e.getFaultActor(), e.getDetail());
            SOAPBlockInfo faultBlock = new SOAPBlockInfo(com.sun.xml.rpc.encoding.soap.SOAPConstants.QNAME_SOAP_FAULT);
            faultBlock.setValue(fault);
            faultBlock.setSerializer(new SOAPFaultInfoSerializer(false, e.getDetail()==null));
            state.getResponse().setBody(faultBlock);
            state.getResponse().setFailure(true);
        }
    }
    
    /*
     * This method must determine the opcode of the operation that has been invoked.
     */
    protected void peekFirstBodyElement(XMLReader bodyReader, SOAPDeserializationContext deserializationContext, StreamingHandlerState state) throws Exception {
        if (bodyReader.getName().equals(ns1_getInfo_getInfo_QNAME)) {
            state.getRequest().setOperationCode(getInfo_OPCODE);
        }
        else {
            throw new SOAPProtocolViolationException("soap.operation.unrecognized", bodyReader.getName().toString());
        }
    }
    
    /*
     *  this method deserializes the request/response structure in the body
     */
    protected void readFirstBodyElement(XMLReader bodyReader, SOAPDeserializationContext deserializationContext, StreamingHandlerState  state) throws Exception {
        int opcode = state.getRequest().getOperationCode();
        switch (opcode) {
            case getInfo_OPCODE:
                deserialize_getInfo(bodyReader, deserializationContext, state);
                break;
            default:
                throw new SOAPProtocolViolationException("soap.operation.unrecognized", Integer.toString(opcode));
        }
    }
    
    
    
    /*
     * This method deserializes the body of the getInfo operation.
     */
    private void deserialize_getInfo(XMLReader bodyReader, SOAPDeserializationContext deserializationContext, StreamingHandlerState state) throws Exception {
        Object myLifetimeIF_getInfo_RequestStructObj =
            ns2_myLifetimeIF_getInfo_RequestStruct__Lifetime__SOAPSerializer.deserialize(ns1_getInfo_getInfo_QNAME,
                bodyReader, deserializationContext);
        
        SOAPBlockInfo bodyBlock = new SOAPBlockInfo(ns1_getInfo_getInfo_QNAME);
        bodyBlock.setValue(myLifetimeIF_getInfo_RequestStructObj);
        state.getRequest().setBody(bodyBlock);
    }
    
    
    /*
     * This method must invoke the correct method on the servant based on the opcode.
     */
    protected void processingHook(StreamingHandlerState state) throws Exception {
        switch (state.getRequest().getOperationCode()) {
            case getInfo_OPCODE:
                invoke_getInfo(state);
                break;
            default:
                throw new SOAPProtocolViolationException("soap.operation.unrecognized", Integer.toString(state.getRequest().getOperationCode()));
        }
    }
    
    
    public String getDefaultEnvelopeEncodingStyle() {
        return null;
    }
    
    public String getImplicitEnvelopeEncodingStyle() {
        return "";
    }
    
    
    /*
     * This method must determine the opcode of the operation given the QName of the first body element.
     */
    public int getOpcodeForFirstBodyElementName(QName name) {
        if (name == null) {
            return InternalSOAPMessage.NO_OPERATION;
        }
        if (name.equals(ns1_getInfo_getInfo_QNAME)) {
            return getInfo_OPCODE;
        }
        return super.getOpcodeForFirstBodyElementName(name);
    }
    
    
    private Method internalGetMethodForOpcode(int opcode) throws ClassNotFoundException, NoSuchMethodException {
        
        Method theMethod = null;
        
        switch(opcode) {
            case getInfo_OPCODE:
                {
                    Class[] carray = {  };
                    theMethod = (com.agiledeveloper.ws.LifetimeIF.class).getMethod("getInfo", carray);
                }
                break;
            
            default:
        }
        return theMethod;
    }
    
    private Method[] methodMap = new Method[1];
    
    /*
     * This method returns the Method Obj for a specified opcode.
     */
    public Method getMethodForOpcode(int opcode) throws ClassNotFoundException, NoSuchMethodException {
         
        if (opcode <= InternalSOAPMessage.NO_OPERATION ) {
            return null;
        }
         
        if (opcode >= 1 ) {
            return null;
        }
         
        if (methodMap[opcode] == null)  {
            methodMap[opcode] = internalGetMethodForOpcode(opcode);
        }
         
        return methodMap[opcode];
    }
    
    /*
     * This method returns an array containing (prefix, nsURI) pairs.
     */
    protected String[] getNamespaceDeclarations() {
        return myNamespace_declarations;
    }
    
    /*
     * This method returns an array containing the names of the headers we understand.
     */
    public QName[] getUnderstoodHeaders() {
        return understoodHeaderNames;
    }
    
    private void initialize(InternalTypeMappingRegistry registry) throws Exception {
        ns2_myLifetimeIF_getInfo_ResponseStruct__Lifetime__SOAPSerializer = (CombinedSerializer)registry.getSerializer(SOAPConstants.NS_SOAP_ENCODING, com.agiledeveloper.ws.LifetimeIF_getInfo_ResponseStruct.class, ns2_getInfoResponse_TYPE_QNAME);
        ns2_myLifetimeIF_getInfo_RequestStruct__Lifetime__SOAPSerializer = (CombinedSerializer)registry.getSerializer(SOAPConstants.NS_SOAP_ENCODING, com.agiledeveloper.ws.LifetimeIF_getInfo_RequestStruct.class, ns2_getInfo_TYPE_QNAME);
    }
    
    private static final QName portName = new QName("http://www.agiledeveloper.com/wsdl/Lifetime", "LifetimeIF");
    private static final int getInfo_OPCODE = 0;
    private static final QName ns1_getInfo_getInfo_QNAME = new QName("http://www.agiledeveloper.com/wsdl/Lifetime", "getInfo");
    private static final QName ns2_getInfo_TYPE_QNAME = new QName("http://www.agiledeveloper.com/types/Lifetime", "getInfo");
    private CombinedSerializer ns2_myLifetimeIF_getInfo_RequestStruct__Lifetime__SOAPSerializer;
    private static final QName ns1_getInfo_getInfoResponse_QNAME = new QName("http://www.agiledeveloper.com/wsdl/Lifetime", "getInfoResponse");
    private static final QName ns2_getInfoResponse_TYPE_QNAME = new QName("http://www.agiledeveloper.com/types/Lifetime", "getInfoResponse");
    private CombinedSerializer ns2_myLifetimeIF_getInfo_ResponseStruct__Lifetime__SOAPSerializer;
    private static final String[] myNamespace_declarations =
                                        new String[] {
                                            "ns0", "http://www.agiledeveloper.com/types/Lifetime"
                                        };
    
    private static final QName[] understoodHeaderNames = new QName[] {  };
}
