Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Sending SOAP message with XMLHTTP in SQL Server 2000

From: n.frantzen@-----.---
To: NULL
Date: 8/7/2007 8:31:00 PM

Hi,

I want to send a SOAP envelope to a web service from a SQL 2000 stored
procedure using the ServerXMLHTTP object.

I get an error at the "send" method : The Parameter is incorrect. I
use a tracer utility to see if any message is being to the port 1008.
When I send an empty string i get an error back from my web service
(and i see the messages in the trace utility) but when I try to send
the SOAP message (which has been tested and works fine in a VB app
using XMLHTTP) then i get the "Parameter is incorrect" error. Also i
tried sending the SOAP message without the double quotes in the string
and it went to the web service meaning the double quotes are not
properly handles by the XMLHTTP object (or by SQL Server i don't
really know).

Does anyone had an idea of what I should try to solve my problem?

Here is my code:

ALTER   PROCEDURE dbo.sp_CEWS @sName  varchar(255) AS
DECLARE @hr int, @hv int
DECLARE @object int
DECLARE @src varchar(255), @desc varchar(255)
DECLARE @soapmessage varchar(8000)
DECLARE @method varchar(8000)
DECLARE @dom int



EXEC @hr=master..sp_OACreate 'MSXML2.ServerXMLHTTP.4.0', @object OUT

IF (@hr <> 0)
                BEGIN
                EXEC sp_OAGetErrorInfo @object, @src OUT, @desc OUT
                SELECT dbo.PrintToLog('Error',@src+' : '+@desc)
                END
ELSE
                EXEC @hr = master..sp_OAMethod @object, 'open',null,
'POST', 'http://localhost:1008/FNCEWS35SOAP/', false

                SET @soapmessage = '<?xml version="1.0"
encoding="UTF-8"?><soap:Envelope xmlns:soap="http://
schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/
XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-
wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/
2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<soap:Header></soap:Header><soap:Body></soap:Body></soap:Envelope>'

                IF @hr <> 0
                                BEGIN
                                EXEC sp_OAGetErrorInfo @object, @src
OUT, @desc OUT
                                SELECT dbo.PrintToLog('Error',@src+' :
'+@desc)
                                END
                ELSE
                                EXEC @hr = master..sp_OAMethod
@object, 'setRequestHeader("Content-Type", "text/xml")', null
                                IF @hr <> 0
                                                BEGIN
                                                EXEC sp_OAGetErrorInfo
@object, @src OUT, @desc OUT
                                                SELECT
dbo.PrintToLog('Error',@src+' : '+@desc)
                                                END

                                EXEC @hr = master..sp_OAMethod
@object, 'setRequestHeader("SOAPAction", "http://www.filenet.com/ns/
fnce/2005/02/ws/SOAP#ExecuteChanges")', null

                                IF @hr <> 0
                                                BEGIN
                                                EXEC sp_OAGetErrorInfo
@object, @src OUT, @desc OUT
                                                SELECT
dbo.PrintToLog('Error',@src+' : '+@desc)
                                                END
                                PRINT @soapmessage
                                --SET @method = 'send('+@soapmessage
+')'
                                EXEC @hr = master..sp_OAMethod
@object,'send', null, @soapmessage
                                IF @hr <> 0
                                                BEGIN
                                                EXEC sp_OAGetErrorInfo
@object, @src OUT, @desc OUT
                                                SELECT
dbo.PrintToLog('Error',@src+' : '+@desc)
                                                END
                                EXEC @hr = master..sp_OAMethod
@object, 'readyState()', @hv OUT
                                WHILE(@hv!=4)
                                                BEGIN
                                                EXEC @hr =
master..sp_OAMethod @object, 'waitForResponse(10)', null
                                                EXEC @hr =
master..sp_OAMethod @object, 'readyState()', @hv OUT
                                                END
                                IF @hr <> 0
                                                BEGIN
                                                EXEC sp_OAGetErrorInfo
@object, @src OUT, @desc OUT
                                                SELECT
dbo.PrintToLog('Error',@src+' : '+@desc)
                                                END



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent