The following technique is useful if you're not familiar with creating schemas. It can be used if you're building a quick test model and you need to schema type an XML variable.
It is also useful in a provider when you have a method that returns XML. The Service Operation builder requires that it's results be schema typed. Since a method does not schema type its return value, you must create a schema to describe the XML that the method will return.
- Create a new empty model.
- Add a Service Definition builder to the model.
- In the Service Definition builder, specify a name. In the testing support section, check off "Add Testing Support".
- Add an XML variable to the model with some dummy data that matches the structure you want.
- Add a Simple Schema Generator builder.
- In the Simple Schema Generator builder, specify a name. This becomes the name of the schema, so make sure it is unique.
- In the sample data field, select your XML variable.
- Check off "Modify Variable" to cause the variable to be schema typed automatically.
- Modify the URI so that it is unique. The default is http://wpf.ibm.com/2002/10/generatedschema You can make the URI unique by changing generatedschema to another name such as "myTestSchema" So the URI becomes
- Apply the changes.
- Check the WebApp Tree to confirm that your new schema was added.
- Add a method builder to the model that simply returns your XML variable.
- Add a Service Operation builder.
- In the Service Operation builder, select the Data Service. Specify an operation name. For the "Action to Call", pick the method you created.
- In the Service Operation builder under "Operation Inputs", select the radio button for "No Inputs".
- In the Service Operation builder under "Operation Results", select the radio button for "Specify result schema".
- In the Result Schema field, pick the schema you created and expand it. Then expand the elements. Pick the top level element for your variable.
- Apply the changes to the Service Operation builder.
- Save the model.
To test things out, run the model.
There should be a link displayed for your operation.
Click the link. This will display your XML using the schema you created.
A sample model is attached.