// !DO NOT EDIT THIS FILE!
// This source file is generated by Oracle tools
// Contents may be subject to change
// For reporting problems, use the following
// Version = Oracle WebServices (10.1.3.3.0, build 070610.1800.23513)

package xqueryws.proxy.runtime;

import oracle.j2ee.ws.common.streaming.*;
import oracle.j2ee.ws.common.encoding.*;
import oracle.j2ee.ws.common.soap.SOAPEncodingConstants;
import oracle.j2ee.ws.common.encoding.literal.*;
import oracle.j2ee.ws.common.soap.streaming.*;
import oracle.j2ee.ws.common.soap.message.*;
import oracle.j2ee.ws.common.soap.SOAPVersion;
import oracle.j2ee.ws.common.soap.SOAPEnvelopeConstants;
import oracle.j2ee.ws.common.wsdl.document.schema.SchemaConstants;
import oracle.j2ee.ws.common.util.exception.JAXRPCExceptionBase;
import oracle.j2ee.ws.common.util.SoapWithAttachmentsUtil;
import javax.xml.namespace.QName;
import java.rmi.RemoteException;
import java.util.Iterator;
import java.lang.reflect.*;
import oracle.j2ee.ws.client.*;
import oracle.j2ee.ws.client.http.*;
import oracle.webservices.transport.*;
import oracle.webservices.*;
import oracle.webservices.attachments.*;
import javax.xml.rpc.handler.*;
import javax.xml.rpc.JAXRPCException;
import javax.xml.rpc.soap.SOAPFaultException;

