SAS存储过程的XML语法
我正在尝试完成
SAS BI Web Services Developers Guide第19页的示例.我已逐字按照说明操作但无法获取存储过程(自动为Web服务)以在发出请求时返回正确的结果.我正在尝试SOAP和XML.错误是永远找不到’instream’数据源.
我要求的是有人复制示例并使用post请求(以curl的形式)提供确切的XML和/或SOAP. 这是SOAP(直接来自指南) <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sas="urn:schemas-microsoft-com:xml-analysis"> <soapenv:Header/> <soapenv:Body> <sas:Execute> <sas:Command> <StoredProcess name="/WebServicesExamples/sampMeans"> <Parameter name="tablename">InData</Parameter> <Stream name="instream"> <Table> <InData> <Column1>1</Column1> <Column2>20</Column2> <Column3>99</Column3> </InData> <InData> <Column1>50</Column1> <Column2>200</Column2> <Column3>9999</Column3> </InData> <InData> <Column1>100</Column1> <Column2>2000</Column2> <Column3>1000000</Column3> </InData> </Table> </Stream> </StoredProcess> </sas:Command> <sas:Properties> <PropertyList> <DataSourceInfo>Provider=SASSPS;</DataSourceInfo> </PropertyList> </sas:Properties> </sas:Execute> </soapenv:Body> </soapenv:Envelope> 我通过curl发帖.这是我的curl命令 curl -H "Content-Type: text/xml" -X POST https://mycompany.com:port/SASBIWS/services/WebServicesExamples/sampMeans --data "@sampmeanssoap.xml" 但这会产生错误
XML产生类似的响应 <StoredProcess name="/WebServicesExamples/sampMeans"> <Parameter name="tablename">InData</Parameter> <Stream name="instream"> <Table> <InData> <Column1>1</Column1> <Column2>20</Column2> <Column3>99</Column3> </InData> <InData> <Column1>50</Column1> <Column2>200</Column2> <Column3>9999</Column3> </InData> <InData> <Column1>100</Column1> <Column2>2000</Column2> <Column3>1000000</Column3> </InData> </Table> </Stream> </StoredProcess> 随着卷曲 curl -H "Content-Type: text/xml" -X POST https://mycompany.com:port/SASBIWS/rest/storedProcesses/WebServicesExamples/sampMeans --data-binary "@sampmeanssoap.xml" 当仅使用参数但是由于某种原因无法发送数据源时,我可以成功地完成存储过程.
终于找到答案并将其发布到SAS社区(
https://communities.sas.com/t5/SAS-Stored-Processes/Help-with-XML-Syntax-for-post-request-to-Stored-Process/m-p/239032/highlight/false#M3304)
遗憾的是,文档非常缺乏通过纯XML发送数据流的具体示例.我最初只是尝试在文档的XMLA部分插入单独的示例SOAP请求的纯XML部分,但无法找到我的流’instream’. 解决方案的关键是查看wsdl文件(只需将?wsdl附加到端点.例如:https://mycompany.com:port/SASBIWS/services/path/to/process/process_name?wsdl)我已经获得了一个简单的addint存储过程以成功返回并注意到在我的新存储过程中wsdl不匹配开发人员指南中的示例.以下是流式传输数据的存储过程的wsdl的相关部分. <xsd:complexType name="upload_stream5Streams"> <xsd:sequence> <xsd:element name="instream"> <xsd:complexType> <xsd:sequence> <xsd:element name="Value"> <xsd:complexType> <xsd:sequence> 我需要为流,插播和价值提供单独的元素,据我所知,这在互联网上是绝对无处可去的. 这是完整的XML <upload_stream5> <streams> <instream> <Value> <Table> <InData > <Column1>1</Column1> <Column2>20</Column2> <Column3>99</Column3> </InData> <InData> <Column1>50</Column1> <Column2>200</Column2> <Column3>9999</Column3> </InData> <InData> <Column1>100</Column1> <Column2>2000</Column2> <Column3>1000000</Column3> </InData> </Table> </Value> </instream> </streams> </upload_stream5> 这是实际存储的进程sas代码.它与开发人员的示例略有不同,因为没有_XMLSCHEMA宏变量. (tablename默认为InData,但您也可以使用< parameters>和< parameter_name>标记将XML传递给它 %put &tablename; libname otstream xml xmlmeta = SchemaData; libname instream xml; proc means data=instream.&tablename; output out=otstream.mean; run; libname otstream clear; libname instream clear; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |