Example #1
0
        /// <summary>
        /// one-way call to resample an image volume
        /// </summary>
        /// <param name="seriesInstanceUID"></param>
        public void ResampleImageVolume(ImageVolumeResampleRequest request)
        {
            _responseContext =
                OperationContext.Current.IncomingMessageHeaders.GetHeader<ResponseContext>(
                    "ResponseContext", "ServiceModelEx");
            _responseAddress =
                new EndpointAddress(_responseContext.ResponseAddress);

            ResampleEngineClient re = new ResampleEngineClient();

            ImageVolumeResampleResponse response = re.ResampleImageVolume(request);
            System.Diagnostics.Trace.Assert(response.ResampledImageVolumeGuid.CompareTo(Guid.Empty) != 0);

            MessageHeader<ResponseContext> responseHeader = new MessageHeader<ResponseContext>(_responseContext);
            NetMsmqBinding binding = new NetMsmqBinding("NoMsmqSecurity");
            ResampleResponseProxy proxy = new ResampleResponseProxy(binding, _responseAddress);

            using (OperationContextScope scope = new OperationContextScope(proxy.InnerChannel))
            {
                OperationContext.Current.OutgoingMessageHeaders.Add(
                    responseHeader.GetUntypedHeader("ResponseContext", "ServiceModelEx"));

                proxy.OnResampleDone(response);
            }

            proxy.Close();
        }
Example #2
0
        /// <summary>
        /// begin meshing for a particular structure
        /// </summary>
        /// <param name="request"></param>
        public void MeshStructure(MeshingRequest request)
        {
            // store the return address
            _responseContext =
                OperationContext.Current.IncomingMessageHeaders.GetHeader<ResponseContext>(
                    "ResponseContext", "ServiceModelEx");
            _responseAddress =
                new EndpointAddress(_responseContext.ResponseAddress);

            // notify that we are performing a meshing
            System.Diagnostics.Trace.WriteLine(
                string.Format("Meshing for structure {0} ({1} contours)",
                    request.StructureGuid,
                    request.ContourGuids != null 
                        ? request.ContourGuids.Count.ToString() : "?"));

            // create the engine
            MeshingEngineClient meshingEngine = new MeshingEngineClient();

            // synchronous call to perform meshing
            MeshingResponse response = meshingEngine.MeshStructure(request);
            meshingEngine.Close();

            // now construct the response proxy based on the return address
            MessageHeader<ResponseContext> responseHeader = new MessageHeader<ResponseContext>(_responseContext);
            NetMsmqBinding binding = new NetMsmqBinding("NoMsmqSecurity");
            MeshingResponseProxy proxy = new MeshingResponseProxy(binding, _responseAddress);

            // and set up the operation context to relay response info
            using (OperationContextScope scope = new OperationContextScope(proxy.InnerChannel))
            {
                OperationContext.Current.OutgoingMessageHeaders.Add(
                    responseHeader.GetUntypedHeader("ResponseContext", "ServiceModelEx"));

                // send the response
                proxy.OnMeshingDone(response);
            }

            proxy.Close();
        }
Example #3
0
 public ResponseContext(ResponseContext responseContext)
     : this(responseContext.ResponseAddress,responseContext.MethodId,responseContext.FaultAddress)
 {
 }
Example #4
0
 public ResponseContext(ResponseContext responseContext) : this(responseContext.ResponseAddress, responseContext.MethodId, responseContext.FaultAddress)
 {
 }