BookmarkSubscribeRSS Feed
kjohnsonm
Lapis Lazuli | Level 10

Hello All,
I am not new to SAS, but 100% new to 'proc Soap', in fact, I have 0% experience with any post / API SAS procedures. I almost entirely work with ODBC SAS work.
Can anyone help me debug this code? ...or point me at open WS with a working SAS example?

/*filename request temp;*/
filename request "c:\temp\request.xml";
/*filename response temp;*/
filename response "c:\temp\responce.xml";

data _null_;
   file request;
   input;
   put _infile_;
   datalines4;
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="https://MY_Server.My_Domain.edu/XMLSchema-instance" xmlns:xsd="http://MY_Server.My_Domain.edu/XMLSchema" xmlns:soap="http://MY_Server.My_Domain.edu/soap/envelope/">
  <soap:Body>
    <getReshallData xmlns="https://MY_Server.My_Domain.edu/Odyssey/">
      <term>AY2021</term>
    </getReshallData>
  </soap:Body>
</soap:Envelope>
;;;;
run;
proc soap
   in=request
   out=response
   url="https://MY_Server.My_Domain.edu/ohms/ws/IRHousingService.asmx"
   soapaction="getReshallData";
run;

I get this error:
ERROR: java.lang.Exception: Server did not recognize the value of HTTP Header SOAPAction:
getReshallData.

There is virtually nothing on this error online when I search for the must have 'SAS', 'Proc Soap', 'Error', let alone the rest of this error.  Google did not have a full-page in fact.

If helpful when I run this I do get the request and response files (I renamed them to .txt to upload), and I have replaced my server.domain name.
I would be very happy to even go read a good blog on the topic if anyone has one, but for example, I cannot get the default examples here to work: https://documentation.sas.com/?docsetId=proc&docsetVersion=9.4&docsetTarget=p0q0stkf83myu6n13kxcljc1...
it comes back with ERROR: org.springframework.ws.client.WebServiceIOException: I/O error: proxygw.unx.sas.com; nested
exception is java.net.UnknownHostException: proxygw.unx.sas.com

TIA  -KJ

 

9 REPLIES 9
kjohnsonm
Lapis Lazuli | Level 10

Sorry it looks like the request failed to attached...

AhmedAl_Attar
Rhodochrosite | Level 12

Check out the attached SGF2010 paper for some insightful details

 

Hope this helps,

Ahmed

kjohnsonm
Lapis Lazuli | Level 10

So I think I had a soapaction line mistake. After updating it I get an indexing error.
Here is my current code:

filename request "c:\temp\request.xml";
filename response "c:\temp\responce.xml";
data _null_;
   file request;
   input;
   put _infile_;
   datalines4;
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="https://MY_Server.My_Domain.edu/XMLSchema-instance" xmlns:xsd="http://MY_Server.My_Domain.edu/XMLSchema" xmlns:soap="http://MY_Server.My_Domain.edu/soap/envelope/">
  <soap:Body>
    <getReshallData xmlns="https://MY_Server.My_Domain.edu/Odyssey/">
      <term>AY2019</term>
    </getReshallData>
  </soap:Body>
</soap:Envelope>
;;;;
run;
proc soap
   in=request
   out=response
   url="https://MY_Server.My_Domain.edu/ohms/ws/IRHousingService.asmx"
   soapaction="https://MY_Server.My_Domain.edu/Odyssey/getReshallData";
run;

Does anyone have a solution for this error?
ERROR: java.lang.Exception: Server was unable to process request. ---> Index was outside the bounds of
the array.

