我在我的應用程序上下文駱駝路線定義爲阿帕奇駱駝的XPath條件路由
<camelContext xmlns="http://camel.apache.org/schema/spring"
trace="true" id="camel">
<route id="wsProxyRedirection">
<from uri="cxf:bean:cdcPocProxyWebServiceStartPoint" />
<choice>
<when>
<xpath>//soapenv:Envelope/soapenv:Body/hel:sayHello/toWhom = 'normal'</xpath>
<to uri="jms:queue:normalQueue" />
</when>
<when>
<xpath>//soapenv:Envelope/soapenv:Body/hel:sayHello/toWhom = 'urgent'</xpath>
<to uri="jms:queue:urgentQueue" />
</when>
<when>
<xpath>//soapenv:Envelope/soapenv:Body/hel:sayHello/toWhom = 'veryUrgent'</xpath>
<to uri="jms:queue:veryUrgentQueue" />
</when>
</choice>
</route>
</camelContext>
,我發送請求爲:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hel="http://cxf.apache.org/wsse/handler/helloworld">
<soapenv:Header/>
<soapenv:Body>
<hel:sayHello>
<toWhom>normal</toWhom>
</hel:sayHello>
</soapenv:Body>
</soapenv:Envelope>
但我得到的迴應是:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Error during type conversion from type: java.lang.String to the required type: org.w3c.dom.Document with value test due org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
這只是一個簡單的選擇POC,但我不能使它的工作......我有什麼需要改變我的xpath條件?
謝謝
感謝它的工作! – ggwtf