Sending XML directly to a template using SQL Server & IIS
Database
1
Posts
1
Posters
0
Views
1
Watching
-
Hi all, I'm trying to use IXMLHTTPRequest to send an XML document (from a C++ client app) to a template on a SQL Server. It appears IIS support is configured properly, because putting the document directly in the url works - like this: http://myserver/virtualdir/templates/mytemplate.xml?doc='<root/>' The template is:
<ROOT xmlns:sql='urn:schemas-microsoft-com:xml-sql'>
sql:header
<sql:param name='doc'>'default'</sql:param>
sql:header
sql:query
exec usp_MySP @doc
</sql:query>
<ROOT>In code, I open an IXMLDOMDocument, and load xml into it. Then, I open an IXMLHTTPRequest and send the document:
hr = pIXMLHttpRequest->open(\_bstr\_t(\_T("POST")), \_bstr\_t(\_T("http://myserver/virtualdir/templates/mytemplate.xml")), \_variant\_t(VARIANT\_FALSE), \_variant\_t(""), \_variant\_t("")); hr = pIXMLHttpRequest->setRequestHeader(\_bstr\_t(\_T("Content-type")), \_bstr\_t(\_T("application/xml"))); hr = pIXMLHttpRequest->send((IDispatch \*)pDoc);
The stored procedure always gets the default parameter, not whatever document I pass in. Thanks for any help with this cryptic stuff Cheers NB