3

I have written a WSDL to generate the Stubs and skeleton but my skeletons are not getting generated in the eclipse. I am using Helios version of Eclipse.
Can any one tell what is the issue with WSDL?

I want to use Axis 2. I tried to generate the skeleton using wsdl2java also but it gives compilation issues in the generated classes. I am not able to attach the file here so I am pasting it here.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:impl="http://DefaultNamespace"
      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:apachesoap="http://xml.apache.org/xml-soap"
      xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      name="Test" targetNamespace="http://DefaultNamespace"> 
      <wsdl:types>
        <xsd:schema elementFormDefault="qualified"
          targetNamespace="http://DefaultNamespace" xmlns="http://www.w3.org/2001/XMLSchema">
          <import namespace="http://xml.apache.org/xml-soap" />
          <xsd:element name="serviceMethod">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="vo" type="impl:MyVo" />
              </xsd:sequence>
            </xsd:complexType>
          </xsd:element>
          <xsd:complexType name="MyVo">
            <xsd:sequence>
              <xsd:element name="name" nillable="false" type="xsd:string" />
              <xsd:element name="params" nillable="true"
                type="apachesoap:Map" />
            </xsd:sequence>
          </xsd:complexType>
          <xsd:element name="serviceMethodResponse">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="serviceMethodReturn" type="impl:MyVo" />
              </xsd:sequence>
            </xsd:complexType>
          </xsd:element>
        </xsd:schema>
        <xsd:schema elementFormDefault="qualified"
          targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema">
          <import namespace="http://DefaultNamespace" />
          <xsd:complexType name="mapItem">
            <xsd:sequence>
              <xsd:element name="key" nillable="true" type="xsd:anyType" />
              <xsd:element name="value" nillable="true" type="xsd:anyType" />
            </xsd:sequence>
          </xsd:complexType>
          <xsd:complexType name="Map">
            <xsd:sequence>
              <xsd:element maxOccurs="unbounded" minOccurs="0"
                name="item" type="apachesoap:mapItem" />
            </xsd:sequence>
          </xsd:complexType>
        </xsd:schema>
      </wsdl:types>
      <wsdl:message name="serviceMethodRequest">
        <wsdl:part element="impl:serviceMethod" name="parameters" />
      </wsdl:message>
      <wsdl:message name="serviceMethodResponse">
        <wsdl:part element="impl:serviceMethodResponse" name="parameters" />
      </wsdl:message>
      <wsdl:portType name="Test">
        <wsdl:operation name="serviceMethod">
          <wsdl:input message="impl:serviceMethodRequest" name="serviceMethodRequest" />
          <wsdl:output message="impl:serviceMethodResponse" name="serviceMethodResponse" />
        </wsdl:operation>
      </wsdl:portType>
      <wsdl:binding name="TestSOAP" type="impl:Test">
        <soap:binding style="document"
          transport="http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="serviceMethod">
          <soap:operation soapAction="http://DefaultNamespace/serviceMethod" />
          <wsdl:input>
            <soap:body use="literal" />
          </wsdl:input>
          <wsdl:output>
            <soap:body use="literal" />
          </wsdl:output>
        </wsdl:operation>
      </wsdl:binding>
      <wsdl:service name="Test">
        <wsdl:port binding="impl:TestSOAP" name="MyWebService">
          <soap:address location="http://localhost:8080/Temp/services/MyService" />
        </wsdl:port>
      </wsdl:service>
    </wsdl:definitions>
Danubian Sailor
  • 1
  • 38
  • 145
  • 223
java_enthu
  • 2,279
  • 7
  • 44
  • 74
  • Works and compiles fine for me. What exactly is your error message? –  Jul 27 '11 at 04:29
  • Did you try generating skeleton using eclipse or wsdl2java? When i am trying to use eclipse it doesn't show the service name, port name, in the wizard and gives "Exception occurred during code generation for the WSDL : java.lang.NoClassDefFoundError: com/ibm/wsdl/extensions/schema/SchemaImportImpl" For Axis2. – java_enthu Jul 27 '11 at 04:36

