我新的XML,XSLT和SOAP,我想知道是否有可能這個XML文件XML到SOAP轉型
<?xml version="1.0" encoding="UTF-8"?>
<SEARCHREQUEST>
<PSSSEARCHPARAM1>Database name</PSSSEARCHPARAM1>
<PSSSEARCHPARAM2>Description</PSSSEARCHPARAM2>
<PSSSEARCHPARAM3>Document number</PSSSEARCHPARAM3>
<PSSSEARCHPARAM4>Belong To</PSSSEARCHPARAM4>
</SEARCHREQUEST>
轉換成使用XSLT這個SOAP請求
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header/>
<soap:Body>
<wor:SearchDocuments xmlns:wor="http://worksite.imanage.com">
<wor:Databases>
<wor:string>Database name</wor:string>
</wor:Databases>
<wor:ProfileSearchParameters>
<wor:ProfileSearchParameter>
<wor:AttributeID>imProfileDescription</wor:AttributeID>
<wor:SearchValue>Description</wor:SearchValue>
</wor:ProfileSearchParameter>
<wor:ProfileSearchParameter>
<wor:AttributeID>imProfileCustom3</wor:AttributeID>
<wor:SearchValue>Belong To</wor:SearchValue>
</wor:ProfileSearchParameter>
<wor:ProfileSearchParameter>
<wor:AttributeID>imProfileCustom4</wor:AttributeID>
<wor:SearchValue>APP, 20</wor:SearchValue>
</wor:ProfileSearchParameter>
<wor:ProfileSearchParameter>
<wor:AttributeID>imProfileDocNum</wor:AttributeID>
<wor:SearchValue>Document number</wor:SearchValue>
</wor:ProfileSearchParameter>
</wor:ProfileSearchParameters>
<wor:SearchEmail>imSearchDocumentsOnly</wor:SearchEmail>
<wor:OutputMask>Profile</wor:OutputMask>
<wor:OutputProfile>
<!-- Displays the document number-->
<wor:imProfileAttributeID>imProfileDocNum</wor:imProfileAttributeID>
<!-- Displays the document description/title-->
<wor:imProfileAttributeID>imProfileDescription</wor:imProfileAttributeID>
<!--Displays the document version-->
<wor:imProfileAttributeID>imProfileVersion</wor:imProfileAttributeID>
<!--Displays the standard id-->
<wor:imProfileAttributeID>imProfileCustom16</wor:imProfileAttributeID>
<!--Display the "Belong to" field-->
<wor:imProfileAttributeID>imProfileCustom3</wor:imProfileAttributeID>
<!--Displays the database name-->
<wor:imProfileAttributeID>imProfileDatabase</wor:imProfileAttributeID>
<!--Displays the document extension-->
<wor:imProfileAttributeID>imProfileExtension</wor:imProfileAttributeID>
</wor:OutputProfile>
</wor:SearchDocuments>
</soap:Body>
</soap:Envelope>
只要。如果可能的話,你能否指出一些例子來說明如何實現這一點。邁克爾凱的「XSLT 2.0和XPath 2.0程序員參考(第4版)」有很多關於如何將XML轉換爲HTML的示例,但沒有將XML轉換爲SOAP轉換。我能找到最接近的是這裏
http://wiki.netbeans.org/TransformingSOAPMessagesWithXSLT
它展示瞭如何轉換SOAP請求,這不是我所需要的。提前謝謝你的幫助。
我覺得應該很簡單,只需要在變換中聲明正確的名稱空間即可。您是否正在尋找一種轉換來生成SOP請求,然後從輸入PSSSEARCHPARAM中獲取一些值? – 2011-05-31 03:49:44
這正是我想要做的。 – 2011-05-31 03:57:11
在我的回答中,我向您展示瞭如何從您的搜索請求中獲取值,並將其放入各種'ProfileSearchParameter'中。 – 2011-05-31 04:30:51