XML syntax for stored SAS process

I am trying to run the example on page 19 of the SAS BI Web Services Developer's Guide . I followed the instructions verbatim, but could not get the saved process (automatically a web service) to return the correct result when I make a mail request. I am trying to use SOAP and XML. The error is that the instream data source was never found.

I ask someone to reproduce the example and provide accurate XML and / or SOAP with a send request (in the form of a curl).

Here is SOAP (straight from the manual)

<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> 

I am sending via curl. Here is my curl command

 curl -H "Content-Type: text/xml" -X POST https://mycompany.com:port/SASBIWS/services/WebServicesExamples/sampMeans --data "@sampmeanssoap.xml" 

But it causes an error

The exception type "Client" that occurred during the execution of "WebServicesExamples / sampMeans Service". Exception: The expected stream "instream" is not specified.

XML creates a similar response

 <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> 

With curl

 curl -H "Content-Type: text/xml" -X POST https://mycompany.com:port/SASBIWS/rest/storedProcesses/WebServicesExamples/sampMeans --data-binary "@sampmeanssoap.xml" 

I can successfully terminate stored processes using only parameters, but I cannot send data sources for any reason.

+5
source share
1 answer

Finally, I found the answer and sent it to the SAS communities ( https://communities.sas.com/t5/SAS-Stored-Processes/Help-with-XML-Syntax-for-post-request-to-Stored-Process/mp / 239032 / highlight / false # M3304 )

Unfortunately, the documentation is very lacking with specific examples of sending data streams through plain XML. At first I tried to simply insert a simple XML part of a single SOAP request example into the XMLA part of the documentation, but my instream stream could not be found.

The key to the solution was to look at the wsdl file (just add? Wsdl to the endpoint. Ex: https://mycompany.com:port/SASBIWS/services/path/to/process/process_name?wsdl ) I got a simple process storage of additives to return successfully, and noticed that in my new stored process, which wsdl did not match the example in the developer guide. Here is the relevant part of wsdl for a stored process that transfers data.

 <xsd:complexType name="upload_stream5Streams"> <xsd:sequence> <xsd:element name="instream"> <xsd:complexType> <xsd:sequence> <xsd:element name="Value"> <xsd:complexType> <xsd:sequence> 

I needed separate elements for threads, increments and Value, which, as far as I know, are absolutely nowhere on the Internet.

Here is the full 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> 

And here is the sas stored process code. This is slightly different from the developer example, because the macro of the variable _XMLSCHEMA is missing. (the default tablename is used by InData, but you can also pass this using XML using the <parameters> and <parameter_name> tags)

 %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; 
+4
source

Source: https://habr.com/ru/post/1237980/


All Articles