Exemplo n.º 1
0
        public virtual WsMessage CreateMeasurement(WsMessage request)
        {
            // Build request object
            CreateMeasurementDataContractSerializer reqDcs;

            reqDcs = new CreateMeasurementDataContractSerializer("CreateMeasurement", "http://tempuri.org/");
            CreateMeasurement req;

            req = ((CreateMeasurement)(reqDcs.ReadObject(request.Reader)));
            request.Reader.Dispose();
            request.Reader = null;

            // Create response object
            // Call service operation to process request and return response.
            CreateMeasurementResponse resp;

            resp = m_service.CreateMeasurement(req);

            // Create response header
            WsWsaHeader respHeader = new WsWsaHeader("http://tempuri.org/ISmartService/CreateMeasurementResponse", request.Header.MessageID, m_version.AnonymousUri, null, null, null);
            WsMessage   response   = new WsMessage(respHeader, resp, WsPrefix.Wsdp);

            // Create response serializer
            CreateMeasurementResponseDataContractSerializer respDcs;

            respDcs             = new CreateMeasurementResponseDataContractSerializer("CreateMeasurementResponse", "http://tempuri.org/");
            response.Serializer = respDcs;
            return(response);
        }
Exemplo n.º 2
0
        public virtual CreateMeasurementResponse CreateMeasurement(CreateMeasurement req)
        {
            // Create request header
            String action;

            action = "http://tempuri.org/ISmartService/CreateMeasurement";
            WsWsaHeader header;

            header = new WsWsaHeader(action, null, EndpointAddress, m_version.AnonymousUri, null, null);
            WsMessage request = new WsMessage(header, req, WsPrefix.None);

            // Create request serializer
            CreateMeasurementDataContractSerializer reqDcs;

            reqDcs             = new CreateMeasurementDataContractSerializer("CreateMeasurement", "http://tempuri.org/");
            request.Serializer = reqDcs;
            request.Method     = "CreateMeasurement";


            // Send service request
            m_requestChannel.Open();
            WsMessage response = m_requestChannel.Request(request);

            m_requestChannel.Close();

            // Process response
            CreateMeasurementResponseDataContractSerializer respDcs;

            respDcs = new CreateMeasurementResponseDataContractSerializer("CreateMeasurementResponse", "http://tempuri.org/");
            CreateMeasurementResponse resp;

            resp = ((CreateMeasurementResponse)(respDcs.ReadObject(response.Reader)));
            response.Reader.Dispose();
            response.Reader = null;
            return(resp);
        }