【问题标题】:Soap request using apache camel blueprint on apache karaf fails在 apache karaf 上使用 apache camel 蓝图的肥皂请求失败
【发布时间】:2015-09-14 08:25:58
【问题描述】:

我正在尝试使用骆驼蓝图发送一个肥皂请求,现在我得到了这个 blueprint.xml

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="
   http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
   http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">

<bean id="serviceBean" class="osgiBlueprintSoap.Service"/>

<cxfEndpoint id="serviceEndpoint" 
    address="{http://some.url/services/}SomeService"
    wsdlUrl="{http://some.url/services/}SomeService?wsdl"
    serviceName="{http://some.url/services/}SomeService"
    portName="{http://some.url/services/}SomeServiceSoapPort">
    <properties>
        <entry key="dataFormat" value="MESSAGE"/>
    </properties>
</cxfEndpoint>  

<camelContext xmlns="http://camel.apache.org/schema/blueprint">
  <route id="timerToLog">
    <from uri="timer:foo?period=5000"/>
    <to uri="cxf:serviceBean:serviceEndpoint"/>
    <to uri="file:C:/output?fileName=db.txt"/>
  </route>
</camelContext>

Service 类现在只是一个空类。

在 karaf 上部署后出现此错误

org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'cxfEndpoint'. One of '{"http://www.osgi.org/xmlns/blueprint/v1.0.0":service, "http://www.osgi.org/xmlns/blueprint/v1.0.0":reference-list, "http://www.osgi.org/xmlns/blueprint/v1.0.0":bean, "http://www.osgi.org/xmlns/blueprint/v1.0.0":reference, WC[##other:"http://www.osgi.org/xmlns/blueprint/v1.0.0"]}" is expected.

谁能告诉我那个 xml 有什么问题以及我可以做些什么来发送这个请求?

【问题讨论】:

    标签: java soap apache-camel apache-karaf


    【解决方案1】:

    XML 解析器出错,因为它不知道 cxfEndpoint 是什么。您必须为您的路由定义正确的 XML 命名空间才能像这样工作:

    xmlns:camelcxf="http://camel.apache.org/schema/blueprint/cxf"
    

    然后像这样“camelcxf:cxfEndpoint”引用cxfEndpoint。

    您可以在 Camel 源 here 中查看与您的问题类似的更完整的 Blueprint CXF 示例。

    【讨论】:

      猜你喜欢
      • 2015-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多