1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| DECLARE @obj int,
@url VarChar(MAX),
@response VarChar(MAX),
@requestHeader VarChar(MAX),
@requestBody VarChar(MAX)
DECLARE @taille INT
SET @url = 'http://IP/WSWeb/ws_web.php'
SET @requestBody ='<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://PortailAbonne.com">
<SOAP-ENV:Body>
<tns:Add_Civilite xmlns:tns="http://PortailAbonne.com">
<code xsi:type="xsd:string">EE</code>
<lib xsi:type="xsd:string">EEEE</lib>
<libCourt xsi:type="xsd:string">EEE</libCourt>
<web xsi:type="xsd:boolean">0</web>
</tns:Add_Civilite>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>'
SET @taille = DATALENGTH(@requestBody);
EXEC sp_OACreate 'MSXML2.ServerXMLHttp', @obj OUT
EXEC sp_OAMethod @obj, 'Open', NULL, 'GET', @url, 'false'
EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'Content-Type', 'text/xml;charset=UTF-8'
EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'SOAPAction', 'POST'
EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'Content-Length', @taille
EXEC sp_OAMethod @obj, 'send', NULL, @requestBody
EXEC sp_OAGetProperty @obj, 'responseText', @response OUT
SELECT @response [RESPONSE]
EXEC sp_OADestroy @obj |
Partager