Your SAS programs, embedded in web apps and elsewhere

Sending a REST POST request from external WebApp to BI Web Services

Reply
Contributor
Posts: 33

Sending a REST POST request from external WebApp to BI Web Services

I'm developing a Web Application (in ASP.NET Core) that is using SAS Bi Web Services to leverage Stored Processes. I'm having trouble passing data tables between the webapp and SAS.

 

I managed to load a table from SAS using the HTTP GET request.

 

Now I'm stuck to SENDING data back to SAS. I'm using SOAPui to test the HTTP POST call in order to figure out what is wrong.

first thing first. The Stored Process is very simple. Take the data stream and write it in a SAS library

 

%STPBEGIN(debug=y);  
libname instream XML;

DATA test;
SET instream.product;
run;

%STPEND(debug=y);

I set up instream as Data Source XML based data.

 

 

I create an XML string from my WebApplication by serializing the model. I have

<?xml version="1.0" encoding="utf-16"?><Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<TABLE>
<PRODUCT><ProductID>1</ProductID><Name> palla </Name><Description> nike </Description><Category> calcio </Category><Price>10</Price></PRODUCT>
<PRODUCT><ProductID>2</ProductID><Name> racchetta </Name><Description> head </Description><Category> tennis </Category><Price>100</Price></PRODUCT>
</TABLE>
</Value>

If I sent the HTTP post request I get the error

"The request sent by the client was syntactically incorrect"

I tryed both content-type text/xml and application/xml (what's the difference by the way?) If i strip the xml properties on top and leave only <Value> i get a WSException: "Expected stream 'instream' was not specified."

 

Can you help me? There is very little documentation about this.

 

Occasional Contributor
Posts: 6

Re: Sending a REST POST request from external WebApp to BI Web Services

It sounds like something might not be registered in the metadata correctly. Can you take a look at this example and make sure it's set up similarly?

http://support.sas.com/rnd/itech/doc9/dev_guide/websrvcs/sample.html
Ask a Question
Discussion stats
  • 1 reply
  • 198 views
  • 0 likes
  • 2 in conversation