Web Service
Last updated
Last updated
Web services can be generated from flow, data structure, or WSDL. Generated web services are deployed to the specific instances automatically.
When a web service is deleted, that web service is undeployed from the target nodes.
Web services can have these authentication methods.
· Basic
Basic authentication adds Authorization header to HTTP header with base64 encoding.
Authorization: Basic a2FpemVuOjEyMzQ1(usename:password)
MTOM is the W3C Message Transmission Optimization Mechanism, a method of efficiently sending binary data to and from Web services.
MTOM is similar with the email attachment.
Click save button, the target instance popup is displayed. This popup shows the available instances.
Once the target instance(s) are chosen, click Generate button, then web service is generated.
The generation procedure consists of these steps.
· Generate web service source code.
o Generated source codes are located under tmp directory.
o Generate web service interface and implementation classes.
o Generate request and response entity classes.
· Compile the generated codes and package into .war file.
o Ant build tool is used to package .war file.
· Deploy the packaged .war to the running instance(s).
o Admin port, user, and password of the runtime node is used to deploy the .war as web service.
If web services are used as endpoints of the flows, JDK is required to compile the generated source codes.
Generated WSDL is displayed with DNSHost property of the runtime node, if DNSHost is not empty.
The real WSDL uses the host name from wildfly configuration file -
· wildfly-10.1.0.Final/standalone/configuration/standalone.xml.
Target namespace of the generated web service is http://flow.webservice.xnarum.com by default. This name comes from the default package name of the generated java classes and is in the exactly reversed order of the package.
This package can be customized with this system property - webservice.package.name - in this file
??? jetty-9.4.7/etc/xnarum.xml and restart jetty process.
<Call class="java.lang.System" name="setProperty"> <Arg>webservice.package.name</Arg> <Arg>com.mydomain.webservice</Arg> </Call> |
A web service can be generated from flow(s) and this web service has only 1 operation.
Property | Description |
---|---|
Service Name | The name of this web service |
Operation Name | The name of the method to be generated |
Description | Description |
Flow | Choose one or more flows |
Input can be generated from the Input Parameters of the flow or manually. Click from Flow button, then the input parameters of the flow are set as input parameters of the web service.
For input parameters, link type can be assigned. There are three types of links.
Property | Description |
---|---|
User Key | Link as User key. This user key is displayed in the transaction list. |
Message ID | Flow ID. If multiple flows are using one web service, this value can be used to invoke the target flow. |
Transaction ID | Transaction ID. If no transaction id is assigned, random transaction id is generated during the runtime. |
Input parameters can be added with plus (+) button.
Output parameters are response data to the client and can be generated from the output parameters of the target flow or manually.
Output parameter has Mapping field, and this field is used to map response data from the flow to the response data to the client.
To map the response data of the flow, enclose the parameter with #.
The web service can have no parameter and no response.
· The request with no parameters
· The response with no fields
A web service can be generated from request and response data structures. This web service also has only 1 operation. If no flow to the web service is linked, a new flow can be generated together.
The request and response data structure are converted to java class and the name of a field cannot start with number. If either request or response data contains fields which start with number, web service generation fails.
And if a data structure contains same name fields in different layer, the latter one will be ignored. This means the same name with different layout results in the first one only generated.
The picture shows a data structure with two groupA definitions. Each groupA has different layout. The second groupA is treated as already generated.
Property | Description |
---|---|
Generate Flow? | New flow is generated with this web service |
First Letter to Upper case for Field Name | Use upper case for the first letter of the field name. |
Flow ID | Linked flow id. If Generate Flow? Is checked, new flow is generated. |
Parameter | Data structure for request |
Return | Data structure for response |
This web service generates a flow with only a few components. The flow id is assigned with the service name.
The procedure of generation is same as Flow web service. But flow generation step is added after web service deployment.
The generated flow has these components by default.
Property | Description |
---|---|
Webservice Parameter Reader | This component contains the name of the request parameter. The purpose of this component is to expose the request parameter to this flow. This parameter can be used in the next steps. |
Mapping | This component is used to generate response data to the client. The result of this mapping is the input of Webservice Return Composer component. Mapping component is not mandatory. If mapping is not necessary, it can be deleted. |
Webservice Return Composer | This component specifies the name of the response data. A flow generates many output data and if no exact parameter is specified, no data is returned to the client. |
This flow has path value with operation name. __RoutingPath parameter is set inside web service and passed to the flow.
The business logic in the flow will be located between the first Reader component and the second mapping component.
WSDL web service is generated from WSDL. This web service can have multiple operations.
Property | Description |
---|---|
URL | WSDL URL |
File | WSDL File. Either URL or File is used to generate a web service. |
Binding XML | Binding XML is used to resolve name conflict in WSDL. This xml is optional. |
This type of web service has additional button(parse) to generate a web service.
Click parse button, then WSDL is parsed and displayed at the bottom.
A new data structure can be generated for this WSDL service.
The name of the generated data structure is same as the name of the web service.
Web service client can be generated from WSDL. The procedure is similar with WSDL web service generation.
Enter WSDL url or file, click parse button, then WSDL is parsed and displayed at the bottom.
The data structure of this web service can be generated with this.
The generated web service client is packaged as .jar file and located custom/ directory.
API key is required to access REST services. API key can allow the access to a certain user or role or specific flow.
The access control of REST service consists of these properties.
Property | Description |
---|---|
Key Type | Type of Access control User Role |
Customer ID | User id if key type is user. |
Role | Role if key type is role. |
Flow | Allowed flow list. · All · Or flow(s) |
Method | Allowed HTTP method. · All · GET · POST · PUT · DELETE |
Click Generate key button, then a new random key is generated. Choose other properties and save.
This key is saved into a table and retrieved whenever the REST call occurs.
The client should send this key as a custom HTTP header - X-Api-Key.
Otherwise, 401 Unauthorized response code is returned.