Example name: Complex argument
Description: This example shows:
  • A C# server-side class method, BasicCalcServer.Add(), accepting a parameter of complex type SumRequest, and
  • A Flex client invoking the Add() method remotely, using an Object instance with dynamic properties as an argument to Add(), as if the instance were an object of type SumRequest.
Prerequisites:
  • none.
Client-side code: Browse  Download
Server-side code: Browse  Download
Feature availability:
  • WebORB for .NET Development Mode
  • WebORB for .NET Community Edition
  • WebORB for .NET Enterprise Edition
Run example:
Key points:
  • WebORB can map an Object to a complex data type, if:
    • The names of the Object's dynamic properties match the complex data type's public properties, and
    • The types of these properties either match, or WebORB can map from the Object's property's type to target property's type.
  • This approach to argument-passing is not recommended; however, it can be useful in certain situations.
  • The recommended approach is shown in the sample "Using Data Transfer Objects" (TBD).
Things to try:
  • Edit the source code of the client to name the sumRequest's properties differently, and/or to give them inappropriate values.
  • Notice that no complier warnings result from these changes.
  • See how far you can push these changes before the remote call to Add() fails.
  • Do you miss compile-time type-checking yet?
  • Do you wonder how you might get such type-checking across the client-server boundary?
See also:
Errata:
  • None yet known.