I have a problem to invoke the web service shared by SAS using DS2.
Please note that proc soap working fine for me.
proc ds2;
data _null_;
method run();
/* instantiate the package */
declare package http h();
declare varchar(1024) body ;
declare int rc;
DECLARE varchar(10000) content;
content=
'<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>
;;;;' ;
/* create a GET */
h.createPostMethod('http://soapclient.com/xml/soapresponder.wsdl');
h.setRequestBodyAsString(content);
h.setRequestContentType('text/xml; charset="utf-8"');
/* execute the GET */
h.executeMethod();
/* retrieve the response body as a string */
h.getResponseBodyAsString(body, rc);
put body;
end;
run;
Log:
Stabs in the dark. Instead of
h.setRequestContentType('text/xml; charset="utf-8"');
try
h.setRequestContentType('text/xml; charset=utf-8');
or
h.setRequestContentType('
application/soap+xml
; charset=utf-8');
Thank's for your response.
I tried both of but i'm still having the same error :
It's strange that the error message quotes the string utf-8 if you did not. No more idea, sorry.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.