【问题标题】:How to expose a web-service with cxf:proxy-service如何使用 cxf:proxy-service 公开 Web 服务
【发布时间】:2013-02-16 06:21:38
【问题描述】:

我正在尝试在 mule 中使用“cxf:proxy-service”公开一个简单的问候 Web 服务。下面给出的是我的流程。

<flow name="WS_In">
    <http:inbound-endpoint address="http://localhost:8080/HelloService" exchange-pattern="request-response">
        <cxf:proxy-service  wsdlLocation="classpath:HelloService.wsdl" namespace="http://example.org/HelloService"/>
    </http:inbound-endpoint>        
    <component>             
        <prototype-object class="com.example.ServiceProxy">
        </prototype-object>
    </component>

    <echo-component></echo-component>
    <logger level="INFO"        />
</flow>

但它给了我如下错误:

2013-01-03 16:13:35,569 ERROR [main] construct.AbstractFlowConstruct (AbstractFlowConstruct.java:180) - Failed to stop service: WS_In
org.mule.api.lifecycle.LifecycleException: Lifecycle Manager 'WS_In.stage1' phase 'start' does not support phase 'dispose'

我的 ServiceProxy 类如下

public class ServiceProxy implements Callable, Initialisable 

请帮助我了解我在哪里错过了路径。

【问题讨论】:

    标签: java proxy cxf mule callable


    【解决方案1】:

    代替&lt;cxf:proxy-service&gt;元素中的属性'name',使用属性'service'来指定服务名称。

    【讨论】:

      【解决方案2】:

      试试这个...

      1. 从您的 WSDL 中获取服务名称并在 cxf:proxy-service 中使用它
      2. 在组件中使用类直接。

      ....

      <flow name="WS_In">
          <http:inbound-endpoint address="http://localhost:8080/HelloService" exchange-pattern="request-response">
              <cxf:proxy-service  wsdlLocation="classpath:HelloService.wsdl" namespace="http://example.org/HelloService" service="HelloService"/>
          </http:inbound-endpoint>        
          <component class="com.example.ServiceProxy" />
          <echo-component></echo-component>
          <logger level="INFO"        />
      </flow>
      

      【讨论】:

      • 运气不好。它给出了异常 org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: 属性 'name' 不允许出现在元素 'cxf:proxy-service' 中。
      • 我的错。更正了我上面的回复以使用服​​务而不是名称。
      猜你喜欢
      • 2016-09-07
      • 1970-01-01
      • 1970-01-01
      • 2011-06-18
      • 2020-12-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多