Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

How to define a new operation on an object
xomega
#1 Posted : Thursday, August 23, 2012 6:37:08 PM(UTC)
xomega



To define your service model Xomega allows you to easily turn an object definition into a service by adding operations to it. If the operation parameters' names match the object field names then their type and the required flag can be derived from the corresponding object field, so you won't have to specify them for such parameters.

Xomega allows you to quickly define standard Create, Read, Update, Delete and Read List operations for any object by generating them from the object fields. You can then use them as is or tailor them for your own needs. Alternatively, you can define a new operation from scratch. Here are the steps to accomplish this.
  1. Add the operations group element after the fields group element of the object if it does not exist.
  2. Add an operation element to the operations group element. Give it a unique name within the object by setting the name attribute.
  3. If the operation accepts an input structure then add an input element to the operation element. If it accepts a list of structures then set the list attribute to true.
  4. If the operation returns an output structure then add an output element to the operation element. If it returns a list of structures then set the list attribute to true.
  5. Describe the input and output structures of the operation either inline as nested elements or by referencing existing standalone structures defined in the model.
  6. Configure custom WCF attributes for the operation as needed inside the config element added to the operation.
  7. Describe the operation by adding the doc > summary element to the operation element.
  8. Generate the WCF Service Contracts and review the generated classes. If they are not satisfactory, make the necessary updates following the steps above and repeat the process.

Here's a sample XML that illustrates these steps.
Code:
<operations>
  <operation name="search flights">
    <input>
      <param name="airlines" type="" list="true"/>
      <struct name="origin" ref="location struct"/>
      <struct name="destination" ref="location struct"/>
    </input>
    <output list="true">
      <param name="flight" type="flight number" required="true"/>
      <param name="origin" type="airport code"/>
      <param name="destination" type="airport code"/>
      <param name="departure" type="time"/>
      <param name="schedule" type="day of week" list="true"/>
    </output>
  </operation>
</operations>
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Copyright © 2009-2022 Xomega.Net. All rights reserved.