Hello,
I have a sas stored process deployed as a web service. The stored process generates xml feed without issues. When I deploy it as an web service and make an API call, I get 200OK message but no actual data.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<n:grphdttrndnlyssResponse xmlns:n="http://tempuri.org/wsgrphtrndnlyss">
<n:grphdttrndnlyssResult>
<n:Streams>
<n:_WEBOUT contentType="text/xml">
<n:Value>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSIgPz4KPFRBQkxFPgogICA8UExUWE1MPgogICAgICA8cGx0X2ZsZz4gRCA8L3BsdF9mbGc+CiAgICAgIDxubXJ0cj4gNTI4IDwvbm1ydHI+CiAgICAgIDxkbm1ydHI+IDUyOCA8L2RubXJ0cj4KICAgICAgPHJhdGlvPiAxIDwvcmF0aW8+CiAgICAgIDx0YXJnZXRfbmFtZT4gTGltYSBDYW5uaW5nIDwvdGFyZ2V0X25hbWU+CiAgICAgIDxjYXRlZ29yeV9uYW1lPiBJbnNoaXBtZW50cyBIL1AgPC9jYXRlZ29yeV9uYW1lPgogICAgICA8dGltZXN0YW1wPiAyNU9DVDIwMTYgPC90aW1lc3RhbXA+CiAgIDwvUExUWE1MPgo8L1RBQkxFPgo=</n:Value>
</n:_WEBOUT>
</n:Streams>
</n:grphdttrndnlyssResult>
</n:grphdttrndnlyssResponse>
</soapenv:Body>
</soapenv:Envelope>
My soap envelope that I send is here
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsg="http://tempuri.org/wsgrphtrndnlyss">
<soapenv:Header/>
<soapenv:Body>
<wsg:grphdttrndnlyss>
<wsg:parameters>
<!--Optional:-->
<wsg:survey_key>8</wsg:survey_key>
<!--Optional:-->
<wsg:year>2016</wsg:year>
<!--Optional:-->
<wsg:month>00</wsg:month>
<!--Optional:-->
<wsg:stc_id>'8:1:3'</wsg:stc_id>
<!--Optional:-->
<wsg:week>00</wsg:week>
<!--Optional:-->
<wsg:location_id>01FO</wsg:location_id>
<!--Optional:-->
<wsg:poid>35927107040</wsg:poid>
</wsg:parameters>
</wsg:grphdttrndnlyss>
</soapenv:Body>
</soapenv:Envelope>
my code is below -
data _null_;
old = stpsrv_header("Content-type","text/xml");
run;
libname _webout xml ;
libname myclient "/mnt/data/SP";
%global stc_id2 _sglplt_flg _dblplt_flg;
proc format library=myclient;
value response
1 = 'Complete'
2 = 'Refusal'
3 = 'Inaccessible'
4 = 'Office Hold'
5 = 'R - Est'
6 = 'Inac - Est'
7 = 'Off Hold - Est'
8 = 'Known Zero'
;
quit;
proc format library=myclient;
value respondent
1 = 'Op/Mgr'
2 = 'Spouse'
3 = 'Acct/Bkpr'
4 = 'Partner'
9 = 'Other'
;
quit;
proc format library=myclient;
value mode
0 = 'N/A'
1 = 'PASI MAIL'
2 = 'PATI TELEPHONE'
3 = 'PAPI FACE-TO-FACE'
4 = 'CATI'
5 = 'CASI'
6 = 'E-MAIL'
7 = 'FAX'
8 = 'mCAPI'
9 = 'mCATI'
10 = 'mCASI'
19 = 'OTHER'
;
quit;
proc format library=myclient;
value myclient_stateid
1 = 'Alabama'
2 = 'Alaska'
4 = 'Arizona'
5 = 'Arkansas'
6 = 'California'
8 = 'Colorado'
9 = 'Connecticut'
10 = 'Delaware'
12 = 'Florida'
13 = 'Georgia'
15 = 'Hawaii'
16 = 'Idaho'
17 = 'Illinois'
18 = 'Indiana'
19 = 'Iowa'
20 = 'Kansas'
21 = 'Kentucky'
22 = 'Louisiana'
23 = 'Maine'
24 = 'Maryland'
25 = 'Massachusetts'
26 = 'Michigan'
27 = 'Minnesota'
28 = 'Mississippi'
29 = 'Missouri'
30 = 'Montana'
31 = 'Nebraska'
32 = 'Nevada'
33 = 'New Hampshire'
34 = 'New Jersey'
35 = 'New Mexico'
36 = 'New York'
37 = 'North Carolina'
38 = 'North Dakota'
39 = 'Ohio'
40 = 'Oklahoma'
41 = 'Oregon'
42 = 'Pennsylvania'
44 = 'Rhode Island'
45 = 'South Carolina'
46 = 'South Dakota'
47 = 'Tennessee'
48 = 'Texas'
49 = 'Utah'
50 = 'Vermont'
51 = 'Virginia'
53 = 'Washington'
54 = 'West Virginia'
55 = 'Wisconsin'
56 = 'Wyoming'
;
run;
proc format library=myclient;
value $myclient_loc
'01FO' = 'Alabama'
'02FO' = 'Alaska'
'04FO' = 'Arizona'
'05FO' = 'Arkansas'
'06FO' = 'California'
'08FO' = 'Colorado'
'09FO' = 'Connecticut'
'10FO' = 'Delaware'
'12FO' = 'Florida'
'13FO' = 'Georgia'
'15FO' = 'Hawaii'
'16FO' = 'Idaho'
'17FO' = 'Illinois'
'18FO' = 'Indiana'
'19FO' = 'Iowa'
'20FO' = 'Kansas'
'21FO' = 'Kentucky'
'22FO' = 'Louisiana'
'23FO' = 'Maine'
'24FO' = 'Maryland'
'25FO' = 'Massachusetts'
'26FO' = 'Michigan'
'27FO' = 'Minnesota'
'28FO' = 'Mississippi'
'29FO' = 'Missouri'
'30FO' = 'Montana'
'31FO' = 'Nebraska'
'32FO' = 'Nevada'
'33FO' = 'New Hampshire'
'34FO' = 'New Jersey'
'35FO' = 'New Mexico'
'36FO' = 'New York'
'37FO' = 'North Carolina'
'38FO' = 'North Dakota'
'39FO' = 'Ohio'
'40FO' = 'Oklahoma'
'41FO' = 'Oregon'
'42FO' = 'Pennsylvania'
'44FO' = 'Rhode Island'
'45FO' = 'South Carolina'
'46FO' = 'South Dakota'
'47FO' = 'Tennessee'
'48FO' = 'Texas'
'49FO' = 'Utah'
'50FO' = 'Vermont'
'51FO' = 'Virginia'
'53FO' = 'Washington'
'54FO' = 'West Virginia'
'55FO' = 'Wisconsin'
'56FO' = 'Wyoming'
;
run;
options fmtsearch=(myclient) mprint mlogic mlogicnest mprintnest symbolgen;
/************************
testing
single plot data
%let survey_key=501;
%let year=2017;
%let month =04;
%let week=03;
%let location_id=99HQ;
*%let poid=35927107040;
%let poid=41800968980;
%let poid=19660001460;
*%let stc_id=8:1:1,8:2:2;
%let stc_id=%str('501:1:1','501:2:2','501:1:2','501:1:2');
***********************/
/************************
testing
double plot data
%let survey_key=8;
%let year=2016;
%let month =04;
%let week=03;
%let location_id=01FO;
%let poid=35927107040;
%let stc_id=%str('8:1:3';'8:1:5';'8:1:11';'8:1:12';'8:1:13');
***********************/
data analyze_varname;
set myclient.analyze_varname;
srvytrgtctgry=trim(left(survey_key))||":"||trim(left(target_id))||":"||trim(left(category_id));
run;
data analyze_denom_varname;
set myclient.analyze_denom_varname;
srvytrgtctgry=trim(left(survey_key))||":"||trim(left(target_id))||":"||trim(left(category_id));
run;
%put "this is the original stc_id &stc_id.";
%global stc_id2;
%let stc_id2=;
%macro _flg(stc_id=);
%let stc_id2=%sysfunc(transtrn(%quote(&stc_id.),';',','));
%put "this is the new stc_id &stc_id2.";
proc sql;
select count(*) into: _sglplt_flg
from analyze_varname
where srvytrgtctgry in ( &stc_id2. )
;
quit;
%if &_sglplt_flg. ne 0 %then %let _sglplt_flg=Y;
%put single plot flag is &_sglplt_flg;
proc sql;
select count(*) into: _dblplt_flg
from analyze_denom_varname
where srvytrgtctgry in ( &stc_id2. )
;
quit;
%put double plot flag is &_dblplt_flg;
%if &_dblplt_flg. ne 0 %then %let _dblplt_flg=Y;
%mend _flg;
/**/
/*%_flg(stc_id=%str("8:1:1","8:2:2"))*/
/*
%_flg(stc_id=%str('501:1:1';'501:2:2'));
*/
%_flg(stc_id=&stc_id);
proc sql;
create table states as
select distinct client_state_id,survey_key
from myclient.ec_client_state
where client_state_id ne 0;
create table regions as
select distinct ec_state_id,survey_key
from myclient.ec_client_state
where ec_state_id ne 99;
quit;
proc sql;
create table location as
select left(trim(put(client_state_id,z2.)))||'FO' as location_id,survey_key, put(client_state_id,myclient_stateid.) as desc,put(client_state_id,2.) as state_id
from myclient.ec_client_state
where client_state_id ne 0
union
select left(trim(put(ec_state_id, z2.)))||'EC' as location_id,survey_key, put (ec_state_id,myclient_stateid.) as desc,put(client_state_id,2.) as state_id
from myclient.ec_client_state
where ec_state_id ne 99
union
select '99HQ' as location_id, survey_key, 'Headquarters' as desc,'99HQ' as state_id
from myclient.ec_client_state;
quit;
%macro _output_plt_data_v1(stc_id=,location_id=,year=,month=,week=,poid=);
%let stc_id2=%sysfunc(transtrn(%quote(&stc_id.),';',','));
%if &_sglplt_flg=Y %then
%do;
proc sql;
create table plot_output as
select distinct
sum(t2.current_value_num) as nmrtr
,0 as dnmrtr
,0 as ratio
,'S' as plt_flg
,stc.target_name
,stc.category_name
/*,put(t2.date, mmddyy10.) as dt*/
,put(datepart(t2.current_value_timestamp),date9.) as timestamp
from myclient.wip2data t2
inner join analyze_denom_varname svar
on t2.varname = svar.varname
inner join myclient.survey_target_category stc on
stc.survey_key=svar.survey_key
and stc.target_id =svar.target_id
and stc.category_id = svar.category_id
join location loc
on svar.survey_key=loc.survey_key
and loc.state_id=put(t2.state,2.)
where svar.survey_key= input("&survey_key.",4.)
and svar.srvytrgtctgry in ( &stc_id2. )
and t2.state_poid=input("&poid.",11.)
and t2.year_number = input("&year.",4.)
group by t2.year_number
,stc.target_name
,stc.category_name
/*,put(t2.date, mmddyy10.)*/
,put(datepart(t2.current_value_timestamp),date9.)
;
quit;
%end;
%else %if &_dblplt_flg=Y %then
%do;
proc sql;
create table plot_output as
select distinct
'D' as plt_flg
, sum(t2.current_value_num) as nmrtr
,sum(t3.current_value_num) as dnmrtr
, (calculated nmrtr / calculated dnmrtr) as ratio
,stc.target_name
,stc.category_name
/*,put(t2.date, mmddyy10.) as dt*/
,put(datepart(t2.current_value_timestamp),date9.) as timestamp
from analyze_denom_varname dvar
join myclient.wip2data t2
on dvar.varname=t2.varname
inner join myclient.wip2data t3 on
dvar.denom_varname =t3.varname
inner join location loc
on dvar.survey_key=loc.survey_key
and loc.state_id=put(t2.state,2.)
inner join myclient.survey_target_category stc on
stc.survey_key=dvar.survey_key
and stc.target_id =dvar.target_id
and stc.category_id = dvar.category_id
where dvar.survey_key= input("&survey_key.",4.)
and t2.state_poid=input("&poid.",11.)
and dvar.srvytrgtctgry in ( &stc_id2. )
and t2.state=t3.state
and t3.year_number = t2.year_number
and t2.year_number = input("&year.",4.)
/*and put(month(datepart(t2.current_value_timestamp)),z2.) = "&month."*/
group by
stc.target_name
,stc.category_name
/*,put(t2.date,mmddyy10.) */
,put(datepart(t2.current_value_timestamp),date9.)
;
quit;
*;
%end;
%mend _output_plt_data_v1;
%_output_plt_data_v1(stc_id=&stc_id.,location_id=&location_id.,year=&year.,month=&month.,week=&week.,poid=&poid.);
data _webout.pltxml;
set plot_output;
run;
When I run a SOAP request, I get the below error
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring xml:lang="en">A 'Server Execution' type of exception occurred during execution of 'wspoid' service. The exception follows: SAS completed with nonzero SYSCC '1,012'. SYSMSG: ''.</faultstring>
<detail xmlns:fault="http://support.sas.com/xml/namespace/biwebservices/webservicemaker-9.2">
<fault:Fault code="3000"/>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
When my colleague sends a SOAP request, he gets garbage data. Does anyone know if converting a http server to https (or vice versa) would have anything to do with SAS web services not functioning well?
Thanks,
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.