我在保险丝蓝图上公开了以下 CXF Web 服务。蓝图部署在 Fabric Profile 上:
<blueprint
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camelcxf="http://camel.apache.org/schema/blueprint/cxf"
xmlns:cxf="http://cxf.apache.org/blueprint/core"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
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/cxf http://camel.apache.org/schema/blueprint/cxf/camel-cxf.xsd
http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
<camelcxf:cxfEndpoint id="input-cxf" address="/myfuse-demo/"
serviceClass="com.sample.SourceExampleWS" />
<camelContext id="fuse-demo-route-example-cxf" xmlns="http://camel.apache.org/schema/blueprint">
<route id="demo-source-cxf">
<from uri="cxf:bean:input-cxf"/>
<transform>
<simple>
${in.body[0]}
</simple>
</transform>
<log message="Received: ${in.body}"/>
<!-- removed for brevity -->
</route>
</camelContext>
</blueprint>
SourceExampleWS 就是这个简单的界面:
package com.sample;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
@WebService
public interface SourceExampleWS {
@WebMethod int call( @WebParam( name = "struct")Struct s);
}
Struct 类只是一个 Java Bean:
package com.sample;
@XmlRootElement
public class Struct implements java.io.Serializable {
public Struct() {
}
int x;
int y;
public int getX() {
return x;
}
public int getY() {
return y;
}
public void setX(int x) { this.x = x; }
public void setY(int y) { this.y = y; }
}
问题是,当我在 Fabric 上部署包时,我无法调用 WebService 的调用方法。
从 WSDL ( http://10.1.86.122:8182/cxf/myfuse-demo?wsdl),SOAPUI生成以下 SOAP 消息:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sam="http://sample.com/">
<soapenv:Header/>
<soapenv:Body>
<sam:call>
<sam:struct>
<x>201</x>
<y>144</y>
</sam:struct>
</sam:call>
</soapenv:Body>
</soapenv:Envelope>
但我得到以下错误作为回报:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>Unmarshalling Error: unexpected element (uri:"http://sample.com/", local:"struct"). Expected elements are <{}struct></faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
我已经从数据包中删除了命名空间“sam”,但仍然收到另一个错误:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>Unexpected wrapper element call found. Expected {http://sample.com/}call.</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
知道如何解决这个问题吗?谢谢!