Hi,
I'm having trouble connecting a client to a SOAP server. Both the client
and server are implemented using CXF. I can connect to the service using
SoapUI just fine.
I've pasted in the client code, the output and exception I get when
running it, and the maven pom.xml so you've got everything. Any answers
gratefully received.
Matthew
import uk.ac.ncl.cs.instantsoap.wsapi.*;
import static uk.ac.ncl.cs.instantsoap.wsapi.Wsapi.*;
import org.apache.cxf.jaxws.*;
import java.util.Map;
public class Client
{
public static void main(String[] args)
throws Throwable
{
if(args.length != 1)
{
System.out.println("Use: Client serviceUrl");
System.exit(1);
}
String serviceUrl = args[0];
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(WebServiceDispatcher.class);
factory.setAddress(serviceUrl);
WebServiceDispatcher dispatcher = (WebServiceDispatcher)
factory.create();
JobSpecification js = jobSpecification(
"echoString",
pair("messageIn", "Hi Mum!"));
Map<String, String> results = invoke(dispatcher, js);
System.out.println("The message was: " + results.get("messageOut"));
}
}
$ java -classpath target/testClient-1.0-jar-with-dependencies.jar Client
http://localhost:8080/instantsoap-ws-echotest-1.0/services/instantsoap/applications
30-Apr-2008 18:42:31
org.springframework.context.support.AbstractApplicationContext
prepareRefresh
INFO: Refreshing [EMAIL PROTECTED]:
display name [EMAIL PROTECTED];
startup date [Wed Apr 30 18:42:31 BST 2008]; root of context hierarchy
30-Apr-2008 18:42:31 org.apache.cxf.bus.spring.BusApplicationContext
getConfigResources
INFO: No cxf.xml configuration file detected, relying on defaults.
30-Apr-2008 18:42:31
org.springframework.context.support.AbstractApplicationContext
obtainFreshBeanFactory
INFO: Bean factory for application context
[EMAIL PROTECTED]:
[EMAIL PROTECTED]
30-Apr-2008 18:42:31
org.springframework.context.support.AbstractApplicationContext$BeanPostProcessorChecker
postProcessAfterInitialization
INFO: Bean 'org.apache.cxf.bus.spring.Jsr250BeanPostProcessor' is not
eligible for getting processed by all BeanPostProcessors (for example: not
eligible for auto-proxying)
30-Apr-2008 18:42:31
org.springframework.context.support.AbstractApplicationContext$BeanPostProcessorChecker
postProcessAfterInitialization
INFO: Bean 'org.apache.cxf.bus.spring.BusExtensionPostProcessor' is not
eligible for getting processed by all BeanPostProcessors (for example: not
eligible for auto-proxying)
30-Apr-2008 18:42:31
org.springframework.beans.factory.support.DefaultListableBeanFactory
preInstantiateSingletons
INFO: Pre-instantiating singletons in
[EMAIL PROTECTED]:
defining beans
[cxf,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder,org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder,org!
.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory,org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory];
root of factory hierarchy
30-Apr-2008 18:42:32
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromClass
INFO: Creating Service
{http://wsapi.instantsoap.cs.ncl.ac.uk/}WebServiceDispatcherService from
class uk.ac.ncl.cs.instantsoap.wsapi.WebServiceDispatcher
30-Apr-2008 18:42:33
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
fillInSchemaCrossreferences
SEVERE: Schema element
{http://cs.ncl.ac.uk/instantsoap/service}jobSpecification references
undefined type {http://www.w3.org/2001/XMLSchema}anyType for service
{http://wsapi.instantsoap.cs.ncl.ac.uk/}WebServiceDispatcherService.
Exception in thread "main"
org.apache.cxf.service.factory.ServiceConstructionException: Could not
resolve a binding for null
at
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingInfo(AbstractWSDLBasedEndpointFactory.java:310)
at
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointInfo(AbstractWSDLBasedEndpointFactory.java:178)
at
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102)
at
org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:51)
at
org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:97)
at
org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:89)
at Client.main(Client.java:21)
Caused by: org.apache.cxf.BusException: No binding factory for namespace
http://schemas.xmlsoap.org/soap/ registered.
at
org.apache.cxf.binding.BindingFactoryManagerImpl.getBindingFactory(BindingFactoryManagerImpl.java:91)
at
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingInfo(AbstractWSDLBasedEndpointFactory.java:300)
... 6 more
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mygroup</groupId>
<artifactId>testClient</artifactId>
<packaging>jar</packaging>
<name>Test Client for instantsoap</name>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>uk.ac.ncl.cs.instantsoap</groupId>
<artifactId>instantsoap-api</artifactId>
<version>1.0</version>
</dependency>
<!-- CXF -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>2.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>2.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>2.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>fluxion</id>
<name>Fluxion repository</name>
<url>http://metagenome.ncl.ac.uk/fluxions/repo</url>
</repository>
<repository>
<id>apache-snapshots</id>
<name>Apache SNAPSHOT Repository</name>
<url>http://people.apache.org/repo/m2-snapshot-repository/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>apache-incubating</id>
<name>Apache Incubating Repository</name>
<url>http://people.apache.org/repo/m2-incubating-repository/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>fluxion</id>
<name>Fluxion repository</name>
<url>http://metagenome.ncl.ac.uk/fluxions/repo</url>
</pluginRepository>
</pluginRepositories>
</project>