这里是两个版本的,
弄mule2.2的时候发现可以在 配置文件中通过<cxf:inbound-endpoint address="http://hostname:port/service" />发布一个WebService 最近又发布了3.0,因为他有热部署,所以想升级到3.0, 可用了3.0以后,发现 mule-module-cxf-3.0.1 包里面没有了 inbound-endpoint 元素 以前写格式的也不能用了 用3.0写了个简单的测试例子: <model name="PublishSubscibeMode"> <service name="PublishSubscibeService"> <inbound> <inbound-endpoint address="http://localhost:9990/service/PublishSubscibeService" exchange-pattern="request-response"> <cxf:jaxws-service serviceClass="com.broadtext.service.IPublishSubscibeService" /> </inbound-endpoint> </inbound> <component> <singleton-object class="com.broadtext.service.impl.PublishSubscibeService"></singleton-object> </component> </service> </model> 这样能通发布成功,也能通过浏览器访问 http://localhost:9990/service/PublishSubscibeService?wsdl 下面是我写的java调用 的code public static void setup() { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.getInInterceptors().add(new LoggingInInterceptor()); factory.getOutInterceptors().add(new LoggingOutInterceptor()); factory.setServiceClass(IPublishSubscibeService.class); factory.setAddress("http://localhost:9990/service/SubscibeService"); IPublishSubscibeService publishSubscibeService = (IPublishSubscibeService) factory.create(); publishSubscibeService.registerRequest("abc"); } 调用不成功 异常如下: Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Could not find conduit initiator for transport http://schemas./soap/http at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:141) at $Proxy47.registerRequest(Unknown Source) at com.test.TestMain.setup(TestMain.java:60) at com.test.TestMain.main(TestMain.java:37) Caused by: java.lang.RuntimeException: Could not find conduit initiator for transport http://schemas./soap/http at org.apache.cxf.binding.soap.SoapTransportFactory.getConduit(SoapTransportFactory.java:148) at org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(AbstractConduitSelector.java:79) at org.apache.cxf.endpoint.UpfrontConduitSelector.prepare(UpfrontConduitSelector.java:61) at org.apache.cxf.endpoint.ClientImpl.prepareConduitSelector(ClientImpl.java:688) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:468) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:301) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:253) at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73) at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:121) ... 3 more 将 mule 3.0.0 的包全部换成了 3.0.1的
换了之后,运行测试方法setup就行了 |
|