Spectrum Technology Platform services can be made available as RESTful and SOAP web
services. To make a service available on your server as a web service:
Open Spectrum Enterprise Designer.
Open the service that you want to expose as a web service.
Go to Edit > Web Service Options.
To make the service available as a SOAP web service, check the box
Expose as SOAP web service.
To make the service available as a REST web service, check the box
Expose as REST web service and complete these
steps.
If you want to override the default endpoint, specify the endpoint you
want to use in the Path field.
Specifying a path is optional. By default, a REST web service's
endpoint is:
If you want to use a different endpoint, the path you specify is
added after the service name. For example, if you specify
Americas/Shipping in the
Path field, your JSON endpoint would be
something like this:
You can use fields and options from the flow as variable names in
the path by clicking the Insert variable
drop-down menu and selecting the field or option you want to use.
The variable is represented in the path using the notation
${Option.Name} for
flow options and
${Data.Name} for flow
fields.
By default REST web services support the GET method and return data in
XML and JSON formats. You can define additional HTTP methods and output
formats by clicking Add to add a resource to the
web service.
When you add a resource, you can choose the HTTP method
(GET or POST). The
supported data formats are listed below. You may not have all these
formats available to you because some formats are only available if
you have certain modules installed on your Spectrum Technology Platform server.
XML
The default XML format. Use this format if you want to use
XML as the format for requests and responses, and there is
no specialized XML format for the kind of data you want to
process.
JSON
The default JSON format. Use this format if you want to use
JSON as the format for requests and responses, and there is
no specialized JSON format for the kind of data you want to
process.
GeoJSON
A specialized JSON format that is appropriate for services that handle geographic data.
Support is provided only for Geometry and for these native
platform types:
boolean
double
float
integer
bigdecimal
long
string
date
time
datetime
timespan
If you try to expose a flow with any other type, you
will not be able to specify GeoJSON (an error will appear at
design-time). Also, GeoJSON only allows a single geometry.
If the output contains multiple geometry fields, the system
will search for a field called "geometry" followed by a
field called "obj." If those fields do not exist, the first
geometry field will be selected.
Click OK.
The new resource is added to the web service.
Click OK when you are done configuring the web service
options.
Click the gray light bulb in the tool bar to expose the service.
When a flow is exposed the light bulb button in the Spectrum Enterprise Designer
tool bar indicates that the flow is exposed as shown here:
To verify that the service is now exposed as a web service, go to one of the
following URLs:
For REST:
http://server:port/rest
For SOAP:
http://server:port/soap
Where server is the name or IP address of your Spectrum Technology Platform server and port is the port used for HTTP
communication.