Hi Chris, to use local transport, you need to manually register 
LocalTransportFactory with all the namespaces that might be used, for example, 
"http://schemas.xmlsoap.org/soap/http";. An example of how this is done can be 
found from 
\trunk\rt\frontend\jaxws/src/test/java/org/apache/cxf/jaxws/AbstractJaxWsTest.java.
 Actually almost all unit tests under jaxws module are written with local 
transport, so just grab one CXF unit test then copy&paste, should work. 

Cheers,
Jervis

-----Original Message-----
From: Christopher Moesel [mailto:[EMAIL PROTECTED]
Sent: 2007?7?18? 2:04
To: cxf-user@incubator.apache.org
Subject: Using Local Transport for JUnit Tests


Hello All,

I'm trying to write some JUnit tests that can test my SOAP web services
using the local transport
(http://cwiki.apache.org/CXF20DOC/local-transport.html).

Normally I run my services using the CXF Servlet, so doing it
servlet-less is somewhat new to me.  Here is what I'm doing:

Using a Spring ClassPathXmlApplicationContext to load up the following
CXF spring configs:
- META-INF/cxf/cxf.xml
- META-INF/cxf/cxf-extension-soap.xml
- META-INF/cxf/cxf-extension-policy.xml

and also loading up my own spring configs that contain the endpoint,
like so:

<jaxws:endpoint
  id="mockWebServiceEndpoint"
  implementor="#mockWebService"
  wsdlLocation="mockWebService.wsdl"
  address="local://MockWebService">
  <jaxws:features>
    <wsp:Policy>
      <mtom:OptimizedMimeSerialization wsp:Optional="true"/>
    </wsp:Policy>
  </jaxws:features>
</jaxws:endpoint>

But... when I load them up, I get an exception with the following
message:
No DestinationFactory was found for the namespace
http://schemas.xmlsoap.org/soap/http.

I suspect I'm missing a CXF config file that defines the
DestinationFactory, I'm not setting up something right on the endpoint,
or I'm just completely wrong and can't even use the local transport in
this way.

Could someone with a clue please help me out? ;)  The full stack trace
is at the bottom of this message.

-Chris

org.apache.cxf.service.factory.ServiceConstructionException
        at
org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:
105)
        at
org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBea
n.java:142)
        at
org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:277)
        at
org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:223)
        at
org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:175)
        at
org.apache.cxf.jaxws.spi.ProviderImpl.createAndPublishEndpoint(ProviderI
mpl.java:74)
        at javax.xml.ws.Endpoint.publish(Endpoint.java:156)
        at
com.myco.ws.client.BaseWebServiceTest.runsOnceBeforeAllTests(BaseWebServ
iceTest.java:59)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
        at
org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAf
terRunner.java:74)
        at
org.junit.internal.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfte
rRunner.java:50)
        at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAf
terRunner.java:33)
        at
org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
        at
com.intellij.rt.junit4.Junit4TestMethodAdapter.run(Junit4TestMethodAdapt
er.java:54)
        at
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
        at
com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: org.apache.cxf.BusException: No DestinationFactory was found
for the namespace http://schemas.xmlsoap.org/soap/http.
        at
org.apache.cxf.transport.DestinationFactoryManagerImpl.getDestinationFac
tory(DestinationFactoryManagerImpl.java:101)
        at
org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:85)
        at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69)
        at
org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:
90)
        ... 27 more

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Reply via email to