|
Problem(Abstract) |
The WebSphere® Application Server WebServices Engine
Emitter Tools do not support round-tripping. The definition of
round-tripping is that if you run Java2WSDL and then run WSDL2Java, it
might not result in a Java™ skeleton that matches the original Java
program.
The Java2WSDL tool currently has a limitation in the way that it generates
a WSDL from an original Java file. Java2WSDL's design interrogates the
get/set methods in the Java file to determine the constructor orders,
instead of interrogating the constructors themselves. Sometimes, this
leads to an undesirable generated WSDL.
A side effect of this limitation is that further web services applications
that are generated using this WSDL may also produce undesirable results.
This is sometimes called round-tripping, which is not supported in the
WebSphere Application Server WebServices Engine. |
|
|
|
Cause |
This is caused by a permanent restriction in WebSphere
Application Server Java2WSDL tool. |
|
|
Resolving the
problem |
Sample Java Source:
package com.ibm.test;
public class SomeFault extends Exception
{
private String aField;
private Integer bField;
public SomeFault()
{
}
public SomeFault(Integer bField, String aField)
{
this.bField = bField;
this.aField = aField;
}
public String getAField()
{
return aField;
}
public void setAField(String field)
{
aField = field;
}
public Integer getBField()
{
return bField;
}
public void setBField(Integer field)
{
bField = field;
}
}
Because the get/set methods in the aField and bField variables appear in a
different order than that defined in the 2-argument constructor, our
Java2WSDL tool generates a WSDL as follows:
<complexType name="SomeFault">
<sequence>
<element name="AField" nillable="true" type="xsd:string"/>
<element name="BField" nillable="true" type="xsd:int"/>
</sequence>
</complexType>
While this generation is not necessarily incorrect, it can lead to
undesirable or unexpected results when WSDL2Java is further used to
generate a web service from this WSDL.
Workarounds:
Option 1: Change the original Java source so that the get/set methods
appear in the same order as the constructor.
Example:
package com.ibm.test;
public class SomeFault extends Exception
{
private String aField;
private Integer bField;
public SomeFault()
{
}
public SomeFault(Integer bField, String aField)
{
this.bField = bField;
this.aField = aField;
}
public Integer getBField()
{
return bField;
}
public void setBField(Integer field)
{
bField = field;
}
public String getAField()
{
return aField;
}
public void setAField(String field)
{
aField = field;
}
}
Option 2: Edit the generated WSDL before further generating any web
services.
Example:
<complexType name="SomeFault">
<sequence>
<element name="BField" nillable="true" type="xsd:int"/>
<element name="AField" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
|
|
|
|
|
Cross Reference information |
Segment |
Product |
Component |
Platform |
Version |
Edition |
Application Servers |
Runtimes for Java Technology |
Java SDK |
|
|
|
|
|
|