2012-01-17 49 views
1

我使用Apache ODE來編寫一些簡單的BPEL來連接2個Web服務。 我的一個兩個服務的WSDL文件中包含此複雜類型:將complexType複製到BPEL中的消息

<types> 
<t:schema targetNamespace="http://ws.panos.com/" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
<t:complexType name="myObject"> 
    <t:sequence> 
    <t:element minOccurs="0" name="str" type="t:string" /> 
    </t:sequence> 
</t:complexType> 
</t:schema> 

我如何從服務返回消息的副本(這僅僅是一個XSD:字符串)的輸入?消息(類型爲 「myObject的」 的 「STR」 裏面

我試圖做到這一點,但似乎沒有工作:

<assign name="assign_2"> 
<copy> 
    <from variable="wsA_output" part="return"/> 
    <to variable="wsC_input" part="arg0" query="/arg0/str"/> 
</copy> 

我總是得到一個空字符串轉移。非常感謝。

回答

1

規格<to variable="..." part="..." query="..."/>在BPEL 1.1和BPEL 2.0中無效。正確的等效表達式是:<to>$wsC_input.arg0/arg0/str</to><to variable="wsC_input" part="arg0"><query>/arg0/str</query></to>。請確保在將值分配給嵌套結構之前初始化該變量。

+0

剛剛發現什麼錯誤了。感謝人!將在此主題下的另一篇文章中詳細介紹它。 – Panos 2012-01-18 14:47:34

+0

嗨@vanto,如果complexType myObject有兩個元素,我只是想將輸入字符串映射到那個「str」元素,我需要關聯嗎? – eskalera 2013-03-06 11:13:47

0

剛發現錯誤。你說得對,我們需要以查詢找到這樣的領域:

<assign name="assign_2"> 
<copy> 
    <from variable="wsA_output" part="return"/> 
      <to>$wsC_input.message/arg0/str</to> 
</copy> 
</assign> 

此外,我們還需要初始化像這樣的變量:

<assign name="assign_init"> 
<copy> 
    <from> 
     <literal><arg0><str xmlns="">nothing</str></arg0></literal> 
    </from> 
    <to variable="wsC_input" part="arg0"></to> 
</copy> 
</assign> 

的的xmlns =「」在需要的時候您的bpel中的默認命名空間與接收Web服務中的命名空間不同。

我只是寫這些下來以供將來參考:)

再次,感謝您的回答。

一些鏈接,還可以幫助其他人:

http://ode.apache.org/faq.html

http://jee-bpel-soa.blogspot.com/2009/08/manipulating-ws-bpel-variables-and.html