title: Error generating web service client from wsdl using apache CXF 3
body: <p>I am trying to generate the web service client from WSDL , I am quiet new to this so can't figure out the error.
  I have tried:</p>
  
  <pre><code>wsimport -keep path-to-wsdl
  </code></pre>
  
  <p>which gives me this error :</p>
  
  <pre><code>C:\WINDOWS\system32&gt;wsimport -keep  E:\NIEsocketWork\sdl.wsdl
  parsing WSDL...
  
  
  [WARNING] src-resolve.4.2: Error resolving component 'tns:GetMerchantRateRequest'. It was detected that 'tns:GetMerchantRateRequest' is in namespace 'http://www.fexcodcc.com/DCC20071126', but components from this namespace are not referenceable from schema document 'file:/E:/NIEsocketWork/sdl.wsdl#types?schema1'. If this is the incorrect namespace, perhaps the prefix of 'tns:GetMerchantRateRequest' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'file:/E:/NIEsocketWork/sdl.wsdl#types?schema1'.
    line 20 of file:/E:/NIEsocketWork/sdl.wsdl#types?schema1
  
  [WARNING] src-resolve: Cannot resolve the name 'tns:GetMerchantRateRequest' to a(n) 'type definition' component.
    line 20 of file:/E:/NIEsocketWork/sdl.wsdl#types?schema1
  
  [ERROR] undefined simple or complex type 'tns:GetMerchantRateRequest'
    line 20 of file:/E:/NIEsocketWork/sdl.wsdl
  
  [ERROR] undefined simple or complex type 'tns:GetMerchantRateResponse'
    line 26 of file:/E:/NIEsocketWork/sdl.wsdl
  
  [ERROR] undefined simple or complex type 'tns:GetCardRateRequest'
    line 79 of file:/E:/NIEsocketWork/sdl.wsdl
  
  [ERROR] undefined simple or complex type 'tns:GetCardRateResponse'
    line 85 of file:/E:/NIEsocketWork/sdl.wsdl
  
  Exception in thread "main" com.sun.tools.internal.ws.wscompile.AbortException
          at com.sun.tools.internal.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(JAXBModelBuilder.java:129)
          at com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler.buildJAXBModel(WSDLModeler.java:2283)
          at com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:183)
          at com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:126)
          at com.sun.tools.internal.ws.wscompile.WsimportTool.buildWsdlModel(WsimportTool.java:429)
          at com.sun.tools.internal.ws.wscompile.WsimportTool.run(WsimportTool.java:190)
          at com.sun.tools.internal.ws.wscompile.WsimportTool.run(WsimportTool.java:168)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:483)
          at com.sun.tools.internal.ws.Invoker.invoke(Invoker.java:159)
          at com.sun.tools.internal.ws.WsImport.main(WsImport.java:42)
  </code></pre>
  
  <p>I have also tried apache cxf 3.1.1 to generate the web service client in eclipse but get this error :</p>
  
  <pre><code>Loading FrontEnd jaxws ...
  Loading DataBinding jaxb ...
  wsdl2java -client -d C:\Users\Hamza\GalileoWorkspace\NIDCCFexco\.cxftmp/src -classdir C:\Users\Hamza\GalileoWorkspace\NIDCCFexco\build\classes -p http://www.fexcodcc.com/DCC20071126=com.fexcodcc.dcc20071126 -impl -validate -exsh false -dns true -dex true -wsdlLocation file:///E:/NIEsocketWork/sdl.wsdl -verbose -defaultValues -fe jaxws -db jaxb -wv 1.1 file:/E:/NIEsocketWork/sdl.wsdl
  wsdl2java - Apache CXF 3.1.1
  
  
  WSDLToJava Error: 
   Summary:  Failures: 4, Warnings: 0
  
   &lt;&lt;&lt; ERROR! 
  Part &lt;parameters&gt; in Message &lt;{http://www.fexcodcc.com/DCC20071126}GetMerchantRateOut&gt; referenced Type &lt;{http://www.fexcodcc.com/DCC20071126}GetMerchantRateResult&gt; can not be found in the schemas
  Part &lt;parameters&gt; in Message &lt;{http://www.fexcodcc.com/DCC20071126}GetCardRateOut&gt; referenced Type &lt;{http://www.fexcodcc.com/DCC20071126}GetCardRateResult&gt; can not be found in the schemas
  Part &lt;parameters&gt; in Message &lt;{http://www.fexcodcc.com/DCC20071126}GetCardRateIn&gt; referenced Type &lt;{http://www.fexcodcc.com/DCC20071126}GetCardRate&gt; can not be found in the schemas
  Part &lt;parameters&gt; in Message &lt;{http://www.fexcodcc.com/DCC20071126}GetMerchantRateIn&gt; referenced Type &lt;{http://www.fexcodcc.com/DCC20071126}GetMerchantRate&gt; can not be found in the schemas
  
  
  
  org.apache.cxf.tools.common.ToolException: 
   Summary:  Failures: 4, Warnings: 0
  
   &lt;&lt;&lt; ERROR! 
  Part &lt;parameters&gt; in Message &lt;{http://www.fexcodcc.com/DCC20071126}GetMerchantRateOut&gt; referenced Type &lt;{http://www.fexcodcc.com/DCC20071126}GetMerchantRateResult&gt; can not be found in the schemas
  Part &lt;parameters&gt; in Message &lt;{http://www.fexcodcc.com/DCC20071126}GetCardRateOut&gt; referenced Type &lt;{http://www.fexcodcc.com/DCC20071126}GetCardRateResult&gt; can not be found in the schemas
  Part &lt;parameters&gt; in Message &lt;{http://www.fexcodcc.com/DCC20071126}GetCardRateIn&gt; referenced Type &lt;{http://www.fexcodcc.com/DCC20071126}GetCardRate&gt; can not be found in the schemas
  Part &lt;parameters&gt; in Message &lt;{http://www.fexcodcc.com/DCC20071126}GetMerchantRateIn&gt; referenced Type &lt;{http://www.fexcodcc.com/DCC20071126}GetMerchantRate&gt; can not be found in the schemas
  
  
      at org.apache.cxf.tools.validator.internal.WSDL11Validator.isValid(WSDL11Validator.java:139)
      at org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder.validate(JAXWSDefinitionBuilder.java:207)
      at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:204)
      at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:164)
      at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:415)
      at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
      at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
      at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
      at org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:184)
  </code></pre>
  
  <p>My WSDL file is :</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8" ?&gt;
  
  &lt;wsdl:definitions targetNamespace="http://www.fexcodcc.com/DCC20071126" 
  xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
  xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
  xmlns:tns="http://www.fexcodcc.com/DCC20071126" 
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
  xmlns:wsi="http://ws-i.org/schemas/conformanceClaim/" 
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
  
  &lt;wsdl:documentation&gt;DCC Gateway (Provides functionality to make requests to the DCC for availability)&lt;/wsdl:documentation&gt;
  
  &lt;!-- Types --&gt; &lt;wsdl:types&gt;
  
  &lt;xsd:schema elementFormDefault="qualified" targetNamespace="http:// www.fexcodcc.com/DCC20071126" xmlns:dhs="urn:dhs"&gt;
  &lt;!-- Type definitions --&gt;
  &lt;xsd:element name="GetMerchantRate"&gt; &lt;xsd:complexType&gt;
  &lt;xsd:sequence&gt;
  &lt;xsd:element name="GetMerchantRateRequest" type="tns:GetMerchantRateRequest" minOccurs="1" maxOccurs="1"/&gt;
  
  &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;
  &lt;xsd:element name="GetMerchantRateResult"&gt; &lt;xsd:complexType&gt;
  &lt;xsd:sequence&gt;
  &lt;xsd:element name="GetMerchantRateResponse" type="tns:GetMerchantRateResponse" minOccurs="1" maxOccurs="1" /&gt;
  
  &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;
  &lt;!-- Complex type definitions --&gt;
  
  &lt;xsd:complexType name="GetMerchantRateResponse"&gt; &lt;xsd:sequence&gt;
  
  &lt;xsd:element name="ReferenceNumber" type="xsd:string" minOccurs="1" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="ExchangeRate" type="xsd:string" minOccurs="0" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="FgnCurCode" type="xsd:string" minOccurs="0" maxOccurs="1" /&gt;
  
  
  
  &lt;xsd:element name="FgnAmount" type="xsd:string" minOccurs="0" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="DccOffered" type="xsd:string" minOccurs="0" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="ValidHours" type="xsd:string" minOccurs="0" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="MarginRatePercentage" type="xsd:string" minOccurs="0" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="ExchangeRateSourcename" type="xsd:string" minOccurs="0" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="CommissionPercentage" type="xsd:string" minOccurs="0" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="ExchangerateSourceTimestamp" type="xsd:string" minOccurs="0" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="MinorUnits" type="xsd:string" minOccurs="0" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="ResponseCode" type="xsd:string" minOccurs="1" maxOccurs="1" /&gt;
  
  &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt;
  
  &lt;xsd:complexType name="GetMerchantRateRequest"&gt; &lt;xsd:sequence&gt;
  
  &lt;xsd:element name="ReferenceNumber" type="xsd:string" minOccurs="1" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="MerchantId" type="xsd:string" minOccurs="1" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="Acquirer" type="xsd:string" minOccurs="1" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="FgnCurCode" type="xsd:string" minOccurs="1" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="BaseAmount" type="xsd:string" minOccurs="0" maxOccurs="1" /&gt;
  
  &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt;
  
  &lt;xsd:element name="GetCardRate"&gt; &lt;xsd:complexType&gt;
  &lt;xsd:sequence&gt;
  
  &lt;xsd:element name="GetCardRateRequest" type="tns:GetCardRateRequest" minOccurs="1" maxOccurs="1" /&gt;
  
  &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;
  &lt;xsd:element name="GetCardRateResult"&gt; &lt;xsd:complexType&gt;
  &lt;xsd:sequence&gt;
  &lt;xsd:element name ="GetCardRateResponse" type="tns:GetCardRateResponse" minOccurs="1" maxOccurs="1" /&gt;
  
  &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;
  
  &lt;!-- Complex type definitions --&gt; &lt;xsd:complexType name="GetCardRateResponse"&gt;
  &lt;xsd:sequence&gt;
  &lt;xsd:element name="ReferenceNumber" type="xsd:string" minOccurs="1" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="ExchangeRate" type="xsd:string" minOccurs="0" maxOccurs="1" /&gt;
  
  
  &lt;xsd:element name="FgnCurCode" type="xsd:string" minOccurs="0" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="FgnAmount" type="xsd:string" minOccurs="0" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="DccOffered" type="xsd:string" minOccurs="0" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="ValidHours" type="xsd:string" minOccurs="0" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="MarginRatePercentage" type="xsd:string" minOccurs="0" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="ExchangeRateSourceName" type="xsd:string" minOccurs="0" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="CommissionPercentage" type="xsd:string" minOccurs="0" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="ExchangeRateSourceTimestamp" type="xsd:string" minOccurs="0" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="MinorUnits" type="xsd:string" minOccurs="0" maxOccurs="1" /&gt;&lt;xsd:element name="ResponseCode" type="xsd:string" minOccurs="1" maxOccurs="1" /&gt;
  
  &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt;
  
  &lt;xsd:complexType name="GetCardRateRequest"&gt; &lt;xsd:sequence&gt;
  
  &lt;xsd:element name="ReferenceNumber" type="xsd:string" minOccurs="1" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="CardId" type="xsd:string" minOccurs="1" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="MerchantId" type="xsd:string" minOccurs="1" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="Acquirer" type="xsd:string" minOccurs="1" maxOccurs="1" /&gt;
  
  &lt;xsd:element name="BaseAmount" type="xsd:string" minOccurs="0" maxOccurs="1" /&gt;
  
  &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt;
  
  &lt;/xsd:schema&gt; &lt;/wsdl:types&gt;
  
  &lt;!-- Dhs Server Messages --&gt; &lt;wsdl:message name="GetMerchantRateIn"&gt;
  
  &lt;wsdl:part name="parameters" element="tns:GetMerchantRate" /&gt; &lt;/wsdl:message&gt;
  &lt;wsdl:message name="GetMerchantRateOut"&gt;
  &lt;wsdl:part name="parameters" element="tns:GetMerchantRateResult" /&gt; &lt;/wsdl:message&gt;
  &lt;wsdl:message name="GetCardRateIn"&gt;
  &lt;wsdl:part name="parameters" element="tns:GetCardRate" /&gt; &lt;/wsdl:message&gt;
  &lt;wsdl:message name="GetCardRateOut"&gt;
  
  &lt;wsdl:part name="parameters" element="tns:GetCardRateResult" /&gt; &lt;/wsdl:message&gt;
  &lt;!-- End of Dhs Server Messages --&gt;
  
  
  &lt;!-- Port types --&gt; &lt;wsdl:portType name="DHS"&gt;
  &lt;wsdl:operation name="getMerchantRate"&gt;
  
  &lt;wsdl:documentation&gt;Get Exchange Rate for merchant&lt;/wsdl:documentation&gt; &lt;wsdl:input message="tns:GetMerchantRateIn" /&gt;
  
  &lt;wsdl:output message="tns:GetMerchantRateOut" /&gt; &lt;/wsdl:operation&gt;
  &lt;wsdl:operation name="getCardRate"&gt;
  &lt;wsdl:documentation&gt;Get Dynamic Currency conversion&lt;/wsdl:documentation&gt; &lt;wsdl:input message="tns:GetCardRateIn" /&gt;
  
  &lt;wsdl:output message="tns:GetCardRateOut" /&gt; &lt;/wsdl:operation&gt;
  
  &lt;!-- End of Dhs Server Operations --&gt; &lt;/wsdl:portType&gt;
  
  &lt;!-- WSDL bindings --&gt;
  
  &lt;wsdl:binding name="DHS12" type="tns:DHS"&gt; &lt;wsdl:documentation&gt;
  
  &lt;wsi:Claim conformsTo="http://ws-i.org/profiles/basic/1.1" /&gt; &lt;/wsdl:documentation&gt;
  
  &lt;soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /&gt;
  &lt;wsdl:operation name="getMerchantRate"&gt;
  &lt;soap12:operation soapAction="http://www.fexcodcc.com/DCC20071126/ getMerchantRate" style="document" /&gt;
  &lt;wsdl:input&gt;
  &lt;soap12:body use="literal" /&gt; &lt;/wsdl:input&gt;
  &lt;wsdl:output&gt;
  &lt;soap12:body use="literal" /&gt; &lt;/wsdl:output&gt;
  &lt;/wsdl:operation&gt;
  &lt;wsdl:operation name="getCardRate"&gt;
  
  &lt;soap12:operation soapAction="http://www.fexcodcc.com/DCC20071126/ getCardRate" style="document" /&gt;
  &lt;wsdl:input&gt;
  &lt;soap12:body use="literal" /&gt; &lt;/wsdl:input&gt;
  &lt;wsdl:output&gt;
  &lt;soap12:body use="literal" /&gt; &lt;/wsdl:output&gt;
  
  &lt;/wsdl:operation&gt; &lt;/wsdl:binding&gt;
  &lt;!-- WSDL service --&gt;
  
  &lt;wsdl:service name="DHS"&gt;
  
  &lt;wsdl:documentation&gt; DHS Server(Provides functionality to make DCC availability requests)&lt;/wsdl:documentation&gt;
  &lt;wsdl:port name="DHS12" binding="tns:DHS12"&gt;
  
  &lt;soap12:address location="dhstest2.fexcodccapps.com/axis2/services/DHS"  /&gt;
  &lt;/wsdl:port&gt;
  
  &lt;/wsdl:service&gt;
  &lt;/wsdl:definitions&gt;
  </code></pre>
  
  <p>please help me figure out the error in any of the ways, whether wsimport or apache cxf. I will be really grateful.</p>