Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Trying to send XML document via XMLHTTP Open and Send methods

18 views
Skip to first unread message

Bob Alston

unread,
Sep 25, 2009, 3:27:57 PM9/25/09
to
I keep getting the error: -2147024809 (80070057) The parameter is
incorrect

Here is the XML text:

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://
www.w3.org/2003/05/soap-envelope">
<soap12:Header>
<CMBHSAuthenticationHeader xmlns="http://www.dshs.state.tx.us/
cmbhs/">
<CMBHSUserName>SClinician1</CMBHSUserName>
<CMBHSPassword>D$h$..125</CMBHSPassword>
</CMBHSAuthenticationHeader>
</soap12:Header>
<soap12:Body>
<DownloadDocument xmlns="http://www.dshs.state.tx.us/cmbhs/">
<Parameter>
<ParentOrganizationNbr>2</ParentOrganizationNbr>
<OrganizationNbr>3</OrganizationNbr>
<FromDate>09/10/2009 4:03:11</FromDate>
<ToDate>09/23/2009 10:05:05</ToDate>
<DownloadType>1</DownloadType>
</Parameter>
</DownloadDocument>
</soap12:Body>
</soap12:Envelope>

Here is my VBA code:

Private Sub Command2_Click()
Dim XMLConnectString As String

Dim XMLResponseText As String
Me.Responsetext = ""
XMLConnectString = Me.fld
'Create the xmlhttp object
Dim xmlhttp
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
'Open a connection and send a request to the server in the form of
an XML fragment
Call xmlhttp.Open("POST", "http://cmbhstrn.dshs.state.tx.us/
cmbhswebservice/service/downloadservice.asmx", False)

Call xmlhttp.send(XMLConnectString)


'Create an xml document object, and load the server's response
Dim xmldoc
Set xmldoc = CreateObject("Microsoft.XMLDOM")
xmldoc.async = False
'Note: the ResponseXml property parses the server's response,
responsetext doesn't
'xmldoc.loadxml (xmlhttp.responsexml)
Me.Responsetext = xmlhttp.Responsetext
Exit Sub
End Sub

The error line is: Call xmlhttp.send(XMLConnectString)

Hopefully this is something simple.

Bob Barrows

unread,
Sep 25, 2009, 4:21:25 PM9/25/09
to
Bob Alston wrote:
> I keep getting the error: -2147024809 (80070057) The parameter is
> incorrect
>
> Here is the XML text:
>
> <?xml version="1.0" encoding="utf-8"?>
> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<snip>

> </soap12:Envelope>
>
> Here is my VBA code:
>
> Private Sub Command2_Click()
> Dim XMLConnectString As String
>
> Dim XMLResponseText As String
> Me.Responsetext = ""
> XMLConnectString = Me.fld
> 'Create the xmlhttp object
<snip>
> Call xmlhttp.send(XMLConnectString)
>
<snip>

> The error line is: Call xmlhttp.send(XMLConnectString)
>
> Hopefully this is something simple.

Does XMLConnectString contain the xml you initially posted?

--
HTH,
Bob Barrows


Bob Barrows

unread,
Sep 25, 2009, 4:27:01 PM9/25/09
to
Bob Alston wrote:
> I keep getting the error: -2147024809 (80070057) The parameter is
> incorrect
>
> Here is the XML text:
>
> <?xml version="1.0" encoding="utf-8"?>
> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<snip>

> </soap12:Envelope>
>
> Here is my VBA code:
>
> Private Sub Command2_Click()
> Dim XMLConnectString As String
>
> Dim XMLResponseText As String
> Me.Responsetext = ""
> XMLConnectString = Me.fld
> 'Create the xmlhttp object
<snip>
> Call xmlhttp.send(XMLConnectString)
>
<snip>

> The error line is: Call xmlhttp.send(XMLConnectString)
>
> Hopefully this is something simple.

Oh wait ... you can't pass a string. You have to pass an xmldocument:
dim xmlSend as msxml2.domdocument
set xmlsend = new msxml2.domdocument
xmlsend.loadxml XMLConnectString
Call xmlhttp.send(xmlsend)


I suggest you use "msxml2." rather than "Microsoft." to avoid xml parser
version issues.
And it doesn't really make a lot of difference but I only use
CreateObject in vbscript ... this definietly comes under the heading of
"personal preference".

--
HTH,
Bob Barrows


Bob Alston

unread,
Sep 26, 2009, 10:50:02 AM9/26/09
to
> Bob Barrows- Hide quoted text -
>
> - Show quoted text -

Thank you. that was it. I cannot send a string.
I used

Dim xmldoc
Set xmldoc = CreateObject("Microsoft.xmldom")
xmldoc.loadxml (XMLConnectString)

Bob

0 new messages