Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Automatic generation of WS client produces non-compiling classes
Automatic generation of WS client produces non-compiling classes [message #212512] Fri, 18 April 2008 09:32
Eclipse User
Originally posted by: axs.zurich.ibm.com

Hello - sorry, that I in some sense repeat that question
(news://news.eclipse.org:119/fr3j9l$p9f$1@build.eclipse.org) here, but I
tried some more and I was hoping that someone could maybe point me to
some other place to look or ask for help?

As far as I understand, the generated client is 'confused' by the fact
that it states xsd:boolean as base, but an xsd:pattern value="0|1".

I tried creating the ws client with Axis 1 and Axis 2, the first
approach gives the non-compiling code as described below (previous
post), the second approach produces code which compiles, but contains
non-functional code like:

public void setBooleanType(boolean param) {
if (java.lang.String.valueOf(param).matches("0|1")) {
this.localBooleanType = param;
} else {
throw new java.lang.RuntimeException();
}
}
[as the valueOf will always give "true|false" back]


Is this a problem of the underlying WSDL not being allowed in this form?
Or is it a problem with the tools creating the client?

Thanks a lot for any help,
Axel

---

Hi - I have a problem generating a Web Services client from an existing
web service from its WSDL - the generated code contains errors and
cannot compile.

The problem is that the wsdl file uses an MXMeta.xsd which contains
among other things these definitions:

<xsd:simpleType name="BooleanType">
<xsd:restriction base="xsd:boolean">
<xsd:pattern value="0|1" />
</xsd:restriction>
</xsd:simpleType>

<xsd:complexType name="MXBooleanType">
<xsd:simpleContent>
<xsd:extension base="BooleanType">
<xsd:attribute name="changed" type="ChangeIndicatorType"
use="optional" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>


From that I generate the web services client, which results in this
code in MXBooleanType.java:

public class MXBooleanType implements java.io.Serializable,
org.apache.axis.encoding.SimpleType {
private java.lang.Boolean changed; // attribute

public MXBooleanType() {
}

// Simple Types must have a String constructor
public MXBooleanType(boolean _value) {
super(_value);
}
...

which shows a compile error at the last super(_value) because there is
no such constructor for java.long.Object.

This looks like it missed to create the BooleanType, and making
MXBooleanType and extension of it. In this way, no actual boolean value
is kept anywhere ...

I tried the latest stable Europa release of Eclipse JEE
(eclipse-jee-europa-fall2-win32) and the latest build
(20080304-0640_eclipse-jee-ganymede-M5-win32.win32.x86) - both with the
same results.

I tried to fix that with two approaches:

1. fix the MXMeta.xsd to read:
<xsd:complexType name="MXBooleanType">
<xsd:simpleContent>
<xsd:extension base="xsd:boolean">
<xsd:attribute name="changed" type="ChangeIndicatorType"
use="optional" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>

2. add explicit code for a boolean value to the generated MXBooleanType.java

In both cases I will get compiling code, but the variable of type
MXBooleanType will still not be set correctly from the SOAP response
(which does contain values) - so somehow the machinery still doesn't
pick it up correctly.

Thanks for any help and hints!
Axel
Previous Topic:Problem installing Glassfish server adapter to Eclipse R3.4M6/WTP 3.0M6
Next Topic:Escape special characters.
Goto Forum:
  


Current Time: Sat Oct 25 22:09:11 GMT 2014

Powered by FUDForum. Page generated in 0.01548 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software