facebook

Problem creating Web Service client from WSDL

  1. MyEclipse Archived
  2.  > 
  3. Web Services
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #325791 Reply

    stevelopez
    Member

    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

    #325794 Reply

    stevelopez
    Member

    Update: Out of curiosity I tried to create the client using another PC with MyEclipse. (also has MyEclipse 10.1). Same result.

    #325800 Reply

    stevelopez
    Member

    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?

    #325849 Reply

    support-tony
    Keymaster

    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.

    <?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.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Problem creating Web Service client from WSDL

You must be logged in to post in the forum log in