|
VADELIA |
|
EADELIA |
|
(B) (C) |
(B) (C) |
Context for use
SOAP or Restful Web Service production.
Section for use
DECLARATION of the program
DECLARATION of a public procedure
Syntax
WS_CONFIGURE Scope ConfigElem
Scope |
→ |
*SERVICE | *OPERATION |
ConfigElem |
→ |
ValueAttribute | ExtractXml |
ValueAttribute |
→ |
AttributeName AttributeValue |
AttributeName |
→ |
'AlphaConstant' |
AttributeValue |
→ |
'AlphaConstant' |
ExtractXml |
→ |
*XML_MEM(XmlMem) | *XML_FILE(XmlFile) |
XmlMem |
→ |
'AlphaConstant' |
XmlFile |
→ |
AdeliaResourceName |
Description
This instruction configures the behaviour of SOAP Web service (DOCUMENT or DOCUMENT_JAXWS style) or a RESTful Web service produced with Adelia Studio. The configuration items relate either to the Web service or to one of its operations (the operation containing the instruction in question).
For SOAP Web Service, the configuration items are added to the "services.xml" file in the <ServiceName.aar> archive containing all the constituent elements of the DOCUMENT/Literal-type Web service.
For a RESTful Web service, configuration items are taken into account in generating the 3GL source, mostly in the form of Java annotations.
There are two ways of adding a configuration item:
Add an AttributeName / AttributeValue pair
- Certain predefined attribute names make it easy to configure the most common options:
AttributeName |
Scope |
Description |
Type |
target_namespace |
*SERVICE |
Redefines the service's target_namespace. By default, the value is the one set in the application area or environment attributes in the Namespace field of the Java/Web Services tab. |
SOAP |
schema_namespace |
*SERVICE |
Defines a specific namespace for the items of the produced XML schema. By default, the value is the one set in the application area or environment attributes in the Namespace field of the Java/Web Services tab. |
SOAP |
xsd_schema_namespace | *SERVICE | Defines a specific secondary namespace for the complex elements of the produced XML schema. By default, this namespace is built from the Java package of 'web services' programs defined in the application area or environment attributes. | SOAP |
scope |
*SERVICE |
Defines the scope of the service ('request', 'soapsession', 'transportsession', 'application') ; 'request' is the default scope. 'soapsession' and 'transportsession' are scopes specific to the type of SOAP service. |
SOAP or REST |
elementFormDefault |
*SERVICE |
Sets the information elementFormDefault to qualified (by default) or unqualified for the generation of the XML schema in the produced WSDL file. |
SOAP |
attributeFormDefault |
*SERVICE |
Sets the information attributeFormDefault to qualified (by default) or unqualified for the generation of the XML schema in the produced WSDL file. |
SOAP |
schemaDisableNillableElem |
*SERVICE |
Deactivates (true) the "nillable" items, for the generation of the XML schema in the produced WSDL file. |
SOAP |
schemaDisableOptionalElem |
*SERVICE |
Deactivates (true) the optional items (attribute "minoccurs=0") for the generation of the XML schema in the produced WSDL file. |
SOAP |
action_mapping |
*OPERATION |
Adds a specific action_mapping for the operation. |
SOAP |
async |
*SERVICE | *OPERATION |
Allows an asynchronous service to be declared (true | false). |
SOAP |
module |
*SERVICE | *OPERATION |
Allows a module to be engaged. |
SOAP |
enableMTOM |
*SERVICE |
Enabling MTOM optimization for the transfer of binaries towards the customer. (true | false) Binaries are then no longer serialized as a base 64 encoded string but in the form of MTOM optimized mime messages. |
SOAP |
jaxws_itemlist_name | *SERVICE |
JAXWS_DOCUMENT mode. Renaming of the wrapper element of the list items of a LIST input or output parameter. The '<list>' pattern is substituted by the list name or the external list name if it was defined.
Adelia code
WS_CONFIGURE *SERVICE 'jaxws_itemlist_name' 'item_<list>' LIST lst z1 z2 PARAM lst,i,listIn
Corresponding XML fragment (NoWrapperSingleListParam generation option checked)
<listIn> <item_listIn><z1>value</z1><z2>value</z2></item_listIn> <item_listIn><z1>value</z1><z2>value</z2></item_listen> ... </listIn> |
SOAP |
jaxws_noextra_s_wrapper_name | *SERVICE |
JAXWS_DOCUMENT mode. Deletion of the final "s" of the encompassing wrapper element for LIST input parameters and output parameters. A LIST input parameter or a non-single output parameter - with no generation option checked (NoWrapperParamWithList or NoWrapperSingleListParam) - produces an XML fragment similar to this one in the <body> of the SOAP envelope:
Adelia code
LIST lst z1 z2 PARAM lst,i,mylist
XML fragment (jaxws_noextra_s_wrapper_name=false attribute)
<mylist> <mylists> <mylist><z1>value</z1><z2>value</z2></mylist> <mylist><z1>value</z1><z2>value</z2></mylist> ... </mylists> <mylist> Setting the jaxws_noextra_s_wrapper_name attribute to "true" will delete the final "s" of the <mylists> encompassing element.
XML fragment (jaxws_noextra_s_wrapper_name=true attribute)
<mylist> <mylist> <mylist><z1>value</z1><z2>value</z2></mylist> <mylist><z1>value</z1><z2>value</z2></mylist> ... </mylist> <mylist> |
SOAP |
jaxws_gen_list_wrapper_out_class | *SERVICE |
JAXWS_DOCUMENT mode. Setting it to the "false" value, together with the [NoWrapperParamWithList] generation option, deletes the wrapper element from the LIST output parameters list items - when the output parameter is not single (for a single parameter, no wrapper element is used when the NoWrapperSingleListParam generation option is checked).
Adelia code - A single LIST output parameter
ALPHA(15) p1 LIST lst z1 z2 PARAM p1,o,palp lst,o,mylist
XML fragment (NoWrapperParamWithList option checked and jaxws_gen_list_wrapper_out_class=true attribute)
<palp>value</palp> <mylist> <mylist><z1>value</z1><z2>value</z2></mylist> <mylist><z1>value</z1><z2>value</z2></mylist> ... <mylist> Setting the jaxws_gen_list_wrapper_out_class attribute to the "false" value will delete the <mylist> encompassing element.
XML fragment (NoWrapperParamWithList option checked and jaxws_gen_list_wrapper_out_class=false attribute)
<palp>value</palp> <mylist><z1>value</z1><z2>value</z2></mylist> <mylist><z1>value</z1><z2>value</z2></mylist> ... |
SOAP |
jaxws_gen_list_wrapper_in_class | *SERVICE |
JAXWS_DOCUMENT mode. Setting the value to 'false', together with the [NoWrapperSingleListParam] generation option, deletes the wrapper element from the LIST input parameters list items.
Adelia code
LIST lst z1 z2 PARAM lst,i,mylist
XML fragment (NoWrapperSingleListParam option checked and jaxws_gen_list_wrapper_in_class=true attribute)
<mylist> <mylist><z1>value</z1><z2>value</z2></mylist> <mylist><z1>value</z1><z2>value</z2></mylist> ... <mylist>
XML fragment (NoWrapperSingleListParam option checked and jaxws_gen_list_wrapper_in_class=false attribute)
<mylist><z1>value</z1><z2>value</z2></mylist> <mylist><z1>value</z1><z2>value</z2></mylist> ... |
|
@Path |
*SERVICE | *OPERATION |
Assigning a URI to a program (root resource) or a public procedure (resource). If the URI contains variables {var}, the latter, in order to be used, must be declared as parameters. |
REST |
@GET @PUT @POST @DELETE @OPTIONS @HEAD |
*SERVICE | *OPERATION |
Assigning an HTTP operation to a public procedure (resource). |
REST |
@Consumes |
*SERVICE | *OPERATION |
Defining formats accepted by a resource. The format is that of the body of the HTTP query. |
REST |
@Produces |
SERVICE | *OPERATION |
Defining formats produced by a resource. The format is that of the body of the HTTP answer. |
REST |
_init_pgm_as_method |
*SERVICE |
Defining INIT_PGM block behavior. (true | false) By default (true), the INIT_PGM block is treated as a public procedure in order to become a resource. If the attribute is set to "false", the INIT_PGM block is no longer a resource, but a service initialization block. This is useful in the case of a service with an "application" scope. |
SOAP or REST |
_root_result_name |
*OPERATION |
Makes it possible, for the serialization process, to name a set built from several parameters of the content type. |
SOAP or REST |
_swag_description |
*SERVICE | *OPERATION |
Addition of a swagger description to a public procedure (resource). In the case of a *SERVICE (root resource) range, the Adelia program description is used by default. Defines a group/tag which is common to all service operations/APIs. |
REST |
_swag_tags |
*SERVICE | *OPERATION |
In the case of a *SERVICE scope, defines the service's groups/tags. The separator is a comma. |
REST |
_swag_notes |
*OPERATION |
Addition of an extended swagger description to a public procedure (resource). |
REST |
_swag_desc_param |
*OPERATION |
Addition of a swagger description specific to a path, query, header or form input parameter. By default: the parameter's external name is used if there is one or the internal name if necessary. The first part is one of the following:
The second part is the HTTP code. Examples: ws_configure *OPERATION '_swag_response' 'VarPerson:200:the person has been identified' |
REST |
_swag_response |
*OPERATION |
Used to present the possible HTTP return codes. The attribute value is made up of three parts separated by the character ':'. The first part is the HTTP code and the second part is the description. Example: ws_configure *OPERATION '_swag_response' '404:the requested resource was not found' |
REST |
_swag_extdoc_url |
*SERVICE |
Used to add a link to external documentation. A description using the attribute _swag_extdoc_desc needs to be added in order to display the link. Example: ws_configure *SERVICE '_swag_extdoc_url' 'http://www.hardis-group.com' |
REST |
_swag_extdoc_desc |
*SERVICE |
Used to add a description describing the link to external documentation. Example: ws_configure *SERVICE '_swag_extdoc_desc' 'Hardis Group' |
REST |
@DeclareRoles |
*SERVICE |
Declares a set of roles which are useful for secure management by resource annotation (comma separator). |
REST |
@PermitAll |
*SERVICE | *OPERATION |
Grants access to the resource to all the roles defined via the @DeclareRoles annotation. |
REST |
@RolesAllowed |
*SERVICE | *OPERATION |
Grants access to the resource to all the roles specified in the annotation (comma separator): the input roles must belong to all the roles declared via the @DeclareRoles annotation. |
REST |
@DenyAll |
*SERVICE | *OPERATION |
Prohibits all roles from accessing the resource. |
REST |
Notes:
- For REST services, autocomplete suggests predefined constants (_WS_REST_FMT_*) for the most common exchange formats; these constants must be used with @Produces or @Consumes attributes.
- For a SOAP Web service, the other attribute names generate a configuration XML element called 'parameter': <parameter name="AttributeNames">AttributeValue</parameter>.
Warning:
- SOAP/DOCUMENT_JAXWS - setting the target_namespace and schema_namespace attributes with different values can produce an incomplete result when automatically registering the web service: the response element ('<Operation>Return') of an operation can therefore be abnormally presented as a final element.
Add an XML extract from an ALPHA constant (*XML_MEM) or Adelia resource (*XML_FILE) (Only SOAP).
The Axis2 functions that Adelia Studio is based on are expandable by using modules which are implementations of the different standardized specifications linked to the Web services (WS-*). For example, the "rampart" module is an implementation of the WS-SECURITY specification in charge of Web services security.
For each of these modules, refer to the documentation available on the internet to find out the available configuration items which can be inserted in the service's services.xml configuration file.
Directives *XML_MEM and *XML_FILE are used to add configuration items to the services.xml file in full.
For example
SOAP
WS_CONFIGURE *SERVICE 'target_namespace' 'http://mondomain.com'
Redefines the service's target_namespace.
WS_CONFIGURE *SERVICE 'module' 'addressing'
Commits the addressing module (WS_ADDRESSING)
WS_CONFIGURE *SERVICE 'scope' 'application'
Declares an 'application'-scope service.
WS_CONFIGURE *SERVICE 'enableMTOM' 'true'
Activates MTOM optimization for transmission of binary data by the service.
WS_CONFIGURE *SERVICE *XML_FILE(SecPolicy)
Adds an XML extract from an Adelia resource called SecPolicy.
REST
A resource (public procedure) of a RESTful service is addressable via a URI and an action (HTTP method).
The URI is defined using the @Path attribute; the HTTP methods are defined using @GET, @PUT, @POST, @DELETE, @HEAD, @OPTIONS attributes .
WS_CONFIGURE *SERVICE '@Path' '/cars'
WS_CONFIGURE *SERVICE _WS_REST_A_PATH '/cars'
Defines an @Path annotation for the program (or service; defining the root resource).
WS_CONFIGURE *OPERATION '@Path' '/{numberPlate}'
WS_CONFIGURE *OPERATION _WS_REST_A_PATH '/{numberPlate}'
Assigns an @Path annotation for a public procedure (resource).
The URI may contain variable parts (a variable is enclosed in braces); to be usable, these variables must match the local parameters of the public procedure.
WS_CONFIGURE *OPERATION '@GET' *BLANK
WS_CONFIGURE *OPERATION _WS_REST_A_GET *BLANK
Assigns an @Path action (HTTP method) for a public procedure (resource).
WS_CONFIGURE *OPERATION '@Consumes' 'application/xml;charset=utf-8'
WS_CONFIGURE *OPERATION _WS_REST_A_CONSUMES _WS_REST_FMT_APP_XML
Defines a format accepted for management of the body/content of the HTTP query.
WS_CONFIGURE *OPERATION '@Produces' 'application/json'
WS_CONFIGURE *OPERATION _WS_REST_A_PRODUCES _WS_REST_FMT_APP_JSON
Defines an format produced for management of the body/content of the HTTP request.
The same resource can return content in several formats to adapt to customer preferences (expressed via the HTTP accept header).
Authorization management
WS_CONFIGURE *SERVICE '@DeclareRoles' 'role1,role2,role3'
WS_CONFIGURE *SERVICE _WS_REST_A_DECLARE_ROLES 'role1,role2,role3'
Declaration of roles used in authorization management.
WS_CONFIGURE *OPERATION '@RolesAllowed' 'role1'
WS_CONFIGURE *OPERATION _WS_REST_A_ROLES_ALLOWED 'role1,role3'
Definition of roles authorized to access the resource.
WS_CONFIGURE *OPERATION '@PermitAll' *BLANK
WS_CONFIGURE *OPERATION _WS_REST_A_PERMIT_ALL *BLANK
Grants access to the resource to all roles defined via the @DeclareRoles annotation.
WS_CONFIGURE *OPERATION '@DenyAll' *BLANK
WS_CONFIGURE *OPERATION _WS_REST_A_DENY_ALL *BLANK
Deletes resource access for all roles.
Swagger
WS_CONFIGURE *SERVICE '_swag_extdoc_url' 'http://www.doc.externe'
WS_CONFIGURE * SERVICE _WS_REST_SWAG_EXTERNAL_DOC_URL 'http://www.doc.externe '
A link to external documentation has been added.
WS_CONFIGURE * SERVICE '_swag_extdoc_desc' 'Link to external documentation'
WS_CONFIGURE * SERVICE _WS_REST_SWAG_EXTERNAL_DOC_DESC 'Link to external documentation'
A description of the link to external documentation has been added.
WS_CONFIGURE *SERVICE '_swag_tags' Group1,Group2'
WS_CONFIGURE *SERVICE _WS_REST_SWAG_TAGS 'Group1,Group2'
Declaration of groups used to present the service's resources.
WS_CONFIGURE *SERVICE '_swag_description' 'Description Group1,Description Group2'
WS_CONFIGURE *SERVICE _WS_REST_SWAG_DESCRIPTION 'Description Group1,Description Group2'
Declaration of descriptions of groups used to present the service's resources.
WS_CONFIGURE *OPERATION '_swag_tags' Group1'
WS_CONFIGURE *OPERATION _WS_REST_SWAG_TAGS 'Group1'
Assignment of the resource to the group called Group1.
WS_CONFIGURE *OPERATION '_swag_description' 'Description of the resource'
WS_CONFIGURE *OPERATION _WS_REST_SWAG_DESCRIPTION 'Description of the resource'
Association of a description with the resource.
WS_CONFIGURE *OPERATION '_swag_notes' 'Extended description of the resource'
WS_CONFIGURE *OPERATION _WS_REST_SWAG_NOTES 'Extended description of the resource'
Association of an extended description with the resource.
WS_CONFIGURE *OPERATION '_swag_desc_param' 'Param1Name:Description of param1'
WS_CONFIGURE *OPERATION '_swag_desc_param' 'Param2Name:Description of param2'
WS_CONFIGURE *OPERATION _WS_REST_SWAG_DESC_PARAM 'Param1Name:Description of param1'
WS_CONFIGURE *OPERATION _WS_REST_SWAG_DESC_PARAM 'Param2Name:Description of param2'
Association of a description with a resource input parameter.
WS_CONFIGURE *OPERATION '_swag_response' '404:Resource not found'
WS_CONFIGURE *OPERATION '_swag_response' '403:Unauthorized resource access'
WS_CONFIGURE *OPERATION _WS_REST_SWAG_RESPONSE '404:Resource not found'
WS_CONFIGURE *OPERATION _WS_REST_SWAG_RESPONSE '403:Unauthorized resource access'
WS_CONFIGURE *OPERATION '_ swag_response ' 'VarPerson:200:The person has been correctly identified'
WS_CONFIGURE *OPERATION '_ swag_response ' 'VarError:500:Error while executing the service'
WS_CONFIGURE *OPERATION '_ swag_response ' '*NONE:401:User is not authorized'
Provides a description of the possible HTTP codes linked to the resource.