2016-11-24 112 views
1

我想知道如何從soap端點獲取請求參數。 更具體地說,我有一個基於http-listener的端點,我通過一個soap客戶端調用這個端點,我想獲得一個在這個soap請求的主體中發送的值。 下面是技術上的規格..如何從騾子的soap端點獲取請求參數?

我用騾子3.8和Anypoint工作室6.1.2

這是我的風景 這裏的一部分是我的騾子XML的一部分:

<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" 
    doc:name="HTTP Listener Configuration"/> 
<cxf:configuration name="CXF_Configuration" enableMuleSoapHeaders="true" initializeStaticBusInstance="true" 
    doc:name="CXF Configuration"/> 
<ws:consumer-config name="Web_Service_Consumer" service="KarmaService" port="KarmaPort" 
    serviceAddress="http://localhost:8080/TestingWS/Karma" wsdlLocation="http://localhost:8080/TestingWS/Karma?wsdl" doc:name="Web Service Consumer"/> 

<flow name="pichondemonoFlow"> 
    <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/> 
    <cxf:proxy-service configuration-ref="CXF_Configuration" payload="body" doc:name="CXF"/> 
    <set-variable variableName="pichonVar" value="#[message.inboundProperties.'http.query.params'.arg0]" 
     doc:name="Variable"/> 
    <choice doc:name="Choice"> 
     . 
     . 
     . 
     . 

這裏是從了SoapUI客戶端的請求:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sup="http://support.cxf.module.mule.org/"> 
    <soapenv:Header/> 
    <soapenv:Body> 
     <sup:invoke> 
     <!--Optional:--> 
     <sup:arg0>Some value</sup:arg0> 
     </sup:invoke> 
    </soapenv:Body> 
</soapenv:Envelope> 

我也閱讀一些有關xpath3但我不知道這是否是百世t解析我的xml請求的方式。 什麼是最好的方法?

希望這可以被忽略。

我很感謝有人能幫助我。 在此先感謝!

回答

0

的一種方法是使用變換郵件組件:由

<dw:transform-message metadata:id="234ee930-89d2-45ef-b888-96e940446fbe" doc:name="Transform Message"> 
    <dw:input-payload doc:sample="C:\Users\willekr\Desktop\sample.xml"/> 
     <dw:set-payload><![CDATA[ 
      %dw 1.0%output application/java 
      %namespace sup http://support.cxf.module.mule.org/ 
      %namespace soapenv http://schemas.xmlsoap.org/soap/envelope/ 
      --- 
      payload.soapenv#Envelope.soapenv#Body.sup#invoke.sup#arg0 
     ]]> 
    </dw:set-payload> 
</dw:transform-message> 
0

我並不很清楚你的意思:「我想在這個SOAP請求的身體發出了價值。」根據該聲明,我假設你想要在SOAP請求中插入一個值。您可以按上面所述嘗試數據編織。

此外,xpath是用於導航和檢索XML中的值的東西。但不能插入價值。

0

我正在處理相同的情況。 使用的Xpath解析SOAP XML和設置使用SetVariable一個變量,如果你想解析多個PARAMS使用消息屬性設置,這樣你流不會與變量序列被填滿。 乾杯!

相關問題