Link to home
Start Free TrialLog in
Avatar of prsubject
prsubjectFlag for India

asked on

WSDLException while parsing wsdl

When I am running wsdl2Java task I am getting the following error

[wsdl2java] [Fatal Error] StocksQuote.wsdl:11:34: The prefix "xsd" for element "xsd:schema" is not bound.
[wsdl2java] WSDLToJava Error: java.lang.RuntimeException: Fail to create wsdl definition from : file:/D:/Prasad/workspace_webservices/StockQuotation/StocksQuote.wsdl
[wsdl2java] Caused by : WSDLException: faultCode=PARSER_ERROR: Problem parsing 'file:/D:/Prasad/workspace_webservices/StockQuotation/StocksQuote.wsdl'.: The prefix "xsd" for element "xsd:schema" is not bound.

Below is my wsdl2java anttask and wsdl
///build file
	<taskdef name="wsdl2java"
	           classname="org.apache.cxf.ant.extensions.WSDL2JavaTask"
	  		   classpathref="lib.path"/>

	<target name="Wsdl2javaBuild">
		<echo level="info" message="Generating code using wsdl2java..."/>
		<mkdir dir="${temp}"/>
		<mkdir dir="${build.dir}"/>
		<wsdl2java wsdl="StocksQuote.wsdl" 
		           sourceDestDir="${temp}"
		           destDir="${build.dir}"/>
	</target>

////StocksQuote.wsdl
<definitions
  targetNamespace="http://com.stockquote/wsdl"
  xmlns="http://schemas.xmlsoap.org/wsdl/"
  xmlns:tns="http://w3.ibm.com/schemas/services/2002/11/15/stockquote/wsdl"
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
  xmlns:types="http://com.stockquote">
   <types>
     <xsd:schema elementFormDefault="qualified"
        targetNamespace=
        "http://com.stockquote/">
          <import namespace=
                "http://com.stockquote/"
             location="StockQuote.xsd/" />
     </xsd:schema>
   </types>
   <message name="getStockQuoteReq">
     <part name="parameters" element="types:getStockQuote" />
   </message>
   <message name="getStockQuoteResp">
     <part name="parameters" element="types:getStockQuoteResponse" />
   </message>
   <portType name="StockQuotePortType">
        <operation name="getStockQuote">
             <input message="tns:getStockQuoteReq" />
             <output message="tns:getStockQuoteResp" />
        </operation>
   </portType>
<binding name="StockQuoteSOAPBinding" type="tns:StockQuotePortType">
           <soap:binding style="document"
              transport="http://schemas.xmlsoap.org/soap/http" />
           <operation name="getStockQuote">
                <soap:operation style="document" soapAction="getStockQuote" />
                <input>
                     <soap:body use="literal" />
                </input>
                <output>
                     <soap:body use="literal" />
                </output>
           </operation>
      </binding>
      <service name="StockQuoteService">
           <port name="StockQuoteSOAPPort" binding="tns:StockQuoteSOAPBinding">
                <soap:address
                   location=
                   "http://localhost:8080/AxisWeb/services/StockQuoteSOAPPort" />
           </port>
      </service>
</definitions>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Venabili
Venabili
Flag of Bulgaria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of prsubject

ASKER

I added the above line it is giving the following error


    [echo] Generating code using wsdl2java...
[wsdl2java] WSDLToJava Error:
[wsdl2java]  Summary:  Failures: 1, Warnings: 0
[wsdl2java]  <<< ERROR!
[wsdl2java] file:/D:/Prasad/workspace_webservices/StockQuotation/src/com/stockquote/StocksQuote.wsdl:[46,80]
[wsdl2java]  Caused by {http://w3.ibm.com/schemas/services/2002/11/15/stockquote/wsdl}[binding:StockQuoteSOAPBinding] not exist.