简体   繁体   中英

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

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>

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM