You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by da...@akamai.com on 2009/07/12 19:06:40 UTC

Problem with dynamic client in CXF-2.2.2

Hi -

I'm trying to learn how to build a dynamic client using
CXF-2.2.2, and I'm having a problem right at the beginning with
the reading of the WSDL where it complains that it can't do the
code generation for the WSDL.

To begin with, here's the WSDL (autogenerated by axis on the server) for
a toy service (which does indeed work):
------------------------------------------------------------------------
<wsdl:definitions targetNamespace="http://localhost:8080/axis/HelloService.jws">

  <!--
    WSDL created by Apache Axis version: 1.4
    Built on Apr 22, 2006 (06:55:48 PDT)
  -->

  <wsdl:message name="doServiceResponse">
    <wsdl:part name="doServiceReturn" type="xsd:string"/>
  </wsdl:message>
  <wsdl:message name="doServiceRequest"></wsdl:message>

  <wsdl:portType name="HelloService"> 
    <wsdl:operation name="doService">
      <wsdl:input message="impl:doServiceRequest" name="doServiceRequest"/>
      <wsdl:output message="impl:doServiceResponse" name="doServiceResponse"/>
    </wsdl:operation>
  </wsdl:portType>

  <wsdl:binding name="HelloServiceSoapBinding" type="impl:HelloService">
    <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="doService">
      <wsdlsoap:operation soapAction=""/>
      <wsdl:input name="doServiceRequest">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" use="encoded"/>
      </wsdl:input>
      <wsdl:output name="doServiceResponse">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/axis/HelloService.jws" use="encoded"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>

  <wsdl:service name="HelloServiceService">
    <wsdl:port binding="impl:HelloServiceSoapBinding" name="HelloService">
      <wsdlsoap:address location="http://localhost:8080/axis/HelloService.jws"/>
    </wsdl:port>
  </wsdl:service>

</wsdl:definitions>
------------------------------------------------------------------------

The client I'm running (HelloClient.java -- stripped down to the
minimum to show the problem I'm having) is as follows:

------------------------------------------------------------------------
package foo;

import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
import org.apache.cxf.endpoint.Client;

public final class HelloClient {

    public static void main(String[] args) {
        String wsdl = args[0];
        System.out.println("The WSDL is at:  " + wsdl + "    # sanity check"); 

        JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance();
        Client client = factory.createClient(wsdl);
    }
}
------------------------------------------------------------------------

which, when compiled and run give:

------------------------------------------------------------------------
$ ls
foo

$ ls foo/
HelloClient.java

$ java -version
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) Server VM (build 10.0-b23, mixed mode)

$ javac -version
javac 1.6.0_07

$ javac -cp /home/dakatz/archive/jlibs/apache-cxf-2.2.2/lib/cxf-2.2.2.jar  foo/HelloClient.java

$ # Following CXF directions, use the JAXB jars in the CXF distribution 
$ # rather than the ones in the JRE.
$ #
$ java -cp .:/home/dakatz/archive/jlibs/apache-cxf-2.2.2/lib/cxf-2.2.2.jar:/home/dakatz/archive/jlibs/apache-cxf-2.2.2/lib/wsdl4j-1.6.2.jar:/home/dakatz/archive/jlibs/apache-cxf-2.2.2/lib/XmlSchema-1.4.5.jar:/home/dakatz/archive/jlibs/apache-cxf-2.2.2/lib/jaxb-xjc-2.1.9.jar:/home/dakatz/archive/jlibs/apache-cxf-2.2.2/lib/jaxb-impl-2.1.9.jar foo.HelloClient http://localhost:8080/axis/HelloService.jws?wsdl
The WSDL is at:  http://localhost:8080/axis/HelloService.jws?wsdl    # sanity check
Jul 12, 2009 12:31:22 PM org.apache.cxf.endpoint.dynamic.DynamicClientFactory outputDebug
INFO: Created classes: 
 javac: no source files
 Usage: javac <options> <source files>
 use -help for a list of possible options
Jul 12, 2009 12:31:22 PM org.apache.cxf.endpoint.dynamic.DynamicClientFactory createClient
SEVERE: Could not compile java files for http://localhost:8080/axis/HelloService.jws?wsdl.
$
------------------------------------------------------------------------

Any suggestions on where to start?  I saw something in this list from
2007 (I think) which discussed a similar symptom and laid it at the feet
of an old javac implementation, but my javac version is clearly decently
recent...

Thanks!

Dan

Re: Problem with dynamic client in CXF-2.2.2

Posted by Benson Margulies <bi...@gmail.com>.
cxf does not support rpc/encoded. just about nothing does except axis.

On Jul 12, 2009, at 1:06 PM, dakatz@akamai.com wrote:

>
> Hi -
>
> I'm trying to learn how to build a dynamic client using
> CXF-2.2.2, and I'm having a problem right at the beginning with
> the reading of the WSDL where it complains that it can't do the
> code generation for the WSDL.
>
> To begin with, here's the WSDL (autogenerated by axis on the server)  
> for
> a toy service (which does indeed work):
> --- 
> ---------------------------------------------------------------------
> <wsdl:definitions targetNamespace="http://localhost:8080/axis/HelloService.jws 
> ">
>
>  <!--
>    WSDL created by Apache Axis version: 1.4
>    Built on Apr 22, 2006 (06:55:48 PDT)
>  -->
>
>  <wsdl:message name="doServiceResponse">
>    <wsdl:part name="doServiceReturn" type="xsd:string"/>
>  </wsdl:message>
>  <wsdl:message name="doServiceRequest"></wsdl:message>
>
>  <wsdl:portType name="HelloService">
>    <wsdl:operation name="doService">
>      <wsdl:input message="impl:doServiceRequest"  
> name="doServiceRequest"/>
>      <wsdl:output message="impl:doServiceResponse"  
> name="doServiceResponse"/>
>    </wsdl:operation>
>  </wsdl:portType>
>
>  <wsdl:binding name="HelloServiceSoapBinding"  
> type="impl:HelloService">
>    <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http 
> "/>
>    <wsdl:operation name="doService">
>      <wsdlsoap:operation soapAction=""/>
>      <wsdl:input name="doServiceRequest">
>        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/ 
> " namespace="http://DefaultNamespace" use="encoded"/>
>      </wsdl:input>
>      <wsdl:output name="doServiceResponse">
>        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/ 
> " namespace="http://localhost:8080/axis/HelloService.jws"  
> use="encoded"/>
>      </wsdl:output>
>    </wsdl:operation>
>  </wsdl:binding>
>
>  <wsdl:service name="HelloServiceService">
>    <wsdl:port binding="impl:HelloServiceSoapBinding"  
> name="HelloService">
>      <wsdlsoap:address location="http://localhost:8080/axis/HelloService.jws 
> "/>
>    </wsdl:port>
>  </wsdl:service>
>
> </wsdl:definitions>
> --- 
> ---------------------------------------------------------------------
>
> The client I'm running (HelloClient.java -- stripped down to the
> minimum to show the problem I'm having) is as follows:
>
> --- 
> ---------------------------------------------------------------------
> package foo;
>
> import  
> org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
> import org.apache.cxf.endpoint.Client;
>
> public final class HelloClient {
>
>    public static void main(String[] args) {
>        String wsdl = args[0];
>        System.out.println("The WSDL is at:  " + wsdl + "    # sanity  
> check");
>
>        JaxWsDynamicClientFactory factory =  
> JaxWsDynamicClientFactory.newInstance();
>        Client client = factory.createClient(wsdl);
>    }
> }
> --- 
> ---------------------------------------------------------------------
>
> which, when compiled and run give:
>
> --- 
> ---------------------------------------------------------------------
> $ ls
> foo
>
> $ ls foo/
> HelloClient.java
>
> $ java -version
> java version "1.6.0_07"
> Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
> Java HotSpot(TM) Server VM (build 10.0-b23, mixed mode)
>
> $ javac -version
> javac 1.6.0_07
>
> $ javac -cp /home/dakatz/archive/jlibs/apache-cxf-2.2.2/lib/ 
> cxf-2.2.2.jar  foo/HelloClient.java
>
> $ # Following CXF directions, use the JAXB jars in the CXF  
> distribution
> $ # rather than the ones in the JRE.
> $ #
> $ java -cp .:/home/dakatz/archive/jlibs/apache-cxf-2.2.2/lib/ 
> cxf-2.2.2.jar:/home/dakatz/archive/jlibs/apache-cxf-2.2.2/lib/ 
> wsdl4j-1.6.2.jar:/home/dakatz/archive/jlibs/apache-cxf-2.2.2/lib/ 
> XmlSchema-1.4.5.jar:/home/dakatz/archive/jlibs/apache-cxf-2.2.2/lib/ 
> jaxb-xjc-2.1.9.jar:/home/dakatz/archive/jlibs/apache-cxf-2.2.2/lib/ 
> jaxb-impl-2.1.9.jar foo.HelloClient http://localhost:8080/axis/HelloService.jws?wsdl
> The WSDL is at:  http://localhost:8080/axis/HelloService.jws?wsdl     
> # sanity check
> Jul 12, 2009 12:31:22 PM  
> org.apache.cxf.endpoint.dynamic.DynamicClientFactory outputDebug
> INFO: Created classes:
> javac: no source files
> Usage: javac <options> <source files>
> use -help for a list of possible options
> Jul 12, 2009 12:31:22 PM  
> org.apache.cxf.endpoint.dynamic.DynamicClientFactory createClient
> SEVERE: Could not compile java files for http://localhost:8080/axis/HelloService.jws?wsdl 
> .
> $
> --- 
> ---------------------------------------------------------------------
>
> Any suggestions on where to start?  I saw something in this list from
> 2007 (I think) which discussed a similar symptom and laid it at the  
> feet
> of an old javac implementation, but my javac version is clearly  
> decently
> recent...
>
> Thanks!
>
> Dan