예제 #1
0
        /// <summary>
        /// It build connection request instance based on the service descriptor object
        /// </summary>
        /// <param name="service">Instance of IService</param>
        /// <returns>IConnectionRequest instance</returns>
	    public static IConnectionRequest PrepareConnectionRequest(IService service) 
        {

		    /*
		     * Resolve All Referring Resources
		     */
		    ServiceDescriptor serviceDescriptor = service.GetServiceDescriptor();
		    Connect.Model.ServiceDescriptor.Request request = serviceDescriptor.GetRequest(service.GetRequest());
		
		    String url = FormUrl(service);
		
		    IEnumerator<Connect.Model.ServiceDescriptor.Request.QueryParameter> queryParameters = FormQueryParameters(service);
		    IEnumerator<Connect.Model.ServiceDescriptor.Request.HeaderParameter> headerParameters = FormHeaderParameters(service);
		
		    byte[] dataStream = FormDataStream(service);
		
		    IConnectionRequest connectionRequest = new ConnectionRequest();
		    connectionRequest.SetUrl(url);
		    connectionRequest.SetProtocol(serviceDescriptor.GetProtocol());
		    connectionRequest.SetType(request.GetType());
		
		    while(queryParameters.MoveNext()) 
            {
			    connectionRequest.AddQueryParameter(queryParameters.Current);
		    }
		
		    while(headerParameters.MoveNext()) 
            {
			    connectionRequest.AddHeaderParameter(headerParameters.Current);
		    }

		    connectionRequest.SetDataStream(dataStream);

		    return connectionRequest;
	    }
예제 #2
0
        /// <summary>
        /// It build connection request instance based on the service descriptor object
        /// </summary>
        /// <param name="service">Instance of IService</param>
        /// <returns>IConnectionRequest instance</returns>
        public static IConnectionRequest PrepareConnectionRequest(IService service)
        {
            /*
             * Resolve All Referring Resources
             */
            ServiceDescriptor serviceDescriptor = service.GetServiceDescriptor();

            Connect.Model.ServiceDescriptor.Request request = serviceDescriptor.GetRequest(service.GetRequest());

            String url = FormUrl(service);

            IEnumerator <Connect.Model.ServiceDescriptor.Request.QueryParameter>  queryParameters  = FormQueryParameters(service);
            IEnumerator <Connect.Model.ServiceDescriptor.Request.HeaderParameter> headerParameters = FormHeaderParameters(service);

            byte[] dataStream = FormDataStream(service);

            IConnectionRequest connectionRequest = new ConnectionRequest();

            connectionRequest.SetUrl(url);
            connectionRequest.SetProtocol(serviceDescriptor.GetProtocol());
            connectionRequest.SetType(request.GetType());

            while (queryParameters.MoveNext())
            {
                connectionRequest.AddQueryParameter(queryParameters.Current);
            }

            while (headerParameters.MoveNext())
            {
                connectionRequest.AddHeaderParameter(headerParameters.Current);
            }

            connectionRequest.SetDataStream(dataStream);

            return(connectionRequest);
        }