3 Answers3

1

I had the same problem. I believe maven folder structure is causing it. I created a new project without maven and it worked. Added maven later. Also check source folders at "Java Build Path". If it is missing you will need to add it.

Hadi Tok
  • 772
  • 8
  • 20
  • This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](http://stackoverflow.com/questions/ask). You can also [add a bounty](http://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question once you have enough [reputation](http://stackoverflow.com/help/whats-reputation). – cfi May 14 '14 at 12:37
  • I answered the question. I had the problem and I described how I solved it if you read carefully. – Hadi Tok May 20 '14 at 10:44
  • You had similar (or the same) symptoms, but apparently a different problem: Note that four months before you answered, bdares answered with a solution that was accepted as the solution by the original asker. Your solution might be a valid one, but for a different question. What you have posted is a valuable contribution, but only as a comment, imho. To make this site meaningful for future visitors we have to try and distinguish between different problems with like symptoms. If all problems with similar symptoms end up in one question, eventually the site will be a big mess. – cfi May 20 '14 at 11:35
1

That's a problem with your install.

Download and verify axis2 and the axis2 eclipse plugins, make sure you've set up your AXIS2_HOME class paths.

Sometimes it stops working for me too, and then I have to go and reinstall everything. Don't bother making bug reports to Eclipse or Apache, they are always closed as "WORKSFORME".

Steps to produce code from your wsdl:

  1. Create a dynamic web project.
  2. Create your wsdl file.
  3. Right-click on your wsdl file, select Web Services -> Generate Java Bean Skeleton
  4. Click Finish

The Axis2 libraries, facets, and generated code will be added to your project automagically, and there will be no compilation problems.

  • Can you tell which eclipse version and which axis2 versions are you using? – java_enthu Jul 27 '11 at 07:29
  • I'm using jdk 1.5, eclipse helios, axis2 1.5.4, axis2 codegen plugin 1.5.4. –  Jul 27 '11 at 07:32
  • Thanks bdares : Well I am able to generate the skeleton classes but while these classes I am adding to the project it shows compilation errors in the newly generated classes. Did you try putting them in project? I see 5 compilation errors in the generated "MapItem" class. – java_enthu Jul 27 '11 at 08:02
  • I generate them from eclipse into the project directly, which conveniently adds the Axis2 libraries and facet to the project. Are you calling wsdl2java with a CLI? .... –  Jul 27 '11 at 08:08
  • Actually I created a dynamic project, added this wsdl, using code generator plugin Axis2Code generator 1.5.4 and , giving the file path, selecting code gen option : Custom, selecting : generate server side code, selecting output path (finish) , classes are getting generated on target location , copying them and pasting in eclipse project in src. But MapItem class has compilation issues. If I use CLI then also I am facing same issue. – java_enthu Jul 27 '11 at 08:14
  • thank you. bdres looks like right clicking- generate beans looks fine. But while using codegen wizard it gives compilation issues. – java_enthu Jul 27 '11 at 08:29
  • @java_enthu That's probably because you neglected to add the Axis2 facet and Axis2 libraries to your project. And eclipse never says "there are compiler problems." In the future, please tell us what the error message is, or how you know there is an error, because that is the clue to solving these kinds of problems. –  Jul 27 '11 at 08:31
  • @bdares let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/1882/discussion-between-java-master-and-bdares) – java_enthu Jul 27 '11 at 15:08
  • I have added the stacktrace on the chat. – java_enthu Jul 27 '11 at 15:09
0

I was facing the same trouble but now it has been solved. The problem is if you have a method that 'THROWS SOME KIND OF EXCEPTION', then it will cause the problem. Hence instead of throwing the error, try using try-catch block statement.

Azhar Ali
  • 59
  • 1
  • 1
  • 6