none
Passing object to service. RRS feed

  • Question

  • I have an class defined in my service that I want to create an instance of in my client and then pass to the service through a method call.

    I can create an instance of the class but I don't seem to be able to pass any parameters to the constructor.

    i.e.

    serviceReference.sampleClass  instance= new serviceReference.sampleClass(param1, param2);

    serviceReference.callMethod(instance);

    So I referenced the dll where the class is defined and thought that I could cast it to the correct type

    i.e.

    sampleClass instance = new sampleClass(param1, param2);

    serviceReference.callMethod((instance)as serviceReference.sampleClass);

    but I get this error:

    Cannot convert type xxx to yyy via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion

    Any ideas how I can solve this?

    Thanks in advance.

    Wednesday, November 20, 2013 5:23 PM

Answers

All replies