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.
Does XMLConnectString contain the xml you initially posted?
--
HTH,
Bob Barrows
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
Thank you. that was it. I cannot send a string.
I used
Dim xmldoc
Set xmldoc = CreateObject("Microsoft.xmldom")
xmldoc.loadxml (XMLConnectString)
Bob