public class ORAWSVBinding_Stub
    extends oracle.j2ee.ws.client.StubBase
    implements xqueryws.proxy.ORAWSVPortType {
    
    
    /*
     *  public constructor
     */
    public ORAWSVBinding_Stub(HandlerChain handlerChain) {
        super(handlerChain);
        _setProperty(ENDPOINT_ADDRESS_PROPERTY, "http://localhost:8080/orawsv");
        setSoapVersion(SOAPVersion.SOAP_11);
        setServiceName( new QName("http://xmlns.oracle.com/orawsv","ORAWSVService"));
        setPortName( new QName("http://xmlns.oracle.com/orawsv","ORAWSVPort"));
        setupConfig("xqueryws/proxy/runtime/ORAWSVBinding_Stub.xml");
    }
    
    /*
     *  implementation of XMLFromQuery
     */
    public javax.xml.soap.SOAPElement XMLFromQuery(xqueryws.proxy.Query body)
        throws java.rmi.RemoteException {
        
        StreamingSenderState _state = null;
        try {
            
            _state = _start(_handlerChain);
            if (_getProperty(ClientConstants.DIME_ENCODE_MESSAGES_WITH_ATTACHMENTS) != null) {
                _state.getMessageContext().getMessage().setProperty("DimeEncode",_getProperty(ClientConstants.DIME_ENCODE_MESSAGES_WITH_ATTACHMENTS));
            }
            
            InternalSOAPMessage _request = _state.getRequest();
            _request.setOperationCode(XMLFromQuery_OPCODE);
            _state.getMessageContext().setProperty("oracle.j2ee.ws.mgmt.interceptor.operation-qname",new QName("","XMLFromQuery"));
            
            
            SOAPBlockInfo _bodyBlock = new SOAPBlockInfo(ns1_XMLFromQuery_query_QNAME);
            _bodyBlock.setValue(body);
            _bodyBlock.setSerializer(myns1_query__Query_LiteralSerializer);
            _request.setBody(_bodyBlock);
            
            _state.getMessageContext().setProperty("http.soap.action", "http://localhost:8080/orawsv");
            
            _send((String) _getProperty(ENDPOINT_ADDRESS_PROPERTY), _state);
            
            javax.xml.soap.SOAPElement _result = null;
            Object _responseObj = _state.getResponse().getBody().getValue();
            if (_responseObj instanceof SOAPDeserializationState) {
                _result = (javax.xml.soap.SOAPElement)((SOAPDeserializationState) _responseObj).getInstance();
            } else {
                _result = (javax.xml.soap.SOAPElement)_responseObj;
            }
            
            return _result;
            
        } catch (RemoteException e) {
            // let this one through unchanged
            throw e;
        } catch (ClientTransportException e) {
            throw new RemoteException( "", e );
        } catch (JAXRPCException e) {
            throw e;
        } catch (Exception e) {
            if (e instanceof RuntimeException) {
                throw (RuntimeException)e;
            } else {
                throw new RemoteException(e.getMessage(), e);
            }
        }
    }
    
    
    /*
     *  this method deserializes the request/response structure in the body
     */
    protected void _readFirstBodyElement(XMLReader bodyReader, SOAPDeserializationContext deserializationContext, StreamingSenderState  state) throws Exception {
        int opcode = state.getRequest().getOperationCode();
        switch (opcode) {
            case XMLFromQuery_OPCODE:
                _deserialize_XMLFromQuery(bodyReader, deserializationContext, state);
                break;
            default:
                throw new SenderException("sender.response.unrecognizedOperation", Integer.toString(opcode));
        }
    }
    
    
    
    /*
     * This method deserializes the body of the XMLFromQuery operation.
     */
    private void _deserialize_XMLFromQuery(XMLReader bodyReader, SOAPDeserializationContext deserializationContext, StreamingSenderState state) throws Exception {
        try {
            Object mySOAPElementObj =
                ns1_queryOut_TYPE_QNAMEjavax$2e$xml$2e$soap$2e$SOAPElement_Serializer.deserialize(ns1_XMLFromQuery_queryOut_QNAME,
                    bodyReader, deserializationContext);
            
            SOAPBlockInfo bodyBlock = new SOAPBlockInfo(ns1_XMLFromQuery_queryOut_QNAME);
            bodyBlock.setValue(mySOAPElementObj);
            state.getResponse().setBody(bodyBlock);
        } catch (DeserializationException e) {
            throw e;
        }
    }
    
    
    
    
    public String _getEncodingStyle() {
        return SOAPEncodingConstants.getSOAPEncodingConstants(soapVersion).getURIEncoding();
    }
    
    public void _setEncodingStyle(String encodingStyle) {
        throw new UnsupportedOperationException("cannot set encoding style");
    }
    
    public ClientTransport getClientTransport() {
        return super._getTransport();
    }
    
    
    
    
    
    /*
     * 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;
    }
    
    /*
     * This method handles the case of an empty SOAP body.
     */
    protected void _handleEmptyBody(XMLReader reader, SOAPDeserializationContext deserializationContext, StreamingSenderState state) throws Exception {
    }
    
    public void _initialize(InternalTypeMappingRegistry registry) throws Exception {
        super._initialize(registry);
        myns1_query__Query_LiteralSerializer = (CombinedSerializer)registry.getSerializer("", xqueryws.proxy.Query.class, ns1_query_TYPE_QNAME);
        ns1_queryOut_TYPE_QNAMEjavax$2e$xml$2e$soap$2e$SOAPElement_Serializer = (CombinedSerializer)registry.getSerializer("", javax.xml.soap.SOAPElement.class, ns1_queryOut_TYPE_QNAME);
    }
    
    private static final QName _portName = new QName("http://xmlns.oracle.com/orawsv", "ORAWSVPort");
    private static final int XMLFromQuery_OPCODE = 0;
    private static final QName ns1_XMLFromQuery_query_QNAME = new QName("http://xmlns.oracle.com/orawsv", "query");
    private static final QName ns1_query_TYPE_QNAME = new QName("http://xmlns.oracle.com/orawsv", "query");
    private CombinedSerializer myns1_query__Query_LiteralSerializer;
    private static final QName ns1_XMLFromQuery_queryOut_QNAME = new QName("http://xmlns.oracle.com/orawsv", "queryOut");
    private static final QName ns1_queryOut_TYPE_QNAME = new QName("http://xmlns.oracle.com/orawsv", "queryOut");
    private CombinedSerializer ns1_queryOut_TYPE_QNAMEjavax$2e$xml$2e$soap$2e$SOAPElement_Serializer;
    private static final String[] myNamespace_declarations =
                                        new String[] {
                                            "ns0", "http://xmlns.oracle.com/orawsv"
                                        };
    
    private static final QName[] understoodHeaderNames = new QName[] {  };
    
}
