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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.