locked
Error accessing DssOperation.ResponsePort.P0 in DSS service handler RRS feed

  • Question

  • Hi All,

    I have a DssOperation which has a ResponsePort of type PortSet<DefaultSubmitResponseType, Fault>. In the service handler for the DssOperation, I am trying to access the individual ports of the ResponsePort. I am trying to do a message.ResponsePort.P0 and message.ResponsePort.P1 and try to get the individual DefaultSubmitResponseType and Fault ports. However, I am getting a System.InvalidOperationException that says "Operation is not valid due to the current state of the object". Please help me understand why this is happening.

    Thanks,

    Venkat




    Sunday, June 17, 2012 3:39 AM
    Moderator

Answers

All replies

  • Hi Venkat,

    Could you post your code? Might be easier to understand the issue you're encountering if we can take a look at it.

    Thanks!

    Art

    Friday, June 22, 2012 4:55 PM
    Moderator
  • Hi Art,

    Thank you for your reply. Please find a sample piece of code below

    [ServiceHandler(ServiceHandlerBehavior.Exclusive)]
    public void CreateComponentHandler(CreateComponent createComponent)
    {
        var successPort = createComponent.ResponsePort.P0;
    }
    
    [DataContract]
    public class CreateComponent : Submit<CreateComponentRequest, PortSet<DefaultSubmitResponseType, Fault>>
    
    {
    }
    
    [DataContract]
    public class CreateComponentRequest
    {
    }

    When I access "createComponent.ResponsePort.P0" (which is basically Port<DefaultSubmitResponseType>) in the service handler, I am getting a System.InvalidOperationException that says "Operation is not valid due to the current state of the object". Can you please help me understand why this is happening.

    Thanks,

    Venkat


    Friday, June 22, 2012 8:49 PM
    Moderator
  • Hi All,

    I was wondering if anyone had the opportunity to look at this.

    Thanks,

    Venkat

    Tuesday, June 26, 2012 9:12 PM
    Moderator
  • Hi Venkat,

    Apologies--just haven't had a chance to look further at this this week. One question: instead of referencing the port directly, if you implicitly post a DefaultSubmitResponseType to the port using ResponsePort, does it work? 

    EG: createComponent.ResponsePort.Post(DefaultSubmitResponseType.Instance);

    Art

    Friday, June 29, 2012 9:45 PM
    Moderator
  • Hi Art,

    Thank you for taking time and responding. Yes. if I post a message like "createComponent.ResponsePort.Post(DefaultSubmitResponseType.Instance);", it works perfectly. However, for some design of ours, we would like to get hold of the individual response ports EG: "createComponent.ResponsePort.P0" and when I try to do that, it is giving the exception that I had mentioned in my earlier post. Please help me understand.

    Thanks,

    Venkat

    Friday, June 29, 2012 11:38 PM
    Moderator
  • Hi Venkat,

    I tested this out using the \samples\ServiceTutorials\Tutorial2\CSharp as a starting point (it's a simple service that posts to itself), and in the "IncrementTickHandler" I created a reference to P0 (the success port), just as you have above, and was able to successfully grab it and post to it.

    Something else must be going on in your particular service...perhaps if you post more complete code, we could look further?

    Art

    Monday, July 2, 2012 9:08 PM
    Moderator
  • Hi Arthur,

    Thank you for your reply. My scenario is an external hosting client posting to a remote DSS service using the proxy of the DSS remote service. Please find the piece of code below.

                DssEnvironment.Initialize(4000, 4001);
                var responsePort = CreateService("remotehostname", 50001, 
                    "http://schemas.tempuri.org/2012/06/filecomponentservice.html",
                    50000);
                Fault faultResponse = null;
                dssp.CreateResponse createResponse = WaitForResponse<dssp.CreateResponse>(responsePort, 
                    out faultResponse);
                var operations = DssEnvironment.ServiceForwarder<FileComponentServiceOperations>(
                    new Uri(createResponse.Service));
                operations.CreateComponent();

    There is a dsshost running at the "remotehost" at tcp port 50001 and http port 50000. CreateService method creates a new instance of the DSS service at that remote host and port. WaitForResponse blocks the current thread until a create service response is received. FileComponentServiceOperations is the operations port that has exposes the CreateComponent message. And finally I post a message to FileComponentServiceOperations.

    Thanks,

    Venkat



    Tuesday, July 3, 2012 8:12 AM
    Moderator
  • Hi Arthur,

    I was wondering if you had an opportunity to look this. Also, please let me know if you need any further information.

    Thanks,

    Venkat

    Monday, July 9, 2012 7:26 PM
    Moderator
  • Hi Venkat--I'm afraid you're reaching well outside my area of knowledge on RDS--I've never tried hosting DSS in an external client (although I'd like to experiment with it!).

    Hopefully someone here on the forum with more expertise can chime in...

    Art

    Monday, July 9, 2012 8:39 PM
    Moderator
  • I am very sorry for the trouble Arthur. I too hope someone who has expertise in external hosting will help me.
    Monday, July 9, 2012 9:29 PM
    Moderator
  • Venkat,

    It is not immediatly clear to me why this is not working.  I don't know if the individual resonse ports are supposed to be usable in the way you describe.

    That error is not comming from CCR or DSS, it is a .NET runtime error.  Searching on the web for that error shows me it can have a lot of causes...  everything from how an http connection is configured to COM interop issues.

    You say, "for some design of ours, we would like to get hold of the individual response ports ". Is that really a requirement?  Why? Perhaps there is another way to solve the problem.

    Also, can you debug the application and view the complete exception and stack trace.  That might be helpful.

    Gershon

    Tuesday, July 10, 2012 9:41 PM
  • Hi Gershon,

    Thank you for the reply and time. I will look at the complete and stack trace and put it in the forum soon.

    As per our design, we want to pass around the individual response ports to other parts of the code so that they can post to it and there will be a receiver waiting for it. There is a way around this using the DSS subscription service or perhaps passing the entire Porset around. However, I have not tried them yet. I will get back on these.

    Thanks,

    Venkat

    Friday, July 13, 2012 8:41 AM
    Moderator
  • Definitely sounds to me like you want to follow the built-in partner/subscription model.
    Friday, July 13, 2012 11:40 PM