locked
The Usage of Dss.Services.Serializer.Deserialize RRS feed

  • Question

  •  

    Hi, I am trying to write some web service wrapper for the DSS service.  To do that, I first need to manually deserialize an XML message into DSS state object. Just by browsering the API document, I guess Dss.Services.Serializer.Deserialize is the right one for that. I wrote the below code just by guessing,

     

    Code Snippet

    Microsoft.Dss.Services.Serializer.Deserialize<st1.GetPriceRequest> deser = new Microsoft.Dss.Services.Serializer.Deserialize<st1.GetPriceRequest>("<GetPriceRequest xmlns=\"http://schemas.tempuri.org/2006/06/servicetutorial1.html\"><StockName>IBM</StockName></GetPriceRequest>");

     

    st1.GetPriceRequest req = null;

    DssEnvironment.LogInfo("Going to wait the serialization result");

    yield return Arbiter.Choice(deser.ResultPort,

    delegate(st1.GetPriceRequest success)

    {

      DssEnvironment.LogInfo("Deserialization OK");

      req = success;

    },

    delegate(Exception e)

    {

      DssEnvironment.LogError("Could not deserialize the XML : " + e);

    });

     

     

    However the program is stuck at the receiving the message (neither the result or excpetion is posted).

    So I wonder if it is right way to use the Deserialize?  Appreciate any hint.

     

    BTW, the XML.Serialization.XmlSerializer  works in this case,

     

    thanks

     

    Wei

     

     

    Wednesday, February 13, 2008 11:23 PM

Answers

  • If this is the case, then just use the CLR XmlSerializer class to deserialize your type.

     

    Thursday, February 14, 2008 8:54 PM

All replies

  • The program is stuck because you never issued the message to the serializer service. YOu must Post it to the DsspServiceBase.SerializerPort

    Thursday, February 14, 2008 12:11 PM
  • But my problem is the code is running at the client side , not in a DSS service;  so is there anyway to access the SerializerPort (or SerilizerService) from the client side by using DssEnviroment?

     

    thanks

     

    wei

    Thursday, February 14, 2008 7:30 PM
  • If this is the case, then just use the CLR XmlSerializer class to deserialize your type.

     

    Thursday, February 14, 2008 8:54 PM