locked
Problem transmitting an object between 2 services RRS feed

  • Question

  •  

    Hi !

    I have a problem transmitting an object from a service called Sender to another called Receiver.

    the sender service creates an object from the class Robot and I want to send it. so I have written the following code in SenderTypes.cs:
     

    Code Snippet

    public class SendRobot : Update<SendRobotRequest, PortSet<DefaultReplaceResponseType, Fault>>

    {

    public SendRobot()

    {

    }

    public SendRobot(Robot Robot)

    : base(new SendRobotRequest(Robot))

    {

    }

    }

    [DataContract]

    public class SendRobotRequest

    {

    private Robot _robot;

    [DataMember(IsRequired=true)]

    public Robot robot

    {

    get { return _robot; }

    set { _robot = value; }

    }

    public SendRobotRequest()

    {

    }

    public SendRobotRequest(Robot Robot)

    {

    _robot = Robot;

    Console.WriteLine(_robot.ReturnName());

    }

    }

     

     

     

    but the problem is when I try to compile it, I receive this error:

     

    Der "C:\Microsoft Robotics Dev Studio 2008\bin\dssproxy.exe" /dll:"C:\Microsoft Robotics Dev Studio 2008\bin\sender.Y2008.M09.dll" /proxyprojectpath:"C:\Microsoft Robotics Dev Studio 2008\essai\sender\Proxy" /keyfile:"C:\Microsoft Robotics Dev Studio 2008\samples\mrisamples.snk"   /binpath:"." /referencepath:"C:\WINDOWS\assembly\GAC_MSIL\Microsoft.Ccr.Core\2.0.831.0__31bf3856ad364e35\ " /referencepath:"C:\WINDOWS\assembly\GAC_MSIL\Microsoft.Dss.Base\2.0.831.0__31bf3856ad364e35\ " /referencepath:"C:\WINDOWS\assembly\GAC_MSIL\Microsoft.Dss.Runtime\2.0.831.0__31bf3856ad364e35\ " /referencepath:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ " /referencepath:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ " /referencepath:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ "-Befehl wurde mit Code 10 beendet. 

     
    (sorry, German version of Visual C#)
     
    Do you have any idea about solving this error ?

     

    Jc !

    Thursday, September 4, 2008 4:42 PM

Answers

  • hi Bryan !

    thanks for your help,
    I have finally found the problem, the service namespace was wrong in the class declaration !

    thx

    Jc !
    Friday, September 5, 2008 1:53 PM

All replies

  • Jc

    I don't see a definition for the Robot type? Is your Robot type definition decorated with the [DataContract] attribute as well?

    Bryan
    Thursday, September 4, 2008 5:33 PM
  • Hi Bryan,

     

    Yes it is, you can see it here:

     

    Code Snippet

    using System;

    /* needed for attributes */

    using Microsoft.Dss.Core.Attributes;

    [DataContract]

    [DataMemberConstructor]

    public class Robot

    {

    /* first the private members */

    private Orientation mOrient;

    private Position mPosit;

    private string mName;

     

    /* then the public get/sets with datamember-attribut */

    [DataMember]

    public Orientation Orient

    {

    get { return mOrient; }

    set { mOrient = value; }

    }

    [DataMember]

    public Position Posit

    {

    get { return mPosit; }

    set { mPosit = value; }

    }

    [DataMember]

    public string Name

    {

    get { return mName; }

    set { mName = value; }

    }

     

    public Robot()

    {

    /* to avoid null-references */

    mOrient = new Orientation();

    mPosit = new Position();

    }

    }

    [DataContract]

    [DataMemberConstructor]

    public class Orientation

    {

    private float mPhi;

    private float mTheta;

    private float mPsi;

    [DataMember]

    public float Phi

    {

    get { return mPhi; }

    set { mPhi = value; }

    }

    [DataMember]

    public float Theta

    {

    get { return mTheta; }

    set { mTheta = value; }

    }

    [DataMember]

    public float Psi

    {

    get { return mPsi; }

    set { mPsi = value; }

    }

    }

     

    [DataContract]

    [DataMemberConstructor]

    public class Position

    {

    private float mX;

    private float mY;

    [DataMember]

    public float X

    {

    get { return mX; }

    set { mX = value; }

    }

    [DataMember]

    public float Y

    {

    get { return mY; }

    set { mY = value; }

    }

    }

     

    Did I declare it correctly ?

     

    thx for your help

     

    Jc !

     

     

    Friday, September 5, 2008 7:15 AM
  • Jc

    The definitions look good to me. Are they all defined in the same assembly? The assembly that contains the service definition? This has apparently been causing some issues too.

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3417314&SiteID=1




    On a side note.. in your Robot class default constructor you didn't create an empty string for your Name member? Based upon your comment in the code I believe you may have missed that.

    Bryan
    Friday, September 5, 2008 11:37 AM
  • hi Bryan !

    thanks for your help,
    I have finally found the problem, the service namespace was wrong in the class declaration !

    thx

    Jc !
    Friday, September 5, 2008 1:53 PM