// 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 InformationProviderIF__InformationProvider__Tie
    extends com.sun.xml.rpc.server.TieBase implements SerializerConstants {
    
    
    public InformationProviderIF__InformationProvider__Tie() throws Exception {
        super(new jaxrpc.generated.informationProvider.InformationProvider_SerializerRegistry().getRegistry());
        initialize(internalTypeMappingRegistry);
    }
    
    /*
     * This method does the actual method invocation for operation: getFullName
     */
    private void invoke_getFullName(StreamingHandlerState state) throws Exception {
        
        com.agiledeveloper.ws.InformationProviderIF_getFullName_RequestStruct myInformationProviderIF_getFullName_RequestStruct = null;
        Object myInformationProviderIF_getFullName_RequestStructObj =
            state.getRequest().getBody().getValue();
        
        if (myInformationProviderIF_getFullName_RequestStructObj instanceof SOAPDeserializationState) {
            myInformationProviderIF_getFullName_RequestStruct = (com.agiledeveloper.ws.InformationProviderIF_getFullName_RequestStruct)((SOAPDeserializationState)myInformationProviderIF_getFullName_RequestStructObj).getInstance();
        } else {
            myInformationProviderIF_getFullName_RequestStruct = (com.agiledeveloper.ws.InformationProviderIF_getFullName_RequestStruct)myInformationProviderIF_getFullName_RequestStructObj;
        }
        
        try {
            java.lang.String result = 
                ((com.agiledeveloper.ws.InformationProviderIF) getTarget()).getFullName(myInformationProviderIF_getFullName_RequestStruct.getString_1());
            com.agiledeveloper.ws.InformationProviderIF_getFullName_ResponseStruct myInformationProviderIF_getFullName_ResponseStruct =
                new com.agiledeveloper.ws.InformationProviderIF_getFullName_ResponseStruct();
            SOAPHeaderBlockInfo headerInfo;
            myInformationProviderIF_getFullName_ResponseStruct.setResult(result);
            
            SOAPBlockInfo bodyBlock = new SOAPBlockInfo(ns1_getFullName_getFullNameResponse_QNAME);
            bodyBlock.setValue(myInformationProviderIF_getFullName_ResponseStruct);
            bodyBlock.setSerializer(ns2_myInformationProviderIF_getFullName_ResponseStruct__InformationProvider__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 does the actual method invocation for operation: getRecord
     */
    private void invoke_getRecord(StreamingHandlerState state) throws Exception {
        
        com.agiledeveloper.ws.InformationProviderIF_getRecord_RequestStruct myInformationProviderIF_getRecord_RequestStruct = null;
        Object myInformationProviderIF_getRecord_RequestStructObj =
            state.getRequest().getBody().getValue();
        
        if (myInformationProviderIF_getRecord_RequestStructObj instanceof SOAPDeserializationState) {
            myInformationProviderIF_getRecord_RequestStruct = (com.agiledeveloper.ws.InformationProviderIF_getRecord_RequestStruct)((SOAPDeserializationState)myInformationProviderIF_getRecord_RequestStructObj).getInstance();
        } else {
            myInformationProviderIF_getRecord_RequestStruct = (com.agiledeveloper.ws.InformationProviderIF_getRecord_RequestStruct)myInformationProviderIF_getRecord_RequestStructObj;
        }
        
        try {
            java.lang.String result = 
                ((com.agiledeveloper.ws.InformationProviderIF) getTarget()).getRecord(myInformationProviderIF_getRecord_RequestStruct.getString_1());
            com.agiledeveloper.ws.InformationProviderIF_getRecord_ResponseStruct myInformationProviderIF_getRecord_ResponseStruct =
                new com.agiledeveloper.ws.InformationProviderIF_getRecord_ResponseStruct();
            SOAPHeaderBlockInfo headerInfo;
            myInformationProviderIF_getRecord_ResponseStruct.setResult(result);
            
            SOAPBlockInfo bodyBlock = new SOAPBlockInfo(ns1_getRecord_getRecordResponse_QNAME);
            bodyBlock.setValue(myInformationProviderIF_getRecord_ResponseStruct);
            bodyBlock.setSerializer(ns2_myInformationProviderIF_getRecord_ResponseStruct__InformationProvider__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_getFullName_getFullName_QNAME)) {
            state.getRequest().setOperationCode(getFullName_OPCODE);
        }
        else if (bodyReader.getName().equals(ns1_getRecord_getRecord_QNAME)) {
            state.getRequest().setOperationCode(getRecord_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 getFullName_OPCODE:
                deserialize_getFullName(bodyReader, deserializationContext, state);
                break;
            case getRecord_OPCODE:
                deserialize_getRecord(bodyReader, deserializationContext, state);
                break;
            default:
                throw new SOAPProtocolViolationException("soap.operation.unrecognized", Integer.toString(opcode));
        }
    }
    
    
    
    /*
     * This method deserializes the body of the getFullName operation.
     */
    private void deserialize_getFullName(XMLReader bodyReader, SOAPDeserializationContext deserializationContext, StreamingHandlerState state) throws Exception {
        Object myInformationProviderIF_getFullName_RequestStructObj =
            ns2_myInformationProviderIF_getFullName_RequestStruct__InformationProvider__SOAPSerializer.deserialize(ns1_getFullName_getFullName_QNAME,
                bodyReader, deserializationContext);
        
        SOAPBlockInfo bodyBlock = new SOAPBlockInfo(ns1_getFullName_getFullName_QNAME);
        bodyBlock.setValue(myInformationProviderIF_getFullName_RequestStructObj);
        state.getRequest().setBody(bodyBlock);
    }
    
    /*
     * This method deserializes the body of the getRecord operation.
     */
    private void deserialize_getRecord(XMLReader bodyReader, SOAPDeserializationContext deserializationContext, StreamingHandlerState state) throws Exception {
        Object myInformationProviderIF_getRecord_RequestStructObj =
            ns2_myInformationProviderIF_getRecord_RequestStruct__InformationProvider__SOAPSerializer.deserialize(ns1_getRecord_getRecord_QNAME,
                bodyReader, deserializationContext);
        
        SOAPBlockInfo bodyBlock = new SOAPBlockInfo(ns1_getRecord_getRecord_QNAME);
        bodyBlock.setValue(myInformationProviderIF_getRecord_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 getFullName_OPCODE:
                invoke_getFullName(state);
                break;
            case getRecord_OPCODE:
                invoke_getRecord(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_getFullName_getFullName_QNAME)) {
            return getFullName_OPCODE;
        }
        if (name.equals(ns1_getRecord_getRecord_QNAME)) {
            return getRecord_OPCODE;
        }
        return super.getOpcodeForFirstBodyElementName(name);
    }
    
    
    private Method internalGetMethodForOpcode(int opcode) throws ClassNotFoundException, NoSuchMethodException {
        
        Method theMethod = null;
        
        switch(opcode) {
            case getFullName_OPCODE:
                {
                    Class[] carray = { java.lang.String.class };
                    theMethod = (com.agiledeveloper.ws.InformationProviderIF.class).getMethod("getFullName", carray);
                }
                break;
            
            case getRecord_OPCODE:
                {
                    Class[] carray = { java.lang.String.class };
                    theMethod = (com.agiledeveloper.ws.InformationProviderIF.class).getMethod("getRecord", carray);
                }
                break;
            
            default:
        }
        return theMethod;
    }
    
    private Method[] methodMap = new Method[2];
    
    /*
     * 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 >= 2 ) {
            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_myInformationProviderIF_getRecord_RequestStruct__InformationProvider__SOAPSerializer = (CombinedSerializer)registry.getSerializer(SOAPConstants.NS_SOAP_ENCODING, com.agiledeveloper.ws.InformationProviderIF_getRecord_RequestStruct.class, ns2_getRecord_TYPE_QNAME);
        ns2_myInformationProviderIF_getFullName_ResponseStruct__InformationProvider__SOAPSerializer = (CombinedSerializer)registry.getSerializer(SOAPConstants.NS_SOAP_ENCODING, com.agiledeveloper.ws.InformationProviderIF_getFullName_ResponseStruct.class, ns2_getFullNameResponse_TYPE_QNAME);
        ns2_myInformationProviderIF_getFullName_RequestStruct__InformationProvider__SOAPSerializer = (CombinedSerializer)registry.getSerializer(SOAPConstants.NS_SOAP_ENCODING, com.agiledeveloper.ws.InformationProviderIF_getFullName_RequestStruct.class, ns2_getFullName_TYPE_QNAME);
        ns2_myInformationProviderIF_getRecord_ResponseStruct__InformationProvider__SOAPSerializer = (CombinedSerializer)registry.getSerializer(SOAPConstants.NS_SOAP_ENCODING, com.agiledeveloper.ws.InformationProviderIF_getRecord_ResponseStruct.class, ns2_getRecordResponse_TYPE_QNAME);
    }
    
    private static final QName portName = new QName("http://www.agiledeveloper.com/wsdl/InformationProvider", "InformationProviderIF");
    private static final int getFullName_OPCODE = 0;
    private static final int getRecord_OPCODE = 1;
    private static final QName ns1_getFullName_getFullName_QNAME = new QName("http://www.agiledeveloper.com/wsdl/InformationProvider", "getFullName");
    private static final QName ns2_getFullName_TYPE_QNAME = new QName("http://www.agiledeveloper.com/types/InformationProvider", "getFullName");
    private CombinedSerializer ns2_myInformationProviderIF_getFullName_RequestStruct__InformationProvider__SOAPSerializer;
    private static final QName ns1_getFullName_getFullNameResponse_QNAME = new QName("http://www.agiledeveloper.com/wsdl/InformationProvider", "getFullNameResponse");
    private static final QName ns2_getFullNameResponse_TYPE_QNAME = new QName("http://www.agiledeveloper.com/types/InformationProvider", "getFullNameResponse");
    private CombinedSerializer ns2_myInformationProviderIF_getFullName_ResponseStruct__InformationProvider__SOAPSerializer;
    private static final QName ns1_getRecord_getRecord_QNAME = new QName("http://www.agiledeveloper.com/wsdl/InformationProvider", "getRecord");
    private static final QName ns2_getRecord_TYPE_QNAME = new QName("http://www.agiledeveloper.com/types/InformationProvider", "getRecord");
    private CombinedSerializer ns2_myInformationProviderIF_getRecord_RequestStruct__InformationProvider__SOAPSerializer;
    private static final QName ns1_getRecord_getRecordResponse_QNAME = new QName("http://www.agiledeveloper.com/wsdl/InformationProvider", "getRecordResponse");
    private static final QName ns2_getRecordResponse_TYPE_QNAME = new QName("http://www.agiledeveloper.com/types/InformationProvider", "getRecordResponse");
    private CombinedSerializer ns2_myInformationProviderIF_getRecord_ResponseStruct__InformationProvider__SOAPSerializer;
    private static final String[] myNamespace_declarations =
                                        new String[] {
                                            "ns0", "http://www.agiledeveloper.com/types/InformationProvider"
                                        };
    
    private static final QName[] understoodHeaderNames = new QName[] {  };
}
