Extending BindGen customizations

Jibx2Wsdl customizations are based on the BindGen customizations. In addition to the customizations defined for use with BindGen, Jibx2Wsdl also defines some extension elements which can be added to the customizations information for controlling how service classes are translated into WSDL definitions.

The Jibx2Wsdl extension elements are <wsdl>, <service>, <operation>, <parameter>, and <return>. The <wsdl> element, if present, must always be a direct child of the <custom> element at the root of the customization document. It can contain any number of child <service> elements, which can in turn contain <operation> elements. <operation> elements can contain child <parameter> and <return> elements (in that order, with at most one <return> element).

<wsdl> and <service> attributes

The <wsdl> and <service> elements are based on BindGen customizations, and support the BindGen Nesting customization attributes, along with several additional attributes. The following attributes are supported by both <wsdl> and <service> elements:

Common customization attributes

service-base

Sets the base address used for the service endpoint address specified in the WSDL. The default is http://localhost:8080/axis2/services at the <wsdl> level, which will be modified by appending the service name on the end.

set-actions

Determines whether the generated WSDL should specify soapAction values as part of the operation definitions. Some frameworks require these action values to be present. The default is "true", meaning the action values will be defined.

use-nillable

Determines whether nillable="true" will be specified in the schema definition for optional values used as method parameters. The default is "false", meaning minOccurs="0" will be used rather than nillable.

wrapped

Controls whether "wrapped" document/literal style is used for the generated WSDL, rather than plain document/literal. The wrapped style preserves the structure of parameters passed to methods in the corresponding web service operations. The default is "true", meaning the wrapped style will be used.

wsdl-namespace

Sets the namespace used for WSDL definitions. By default the namespace is generated from the package of the supplied service definition class.

The <service> element also defines additional attributes:

<service> customization attributes

binding-name

Name to be used for the <wsdl:binding> definition. If not specified, it is derived by appending "Binding" to the service name.

class

Gives the fully-qualified class name of the service definition class. This is the only required attribute for the <service> element.

excludes

List of method names to be excluded from service definition. Names in the list are separated by whitespace characters. If neither this attribute nor the includes attribute is given, all non-static methods will be exposed as operations in the service definition. If both attributes are given, only the methods listed in the includes value are used (it's an error if a method is in both lists).

includes

List of method names to be included in the service definition. Names in the list are separated by whitespace characters. If neither this attribute nor the excludes attribute is given, all non-static methods will be exposed as operations in the service definition. If both attributes are given, only the methods listed in the includes value are used (it's an error if a method is in both lists).

port-name

Name to be used for the <wsdl:port> definition. If not specified, it is derived by appending "Port" to the service name.

port-type-name

Name to be used for the <wsdl:portType> definition. If not specified, it is derived by appending "PortType" to the service name.

service-address

Sets the service endpoint address to be specified in the WSDL. The default is derived from the service-base value by appending the service name on the end.

service-name

Name to be used for the service. The default is the simple class name of the service definition class.

<operation> attributes

<operation> elements support the following customization attributes:

<operation> customization attributes

method-name

This required attribute gives the name of the service definition class method to be customized by the element.

operation-name

Sets the operation name to be used in the WSDL service description. If this attribute is not specified, the operation name is the same as the method name.

optionals

List of parameter names to be treated as optional in the schema representation of the input message for this operation. Names are separated by whitespace in the list. If neither this attribute nor the requireds attribute is supplied all object reference parameters are treated as optional and all primitive parameters are treated as required.

request-message

Name to be used for the input message to this operation. If this attribute is not specified, the input message element name is constructed by appending "Message" to the operation name.

request-wrapper

Element name to be used for the input message to this operation. If this attribute is not specified, the input message element name is just the operation name.

requireds

List of parameter names to be treated as required in the schema representation of the input message for this operation. Names are separated by whitespace in the list. If neither this attribute nor the optionals attribute is supplied all object reference parameters are treated as optional and all primitive parameters are treated as required.

response-message

Name to be used for the output message from this operation. If this attribute is not specified, the output message element name is constructed by appending "ResponseMessage" to the operation name.

response-wrapper

Element name to be used for the output message from this operation. If this attribute is not specified, the output message element name is constructed by appending "Response" to the operation name.

soap-action

URI to be used as the soapAction identifier for this operation. If this attribute is not specified, the soapAction identifier is generated by prefixing the operation name with "urn:".

<parameter> and <return> attributes

<parameter> and <return> elements are used within an <operation> definition to customize the handling of values passed to or returned from the service method associated with the <operation>. These elements are based on BindGen customizations, and support the BindGen Value customization attributes, along with the following added attribute:

<parameter> and <return> customization attributes

In addition, the <parameter> element has an additional required attribute:

<parameter> customization attributes

element

This attribute gives the element name to be used for the parameter or return value in the XML representation.

name

This required attribute gives the name of the parameter being customized.

Command line customizations

You can also pass global customizations (corresponding to attributes of the <wsdl> elements) to Jibx2Wsdl as command-line parameters, without the need to create a customizations file, by using "--" as a special prefix to the customization attribute value. So to set the service base address to "http://www.jibx.org/ws", for instance, you'd use the command line parameter --service-base=http://www.jibx.org/ws. You can also pass global customizations for BindGen in the Jibx2Wsdl command line.