uCosminexus Application Server, Web Service Development Guide
To customize with the external binding file, prepare a file that collectively codes the binding declaration separately from WSDL, read that file at the same time as the WSDL document, and customize. The external binding file can be read several times.
The following figure shows an example of using the external binding file to customize the package name:
Figure 15-18 Example of package name customization (external binding file)
The following points describe the points to remember when you customize with the external binding file:
Like the embedded binding declaration, for the external binding file, the jaxws:bindings element is used as a container.
However, unlike the embedded binding declaration, you can code the jaxws:bindings element as the child element of the jaxws:bindings element.
The following table describes the attributes of the jaxws:bindings element and the operations depending on whether the attribute is specified:
Table 15-22 Relationship between the attributes of the jaxws:bindings element and the operations depending on whether the attribute is specified (external binding file)
| No. | Coding location | Elements | Specification of attribute | Operations |
|---|---|---|---|---|
| 1 | Root jaxws:bindings#1 | wsdlLocation | Yes | Make sure you specify the attribute. The WSDL at the specified location is assumed to be the WSDL file to be customized. For details on the method of specification, see 15.2.2(1)(a) Coding format of the wsdlLocation attribute. |
| 2 | No | If the attribute is not specified, the external binding file is ignored (terminates normally without customization). | ||
| 3 | Node | Yes | You can specify the attribute in the XPath 1.0 format. The specified element is assumed to be the target for customization. For details about the method of specification, see 15.2.2(1)(b) Coding format of the node attribute. | |
| 4 | No | The element to be customized is assumed a WSDL root (wsdl:definitions element). | ||
| 5 | Version | Yes | "2.0" can be specified. For details about the method of specification, see 15.2.2(1)(c) Coding format of the version attribute. | |
| 6 | No | 2.0 is assumed to be specified. | ||
| 7 | Non-root jaxws:bindings#2 | wsdlLocation | Yes | The attribute cannot be specified. Even if the attribute is specified, it is ignored. |
| 8 | No | Terminates normally. | ||
| 9 | node | Yes | Make sure you specify the attribute. The specified element is assumed to be the target for customization. For details about the method of specification, see 15.2.2(1)(b) Coding format of the node attribute. | |
| 10 | No | There is no target for customization, so terminates normally without customization. | ||
| 11 | version | Yes | The attribute cannot be specified. Even if the attribute is specified, it is ignored. | |
| 12 | No | Terminates normally. |
You specify the value to be specified in the wsdlLocation attribute of the jaxws:bindings element with a URL. The files that you specify using a URL might be either remote files or local files. You can also specify a local file with a relative path.
If you use the wrong format for coding or if the file does not exist, an error message is output in the standard error output and log and the processing ends (KDJW51043-E).
For the URL, use a string complying with the rules of the RFC 2396 specifications. Perform percent encoding with UTF-8 according to the rules of the RFC 2396 specifications, when a character string not complying with rules of the RFC 2396 specifications is used. However, you cannot use an ampersand (&) even when the percent encoding is performed. If the rules of the RFC 2396 specifications are not followed and you specify the characters and character strings that are not encoded, the operation is not guaranteed. Furthermore, the operation might not function properly if a file other than the WSDL file is specified in the wsdlLocation attribute.
The following is an example of the correct coding of the wsdlLocation attribute:
<jaxws:bindings xmlns:jaxws=http://java.sun.com/xml/ns/jaxws wsdlLocation="file:///D:/tmp/example.wsdl" version="2.0"> ... </jaxws:bindings> |
You specify the value to be specified in the node attribute of the jaxws:bindings element using the XPath 1.0 format.
If you use the wrong format for coding, an error message is output in the standard error output and log and the processing ends (KDJW51038-E).
The following is an example of coding of the node attribute. In this example, the name attribute of the wsdl:definitions/ wsdl:portType elements indicates a binding declaration for the AddNumbersImpl element.
<jaxws:bindings node="wsdl:definitions/wsdl:portType[@name='AddNumbersImpl']"> ... </jaxws:bindings> |
In the node attribute of the non-root jaxws:bindings element, you can specify the relative path (XPath 1.0 format) from the elements to be customized, specified in the node attribute of the root jaxws:bindings element. The following is the coding example in this case:
<jaxws:bindings node="wsdl:definitions/wsdl:portType[@name='UserInfoPortType']" ... <jaxws:bindings node="../wsdl:service[@name='UserInfoService']"> ... </jaxws:bindings> </jaxws:bindings> |
Specify 2.0 as the value of the version attribute of the jaxws:bindings element.
If a value other than 2.0 is coded, an error message is output in the standard error output and log and the processing ends (KDJW51039-E).
The following is an example of the correct coding of the version attribute:
<jaxws:bindings xmlns:jaxws=http://java.sun.com/xml/ns/jaxws wsdlLocation="file:///D:/tmp/example.wsdl" version="2.0"> ... </jaxws:bindings> |
The following table lists the binding declarations that can be used in the Cosminexus JAX-WS functionality when you use the external binding file. For details about each binding declaration, see JAX-WS 2.2 specifications.
Table 15-23 Available binding declarations (External binding file)
| Element name | Attribute name | Description | ||
|---|---|---|---|---|
| jaxws:bindings element | wsdlLocation | In the wsdlLocation attribute, you code the file path (URL) of the external binding file. | ||
| node | In the node attribute, you code the element to be customized in WSDL. | |||
| version | In the version attribute, you code the WSDL customization version. | |||
| The child element of the jaxws:bindings element | -- | This is the child element of the jaxws:bindings element. | ||
| jaxws:package | name | In the name attribute, you code the Java package name corresponding to the targetNamespace attribute of the wsdl:definitions element. | ||
| jaxws:javadoc | -- | This is the Javadoc string that is added to the Java package. | ||
| jaxws:enableWrapperStyle | -- | Shows the enabling or disabling of wrapper style for each element. | ||
| jaxws:enableAsyncMapping | -- | Shows the enabling or disabling of asynchronous mapping for each element. | ||
| jaxws:class | name | In the name attribute, you code the class name corresponding to each element. | ||
| jaxws:javadoc | -- | This is the Javadoc string that is added to the class. | ||
| jaxws:method | name | In the name attribute, you code the Java method name corresponding to each element. | ||
| jaxws:javadoc | -- | This is the Javadoc string that is added to the method. | ||
| jaxws:parameter | part | In the part attribute, you code the XPath expression that identifies the wsdl:part child element of the wsdl:message element. | ||
| childElementName | In the childElementName attribute, you code the child element name of the global type definition or global element declaration referenced by the wsdl:part element. | |||
| name | In the name attribute, you code the parameter name of the element identified by the part attribute and childElementName attribute. | |||
| jaxws:provider | -- | If you specify true, SEI is not generated. The getter method of the port is omitted in the service interface that is generated. For details about the jaxws:provider element, see the section 15.2.7 Operation when the jaxws:provider element is coded. |
||
As described in the above table, the location where the jaxws:bindings element and its child element can be coded in a WSDL is defined in the JAX-WS 2.2 specifications. If these elements are coded in locations that are not defined, an error message is output in the standard error output and log and the processing ends (KDJW51029-E).
If you code elements that cannot be coded as the child element of the jaxws:bindings element, an error message is output in the standard error output and log and the processing ends (KDJW51040-E).
Furthermore, if you code attributes that cannot be coded in the attributes of the jaxws:bindings element and its child element, an error message is output in the standard error output and log and the processing ends (KDJW51029-E).
Note that you cannot code the binding declaration of JAXB specifications. If coded, the operations might not function properly.
If an attribute is coded repeatedly in the jaxws:bindings element and its child element, an error message of Cosminexus XML Processor is output in the standard error output and log and the processing ends.
You cannot specify the customization of the same object by using the external binding file. If specified, the operations might not function properly.
When you want to customize WSDL to be imported with the wsdl:import element using the external binding file, specify WSDL to be imported with the wsdl:import element using the wsdlLocation attribute of the jaxws:bindings element.
When customizing WSDL to be imported with the wsdl:import element, if WSDL at the wsdl:import source is specified by mistake, the target for customization specified in the node attribute of the jaxws:bindings element is not found. In this case, an error message is output in the standard error output and log and the processing ends (KDJW51187-E).
All Rights Reserved. Copyright (C) 2013, Hitachi, Ltd.