<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