<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />大家好,
為了將數據從遠程服務器導入JMP,我必須使用JSL調用SOAP Web服務。
在處理RestFul Web服務時,我曾經使用套接字來做,在URI中傳遞我的請求的參數。但實際上,我不知道如何處理SOA Web服務,因為我有一個XML要發送到服務器。我甚至不知道從哪裡開始。
所以,如果有人可以幫助我分享關於如何使用JMP腳本語言的SOAP Web服務的提示或技巧,我真的很感激。
最好的回應,
除了快速谷歌搜索之外,不熟悉SOAP Web服務......其他人?
聽起來你發送到服務器的XML和從服務器收到的XML。 我認為這些都將使用您熟悉的套接字來完成。 編寫要發送到服務器的XML文件意味著您創建一個包含所有XML開始標記的JSL字符串,並與結束標記正確平衡。 我建議編寫自己的JSL用戶函數來幫助構造發送給服務器的XML。 腳本索引包含可用於處理從服務器接收的文件的JSL ParseXML函數的示例。
makeTable = Function( {name, colnames, colmatrix}, {icol, result = ""},
result = result || "";
For( icol = 1, icol <= N Items( colnames ), icol++,
result = result || makeColumn( colnames[icol], colmatrix[0, icol] ); // 0 means all rows for column i
);
result = result || "";
);
makeColumn = Function( {name, data}, {irow, result = ""},
result = result || ""; // start tag
result = result || "["; // start bracket (not XML, this is within the XML tag)
For( irow = 1, irow <= N Rows( data ), irow++,
result = result || Char( data[irow] ) || " "
);
result = result || "]"; // matching end bracket
result = result || ""; // matching end tag
result; // return the string for this column
);
ex = makeTable( "Flintstone", {"Fred", "Wilma", "Pebbles"}, [1 2 3, 11 12 13, 111 112 113, 99 99 99] );
// above this line: sample JSL for creating an XML string to send to a server. THIS IS NOT SOAP, just
// an example of a way to make balanced XML tags.
// below this line, an example of a way to parse data received from a server. Not SOAP. I'm just
// passing the XML string built above as a demo.
// example taken from scripting index...parses TABLE and COL tags
Parse XML( ex,
On Element( "table", Start Tag( New Table( XML Attr( "name" ) ) ) ),
On Element( "col", End Tag( New Column( XML Attr( "name" ), Set Values( Parse( XML Text() ) ) ) ) )
);
注意makeTable函數是平衡的,因為它有
... 標籤只調用另一個函數makeColumn,它也是平衡的,因為它有 ... 標籤。 您可能需要更深入的SOAP嵌套;添加更多功能並使其與開始和結束標記保持平衡。Parse XML函數具有多個OnElement子句,用於指定要執行的JSL以處理各種XML標記。 艱苦的工作將是確定您需要哪些OnElement標籤以及如何處理它們。 Parse XML是一個了解XML標記如何嵌套的框架;您填寫標籤(元素)的詳細信息。此XML架構僅用於支持此示例。 它不代表任何類型的標準(如SOAP所做的)。微軟文件: 理解SOAP