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: 1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 72 73 74 proc ds2; 75 76 data _null_; 77 method run(); 78 /* instantiate the package */ 79 declare package http h(); 80 declare varchar(1024) body ; 81 declare int rc; 82 83 DECLARE varchar(10000) content; 84 85 content= 86 '<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 87 xmlns:xsd="http://www.w3.org/2001/XMLSchema" 88 xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 89 xmlns:soap="http://www.SoapClient.com/xml/SoapResponder.xsd"> 90 <soapenv:Header/> NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks. 91 <soapenv:Body> 92 <soap:Method1 93 soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 94 <bstrParam1 xsi:type="xsd:string">apple</bstrParam1> 95 <bstrParam2 xsi:type="xsd:string">zebra3</bstrParam2> 96 </soap:Method1> 97 </soapenv:Body> 98 </soapenv:Envelope> 99 ;;;;' ; 100 101 /* create a GET */ 102 h.createPostMethod('http://soapclient.com/xml/soapresponder.wsdl'); 103 h.setRequestBodyAsString(content); 104 105 h.setRequestContentType('text/xml; charset="utf-8"'); 106 /* execute the GET */ 107 h.executeMethod(); 108 /* retrieve the response body as a string */ 109 110 h.getResponseBodyAsString(body, rc); 111 put body; 112 end; 113 114 run; <?xml version="1.0"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body> <SOAP-ENV:Fault> <faultcode>SOAP-ENV:Client</faultcode> <faultstring>Error Parsing Request Message.</faultstring> <faultactor>/xml/soapresponder.wsdl</faultactor> <detail> <e:faultdetails xmlns:e="http://sqldata.com/soapfault"> <message>Error at Line 1, position 562 Error c00cee2d, Incorrect document syntax.</message> <errorcode>1526</errorcode> </e:faultdetails> </detail> </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope> NOTE: Note from DS2 package d2http: NOTE: Failed to determine character set from request content type. Defaulting to UTF-8 for encoding the request body. ERROR: Error reported by DS2 package d2http: ERROR: Invalid character set '"utf-8"'. NOTE: Note from DS2 package d2http: NOTE: Failed to determine character set from response content type (text/xml; charset="utf-8"). Defaulting to UTF-8 for decoding the response body. NOTE: Execution succeeded. No rows affected. 115 116 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 128
... View more