MyEclipse: Problem creating Web Service client from WSDL

stevelopez - May 03, 2012 - 06:50 PM
Post subject: Problem creating Web Service client from WSDL
After providing the URL of a valid WSDL and attempting to create a JAX-WS ewb service client I get the following error:

A class/interface with the same name as package.class is already in use. Use a class customization to resolve this conflict.

the package is empty and remains empty after hitting OK.

What is causing this error?

Thanks,
Steve
stevelopez - May 03, 2012 - 09:00 PM
Post subject: update
Update: Out of curiosity I tried to create the client using another PC with MyEclipse. (also has MyEclipse 10.1). Same result.
stevelopez - May 04, 2012 - 02:14 AM
Post subject: WSDL
Here is the WSDL:
http://www.craigattiwillinc.com/Member.asmx?wsdl

It validates properly on http://xmethods.net/ve2/Tools.po

From reading other forums it appears that JAX-WS is improperly collapsing the namespace. I have no control over the WSDL - how can I get MyEclipse to properly generate the service classes?
support-tony - May 07, 2012 - 11:35 AM
Post subject:
Steve,

The name collision seems to be a valid error (in that the WSDL provided will produce that error). To avoid name collisions, a bindings customization file is needed, as the error message mentions. It's not easy to figure out and I'm not sure I understand all the complexities but I found an example on the Web which, when modified, seems to fix your problem.

If you copy and paste the following code into an xml file in your project, then the ValidateResponse type will be given a name of ValidateResponseType and it won't clash with the element name. Browse to and select the file in the generation wizard.
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxws:bindings
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
  xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.1"
  xmlns:s="http://www.w3.org/2001/XMLSchema"
  wsdlLocation="http://www.craigattiwillinc.com/Member.asmx?wsdl">

    <jaxws:bindings node="wsdl:definitions/wsdl:types/s:schema/s:complexType[@name='ValidateResponse']">
        <jaxb:class name="ValidateResponseType"/>
    </jaxws:bindings>
</jaxws:bindings>

An alternative to this is to download the WSDL into your own file, then alter the name of the complex type to ValidateResponseType and also change the reference to it. Then you can generate from the modified WSDL. I guess the customization file is the best option though, in either case, any change to the WSDL may necessitate a change to a local file.

I'm afraid that there is no way to specify other arguments to the generation process.

Please let us know if this helps.
All times are GMT - 6 Hours
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits