Hi all,

I am trying to get web services deployed and successfully callable from a
CXF/Karaf environment.  I have Karaf running and CXF installed and a
HelloWorld service deployed.  My problem is within the client.  I keep
running into errors.  The first error looks like this:

INFO: Creating Service {http://<snipped-namespace>}HelloWorldService from
class <snipped-package>.HelloWorld
Exception in thread "main" java.lang.NoSuchMethodError:
org.apache.ws.commons.schema.XmlSchemaCollection.read(Lorg/w3c/dom/Document;Ljava/lang/String;)Lorg/apache/ws/commons/schema/XmlSchema;
    at
org.apache.cxf.common.xmlschema.SchemaCollection.read(SchemaCollection.java:130)
    at
org.apache.cxf.databinding.AbstractDataBinding.addSchemaDocument(AbstractDataBinding.java:177)

There were a number of threads I read up to instruct me to ensure that
XmlSchema Core version 2.0.1 is in my classpath.  In my Maven POM, I have
the following:

    <dependency>
      <groupId>org.ops4j.pax.logging</groupId>
      <artifactId>pax-logging-service</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.ops4j.pax.logging</groupId>
      <artifactId>pax-logging-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-ws-metadata_2.0_spec</artifactId>
      <version>1.1.3</version>
    </dependency>
    <dependency>
      <groupId>javax.xml.bind</groupId>
      <artifactId>jaxb-api</artifactId>
      <version>2.2.5</version>
    </dependency>
    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-jaxws_2.2_spec</artifactId>
      <version>1.1</version>
    </dependency>
    <dependency>
      <groupId>org.apache.ws.xmlschema</groupId>
      <artifactId>xmlschema-core</artifactId>
      <version>2.0.1</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-frontend-jaxws</artifactId>
      <version>2.5.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-transports-http</artifactId>
      <version>2.5.0</version>
    </dependency>


The client code snippet is as follows:

JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingOutInterceptor());
factory.setServiceClass(HelloWorld.class);
factory.setAddress("http://localhost:8181/HelloWorld?wsdl";);
HelloWorld client = (HelloWorld) factory.create();
String reply = client.findById(2L);
System.out.println("Server said: " + reply);
System.exit(0);

The server side code looks like this:

@WebService()
public class HelloWorld {

    private final Logger log = LoggerFactory.getLogger(HelloWorld.class);

    @WebMethod
    public String findById(@WebParam(name = "id") Long id) {
        log.info("id: " + id);
        return "asdfasdf";
    }

    @WebMethod
    public String findByNameAndInstrument(@WebParam(name = "name") String
name,
            @WebParam(name = "instrument") String instrument) {
        return "qwerqwer";
    }

}

When I request "http://localhost:8181/cxf/HelloWorld/findById";, I am
returned a soap envelope with the body containing "asdfasdf".  This
indicates to me that the server side is fine....just something amiss with
the client.

Any suggestions?


-- 
Jason Reilly
Software Engineer

Reply via email to