locked
Specifying TimeSpan in the DSS operation proxy method RRS feed

  • Question

  • Hi All,

    I need to set a  TimeSpan for DSS operations when calling the operations using it's equivalent proxy method in the service proxy. What I am trying to do is explained in detail below using an example.

    Assume, I have an operation TestOperationB in a service DssRemoteServer as follows

    public class TestOperationB : Update<TestOperationBRequest, PortSet<DefaultUpdateResponseType, Fault>>
    {
    }
    
    [DataContract]
    public class TestOperationBRequest
    {
        [DataMember]
        [DataMemberConstructor]
        public int Argument;
    }

    I want to call the above operation from a service DssTestClient and specify the time out for the operation. I am able to do so when I create a message of type TestOperationB and put an object of TestOperationBRequest in its body and specify the TimeSpan in the TestOperationB object and calling Post with the TestOperationB object in the operations port of DssRemoteServer. I confirmed this by making the handler for TestOperationB sleep for seconds and setting the timeout in milliseconds. However, when I tried to do the same with the proxy method for TestOperationB as follows, the message is not timing out and is waiting for the service to send the response.

    TestOperationBRequest operationBRequest = new TestOperationBRequest(10000);
    TestOperationB operationB = new TestOperationB(operationBRequest);
    operationB.TimeSpan = TimeSpan.FromMilliseconds(100);
    yield return mRemoteServerPort.TestOperationB(operationBRequest, out operationB);
    DefaultUpdateResponseType response = operationB.ResponsePort;
    if (response == null)
    {
        Console.WriteLine("No Response");
    }

    Can you please let me know what I am doing wrong.

    Thanks,

    Venkat


    Wednesday, February 1, 2012 7:46 PM
    Moderator

Answers

  • That's not the correct way to do it - the [out] parameter is ignoring what you have set. If you want to set the timeout explicitly, replace

    operationB.TimeSpan = TimeSpan.FromMilliseconds(100);
    yield return mRemoteServerPort.TestOperationB(operationBRequest, out operationB);
    DefaultUpdateResponseType response = operationB.ResponsePort;

    with

    operationB.TimeSpan = TimeSpan.FromMilliseconds(100);
    mRemoteServerPort.Post(operationB);
    yield return operationB.ResponsePort.Choice();
    DefaultUpdateResponseType response = operationB.ResponsePort;

    • Proposed as answer by gunnnModerator Friday, February 17, 2012 10:43 PM
    • Marked as answer by Venk KModerator Thursday, February 23, 2012 11:02 PM
    Friday, February 17, 2012 10:43 PM
    Moderator

All replies

  • That's not the correct way to do it - the [out] parameter is ignoring what you have set. If you want to set the timeout explicitly, replace

    operationB.TimeSpan = TimeSpan.FromMilliseconds(100);
    yield return mRemoteServerPort.TestOperationB(operationBRequest, out operationB);
    DefaultUpdateResponseType response = operationB.ResponsePort;

    with

    operationB.TimeSpan = TimeSpan.FromMilliseconds(100);
    mRemoteServerPort.Post(operationB);
    yield return operationB.ResponsePort.Choice();
    DefaultUpdateResponseType response = operationB.ResponsePort;

    • Proposed as answer by gunnnModerator Friday, February 17, 2012 10:43 PM
    • Marked as answer by Venk KModerator Thursday, February 23, 2012 11:02 PM
    Friday, February 17, 2012 10:43 PM
    Moderator
  • Hi gunnn,

    Thanks for your time and reply. I did mention in my post that if I do the way that you have said (posting the message in the TestOperationB port), the timeout works. However, I wanted to see if I can do the timeout by calling the TestOperationB method directly but from what you clarified, that  is not the right way to achieve the timeout.

    I appreciate your help

    Venkat

    Thursday, February 23, 2012 11:07 PM
    Moderator