I am not sure but a similar SAS error for reading an excel pivot table(s)* is pointing at too many columns (it's very old).  Does anyone know the max number of columns supported by proc soap?  ...I am in work stripping down my WS to test this theory.  Unfortunately, my data extract is a data dump for the most part of this other resource db.  TIA for any help.  -KJ

* https://support.sas.com/kb/46/428.html

ChrisHemedinger
Community Manager

Maybe not a help for the service you're using, but the example in the SAS doc is specifically about using a Proxy host.  As that's not your situation, you can get the example to work by removing the PROX* options:

 

filename REQUEST temp;
filename RESPONSE temp;
data _null_;
   file request;
   input;
   put _infile_;
   datalines4;

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
         xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
         xmlns:soap="http://www.SoapClient.com/xml/SoapResponder.xsd">
<soapenv:Header/>
<soapenv:Body>
   <soap:Method1 
         soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <bstrParam1 xsi:type="xsd:string">apple</bstrParam1>
         <bstrParam2 xsi:type="xsd:string">zebra3</bstrParam2>
   </soap:Method1>
</soapenv:Body>
</soapenv:Envelope>
;;;;

run;

proc soap in= request
          out= response
          url="http://soapclient.com/xml/soapresponder.wsdl"
          soapaction="http://www.SoapClient.com/SoapObject"
;
run;  

data _null_;
 infile response;
 input;
 put _infile_;
run;

Running this with success will tell you that PROC SOAP is working in general.

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
AhmedAl_Attar
Rhodochrosite | Level 12

Hi,

This is similar to the example @ChrisHemedinger sent earlier

 

FILENAME request temp ;
FILENAME response temp ;
 
data _null_;
   file request;
   input;
   put _infile_;
   datalines4;
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
   <soapenv:Header/>
   <soapenv:Body>
      <tem:Add>
         <tem:intA>7</tem:intA>
         <tem:intB>4</tem:intB>
      </tem:Add>
   </soapenv:Body>
</soapenv:Envelope>
;;;;
 
proc soap 
   in=request
   out=response
   url="http://www.dneonline.com/calculator.asmx"
   soapaction="http://tempuri.org/Add";
run;
 
data _null_;
infile response;
input;
put _infile_;
run;

The above example uses on-line (limited) calculator Service  http://www.dneonline.com/calculator.asmx, with four operations/soapactions. You can check its Web Service Definition language file for details.

 

Check this video "SoapUI Beginner Tutorial 3 - First SoapUI Project | SOAP | How to create Project in SoapUI" for step by step on how to use SoapUI with Soap Web Service

 

Good luck,

Ahmed

kjohnsonm
Lapis Lazuli | Level 10

Okay so I have my post returning data, thank you both (Chris, & Ahmed) responders for tips and docs. 😎
I only have a simple (I hope) follow on, if I wanted to macro my term string, how would you suggest doing this?  I have not seen that happen in a dataline before. I would not think it would be possible but hope it can be done.
have
<term xsi:type="xsd:string">AY2020</term>
 
 want 

%let my_term=AY2019;

/* ..., AY2020, …,  AY2029, etc, … */
<term xsi:type="xsd:string">&my_term.</term>
I tried making a three part data set and stacking that failed. 8(

/*current working code*/
filename request "c:\temp\request.xml";
filename response "c:\temp\responce.xml";

/*testing: xmlns:soap="http://my_server.my_domain.edu/soap/envelope/" */

/*working: xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" */

data _null_;
   file request;
   input;
   put _infile_;
   datalines4;
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="https://my_server.my_domain.edu/XMLSchema-instance" xmlns:xsd="http://my_server.my_domain.edu/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
	<soap:Body>
		<getReshallData xmlns="https://my_server.my_domain.edu/Odyssey/">
			<term xsi:type="xsd:string">AY2020</term>
		</getReshallData>
	</soap:Body>
</soap:Envelope>
;;;;
run;
proc soap
   in=request
   out=response
   url="https://my_server.my_domain.edu/ohms/ws/IRHousingService.asmx"
   soapaction="https://my_server.my_domain.edu/Odyssey/getReshallData";
run;
data _null_;
 infile response;
 input;
 put _infile_;
run;



AhmedAl_Attar
Rhodochrosite | Level 12
You can use data _null_ with Put statements to compose your request, and this way, you can place your macro variable in the desired place.

filename request temp;
data _null_;
File request lrecl=1000;
put '<?xml version="1.0" encoding="utf-8"?>';
...
....
run;
ChrisHemedinger
Community Manager

Right - or you could continue to use DATALINES for most of it, but replace the value you want as you read it in.  I've done this by putting in a placeholder:

 

data _null_;
   file request;
   input;
   line = tranwrd(_infile_,"REPLACE_THIS", &ayvalue.);
   put line;
   datalines4;
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="https://my_server.my_domain.edu/XMLSchema-instance" xmlns:xsd="http://my_server.my_domain.edu/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
	<soap:Body>
		<getReshallData xmlns="https://my_server.my_domain.edu/Odyssey/">
			<term xsi:type="xsd:string">REPLACE_THIS</term>
		</getReshallData>
	</soap:Body>
</soap:Envelope>
;;;;

 

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
Tom
Super User Tom
Super User

To get macro triggers evaluated in text check out PROC STREAM.

Or for your simple example you could try using the resolve() function.

input;
_infile_=resolve('%put ' ||_infile_||';');
put _infile_;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 9 replies
  • 2594 views
  • 2 likes
  • 4 in conversation