keskiviikko 10. huhtikuuta 2013

Tutorial 1 Part 24 - create XML



Adding service interface - start with XML Schema
We’ll be creating two interfaces to our geo service – one that is web services based and another one that is file based.
We’ll start by creating a web service interface that is handy for testing purposes.
Start by creating the xml schema for the new service. For the GeoFence Event we need the following elements:
·         ObjectId (xsd:string)
·         AssetId (xsd:string)
·         LocationId (xsd:string)
·         EventTime (xsd:datetime)
·         EventClass (xsd:string)
·         EventSeverity (xsd:string)
·         EventText (xsd:string)

Make sure you create it into xsd folder.





Rename the example element into geoFenceRequest




Add sequence to it and add the element inside the sequence. You can add the sequence by dragging and dropping the sequence on top of the element.

Add elements inside the sequence either by dragging and dropping or via the popup menus.




Next we’ll do the response part. We send in a single element but there could be multiple actions as a result. Hence we should actually return a list of return values for each action.
We can do this with a little bit different mechanism. First we create a complex type that consists of:
-          Action (what script we executed)
-          Result code
-          Result text (we’ll leave this empty for this sample program)
And we finally define an element as a sequence of element of this type.
Start by defining a complex type called geoFenceResponseType.
-          Drag and drop the ComplexType elemen to the canvas.
-          Add sequence to it
-          Add elements Action (xsd:string), ResultCode (xsd:integer) and ResultText ( xsd:string) to it
-          Add an element called geoFenceResponse.
-          Set the type of the geoFenceResponse to the geoFenceResponseType

Finally add  a fault element: geoFenceFault and add one element to it: faultCode (xsd:integer). Now we have completed our xml schema definition.


Ei kommentteja:

Lähetä kommentti