BookmarkSubscribeRSS Feed
UdayGuntupalli
Quartz | Level 8

All, 

   I am trying to build a SOAP API. The API requires one of the inputs to be a table of information. Can anyone kindly provide an example of the correct format to read in a table as an input from XML Soap invocation call. Appreciate your help. 

7 REPLIES 7
UdayGuntupalli
Quartz | Level 8

@ChrisNZ
        Thank you for your response. Yes, I have seen this. It only covers single parameters, however I am trying to look into passing a table as input. 

ChrisNZ
Tourmaline | Level 20

I am afraid I am out of my depth, but maybe @ArvAmundson or @MagnusGustavsson or @BrunoMueller would be able to help?

ArvAmundson
Calcite | Level 5

Just to clarify.  Are you trying to take one or more columns from a SAS table and populate fields in the request XML file that you submit with the PROC SOAP?

 

UdayGuntupalli
Quartz | Level 8

@ArvAmundson,
       No. I am trying to just pass a table from another application for e.g. say C# pass a table in its XML soap request to the service

ArvAmundson
Calcite | Level 5
I can't help you then. I have looped thru tables one record at a time with a macro and used the contents to fill out the request XML. However, I have not used it to transfer a whole table.

BrunoMueller
SAS Super FREQ

Have you already defined the Stored Process with Input/Output data source definitions and looked at the WSDL coming back from the webservice, this should reflect how to provide the data.

 

Here is sample code on how to access the XML data passed in:

 

libname ws_ixml xmlv2;

proc copy in=ws_ixml out=work;
run;

proc contents data=work._all_ ;
run;

proc print data=work.t1;
run;

The definition of the WS_IXML looks like this:image.png

 

 

The Web Service request looks like this:

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:biw="http://www.sas.com/xml/namespace/biwebservices">
   <soapenv:Header/>
   <soapenv:Body>
      <biw:ws_input_data>
         <biw:streams>
            <biw:ws_ixml contentType="?">
               <biw:Value>
                  <!--You may enter ANY elements at this point-->
                  <root>
                     <t1>
                        <c1>r1c1</c1>
                        <c2>r1c2</c2>
                        <c3>123</c3>
                        <c4>2018-09-05</c4>
                     </t1>
                     <t1>
                        <c1>r2c1</c1>
                        <c2>r2c2</c2>
                        <c3>456</c3>
                        <c4>2018-09-05</c4>
                     </t1>
                  </root>
               </biw:Value>
            </biw:ws_ixml>
         </biw:streams>
      </biw:ws_input_data>
   </soapenv:Body>
</soapenv:Envelope>

The request xml was taken from SoapUI. 

So the XML between the <biw:Value></biw:Value> tags can be read using the XMLV2 libname engine.

 

The XML data passed in to the WS_IXML libref can be read without using a XML Map file.

 

<root> is the root tag, <t1> is the table name, each repeating <t1> ... </t1> is treated as an observation. The <c4> column is an example how to pass in a date.

 

You can get the WSDL of a Stored process called as a SAS Webservice like this:

 

 

http://host:port/SASBIWS/services/<metadata folder name>/<stored process name>?WSDL

 

 

Hope this helps

 

 

 

 

 

 

 

 

 

 

 

 

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 2901 views
  • 4 likes
  • 4 in conversation