Not able to generate the stubs/java skeletons from the WSDL

11,551

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

Solution 2

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.

Share:
11,551
java_enthu
Author by

java_enthu

Java, Hadoop, AWS, Kafka, Kubernetes, Docker, OpenShift and related technologies enthusiast.

Updated on June 05, 2022

Comments

  • java_enthu
    java_enthu almost 2 years

    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>
    
    • Admin
      Admin almost 13 years
      Works and compiles fine for me. What exactly is your error message?
    • java_enthu
      java_enthu almost 13 years
      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
    java_enthu almost 13 years
    Can you tell which eclipse version and which axis2 versions are you using?
  • Admin
    Admin almost 13 years
    I'm using jdk 1.5, eclipse helios, axis2 1.5.4, axis2 codegen plugin 1.5.4.
  • java_enthu
    java_enthu almost 13 years
    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.
  • Admin
    Admin almost 13 years
    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? ....
  • java_enthu
    java_enthu almost 13 years
    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
    java_enthu almost 13 years
    thank you. bdres looks like right clicking- generate beans looks fine. But while using codegen wizard it gives compilation issues.
  • Admin
    Admin almost 13 years
    @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.
  • java_enthu
    java_enthu almost 13 years
  • java_enthu
    java_enthu almost 13 years
    I have added the stacktrace on the chat.
  • cfi
    cfi almost 10 years
    This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation.
  • Hadi Tok
    Hadi Tok almost 10 years
    I answered the question. I had the problem and I described how I solved it if you read carefully.
  • cfi
    cfi almost 10 years
    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.