分享

mule3.0中发布WS的方式

 开心豆豆2010 2010-11-22
这里是两个版本的,
弄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就行了

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多