how to send a SOAP message


W

wptpro

I need to send a soap message, is the the correct way of doing it? I
get an error back..."parsing error: org.xml.sax.SAXParseException:
Premature end of file."


Dim strRequest As String
Dim oXML As Object
Dim strResult As String

strRequest = "<?xml version='1.0' encoding='UTF-8' ?>" & vbCrLf
strRequest += "<SOAP-ENV:Envelope
xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'>" & vbCrLf
strRequest += "<SOAP-ENV:Header>" & vbCrLf
strRequest += "<Authentication>" & vbCrLf
strRequest += " <application_id>accountid</application_id>" &
vbCrLf
strRequest += " <password>thepassword</password>" & vbCrLf
strRequest += "</Authentication>" & vbCrLf
strRequest += "</SOAP-ENV:Header>" & vbCrLf
strRequest += "<SOAP-ENV:Body>" & vbCrLf
strRequest += " <ns1:getHandsetByPTN
SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:ns1='urn:HandsetService'>" & vbCrLf
strRequest += " <applRef xsi:nil='true'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:type='xsd:string' />" & vbCrLf
strRequest += " <ptn xsi:type='xsd:string'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>8586883672</ptn>"
& vbCrLf
strRequest += "</ns1:getHandsetByPTN>" & vbCrLf
strRequest += "</SOAP-ENV:Body>" & vbCrLf
strRequest += "</SOAP-ENV:Envelope>"


' Create an xmlhttp object:
oXML = CreateObject("MSXML2.ServerXMLHTTP")
oXML.open("POST", "https://the url goes here", False)
oXML.setRequestHeader("Content-Type", "text/xml")
oXML.SetRequestHeader("Content-length", strRequest.Length)
oXML.SetRequestHeader("Connection", "Keep-Alive")
oXML.Send(strRequest)
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top