The Web Service EventHandler exposes MI AssemblyLines as web services.
All
AssemblyLines exposed as web services from the EventHandler are described in a
WSDL document. The EventHandler reads this document and searches for
these AssemblyLines in the current MI configuration.
Object and transport protocols supported so far
are SOAP and HTTP. Thus any SOAP/HTTP client from the Internet can invoke
a MI AssemblyLine and obtain its result.
If you are not familiar with WSDL and its terms, you can find its specification at http://www.w3.org/TR/wsdl.
The data types supported by the EventHandler are a subset of the standard XML Schema built-in datatypes. That is
why every type is prefixed with "xsd", where the "xsd" prefix is associated with the standard XML Schema URI of
"http://www.w3.org/2001/XMLSchema".
For a complete description of XML Schema datatypes see XML Schema
Part 2: Datatypes . The Web Service EventHandler currently supports the following XML Schema
built-in (xsd) data types (the "Java Type" column contains the Java class to which the corresponding XSD Type maps):
XSD Type |
Java Type |
---|---|
xsd:string | java.lang.String |
xsd:boolean | java.lang.Boolean |
xsd:byte | java.lang.Byte |
xsd:short | java.lang.Short |
xsd:int | java.lang.Integer |
xsd:long | java.lang.Long |
xsd:number | java.lang.Long |
xsd:integer | java.lang.Long |
xsd:double | java.lang.Double |
xsd:decimal | java.lang.Double |
xsd:float | java.lang.Float |
xsd:dateTime | java.util.Date |
Note: According to the XSD specification the dateTime serialized string must conform to the following format: yyyy-MM-ddTHH:mm:ss, where "yyyy" designates the 4-digit year, "MM" - the 2-digit month, "dd" - the 2-digit day, "T" - the separator, "HH" - the 2-digit hour, "mm" - the 2-digit minutes and "ss" - the 2-digit seconds (e.g. 1990-10-10T18:10:00). Even-though the XSD dateTime type does not accept a string specifying the date only (1990-10-10 would not be an acceptable xsd:dateTime string), the WS EventHandler accepts this kind of date string and constructs a java.util.Date object with the time set to 00:00:00.
Note: The Web Service EventHandler currently supports simple data types only - complex data types are not currently supported.
You can set the data type of an Attribute of the result Entry of your AssemblyLine by using the "Attribute map" of the last Connector in your AssemblyLine in the following way:
ret.value = new java.lang.Integer(integer_as_string);
where integer_as_string
is the string representation of the "age" Attribute value. If, for example,
you have used the default ("Simple") Attribute mapping mode for the "age" Attribute until now (i.e. you
don't need any additional processing in the Attribute map), then all you need to type is:
ret.value = new java.lang.Integer(conn.getAttribute("age").getValue());
In this way the "age" Attribute will be stored in your AssemblyLine result Entry as a java.lang.Integer.
After processing a request the Web Service EventHandler deliveres the event associated with this request to the business logic defined by the user in the "Action Map" section of the MI Admin. The following properties are assigned to the event object (availablve in the "Action Map"):
Connection properties:
Property | Description |
tcp.remoteIP | Connection's remote IP address. |
tcp.remotePort | Connection's remote port. |
tcp.remoteHost | Connection's remote host name. |
tcp.localIP | The local IP address. |
tcp.localPort | The local port where the EventHandler listens for requests. |
tcp.localHost | The local host name. |
Web service properties:
Property | Description |
event.originator | The Web Service EventHandler instance that processed the request. |
event.successfulALExecution | A java.lang.Boolean value: "true" if the requested AssemblyLine has been successfully executed; "false" - otherwise. |
event.responseSent | A java.lang.Boolean value: "true" if any response has been sent; "false" - otherwise. |
event.assemblyLineName | The name of the AssemblyLine executed. This property is set only when "event.successfulALExecution" value is "true". |
event.inputEntry | An Entry object which Attributes correspond to the input parameters of the request. This property is set only when "event.successfulALExecution" value is "true". |
event.outputEntry | An Entry object which Attributes correspond to the output parameters of the response. This property is set only when "event.successfulALExecution" value is "true". |
Parameter |
Description |
---|---|
class | com.architech.switchboard.WebServiceSwitchboard |
wsdlURL | The URL of the WSDL document. |
tcpPort | The port where the EventHandler will accept SOAP/HTTP requests. |
userComment | Put your own comments here. |
debug | Specifies whether more detailed debug information will be written to the log file. |
You can automatically generate the WSDL file from
the "Configuration" tab of the Web Service EventHandler. Please note that
the parameters represented by the user interface controls "Service operations", "WSDL File Name", "Web
Service URL" are not part of the Web Service EventHandler configuration -
they represent a utility for generating WSDL documents (i.e. for translating the MI AssemblyLines into
WSDL).
In
the "Available AssemblyLines" list box
(the right one) you can see the AssemblyLines from the current
MI configuration that are available for exposing in a WSDL document.
The "Exposed AssemblyLines" list box (the left one) contains
the AssemblyLines that will be exposed as web service operations
in the WSDL document that will be created. If you want to expose
an
AssemblyLine in the WSDL document, select this AssemblyLine from the "Available AssemblyLines" list
box and push the " < " (left arrow) button - the AssemblyLine will move to
the "Exposed AssemblyLines" list. If you don't want to expose an AssemblyLine already moved to
the "Exposed AssemblyLines" list, select this AssemblyLine from the list and push the " >
" (right arrow) button - the AssemblyLine will move to the "Available AssemblyLines" list.
To generate a WSDL file do the following:
WSDL defines Request and Response messages. The WSDL generation utility generates message names by appending the suffix "Request" or "Response" to the name of the AssemblyLine. You should note that the words "request" and "response" apply to the request and response of a web service as viewed from a client application. Since the AssemblyLine operates on the server side of a web service, the "request" to the web service operation is mapped to the input Entry for the AssemblyLine, while the "response" of the web service operation is created from the result Entry of the AssemblyLine.<message name="Request"> <part name="" type="xsd:"/> </message>
Let us assume that your sample AssemblyLine is called "TestAssemblyLine" and that it requires an input Entry, which contains a single attribute called "city" of type "string". This piece of information is encoded in a WSDL message part in the following way:
Let us assume again that your sample AssemblyLine outputs an Entry, which contains two attributes: one called "population" of type "int" and the other called "is_capital" of type "boolean". This piece of information is encoded in WSDL message parts in the following way:<message name="TestAssemblyLineRequest"> <part name="city" type="xsd:string"/> </message>
Please note that the order in which WSDL messages (requests and responses) appear in the WSDL file is not important.<message name="TestAssemblyLineResponse"> <part name="population" type="xsd:int"/> <part name="is_capital" type="xsd:boolean"/> </message>
Refer to the installation document for the Web Service Connector (WebServiceConnector.htm)