Modifying the WSDL generated by the MTDS

Technote (FAQ)


Question

The WSDL automatically generated by the MTDS is not always what you expect or you may want to modify the binding. Since the WSDL is generated automatically at runtime, you cannot modify directly the WSDL in Rule Studio or Eclipse. Then, how to do it?

Cause

JRules leverages Java API for XML Web Services Annotations (JAX-WS) to get the WSDL generated from the java XOM

Answer

You will have to add annotations in your java XOM. The annotations will be processed when the WSDL generation API (JAX-WS) parse the java XOM.

But first, you will have to upgrade the version of the JAXWS libraries, as the version provided in JRules 7.0.x and 7.1.x (JAX-WS v2.1.1) is not compatible with annotations.

You can download the newer library (v2.1.7) from the JAX-WS reference implementation's web site: http://jax-ws.java.net/

You will thus need to update the build script accordingly, so that it picks up the JAX-WS jar files from the newer version. This means modifying the <path id="jaxws.classpath"> definition in the build.xml file (in the MTDS project).

Then, in your java XOM, add for instance the annotation @XmlElement(required=true) for the attributes that musts have a minoccur="1" in the XSD so that they are no longer tagged as Optional in the WSDL generated.

For xml binding java annotations, refer to the java doc

If you want to have an attribute that is required and not nullable, you will annotate it :

public class Foo {
@XmlElement(nillable=true, required=true)
public int bar;
}

The XML generated will be :

<xs:complexType name="Foo">
<xs:sequence>
<xs:element name="bar" type="xs:int" nillable="false" minOccurs="1"/>
</sequence>
</xs:complexType>

Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

WebSphere ILOG JRules

Software version:

7.0, 7.1

Operating system(s):

Platform Independent

Reference #:

1594789

Modified date:

2012-05-15

Translate my page

Machine Translation

Content navigation