how to send a SOAP message

Discussion in 'ASP .Net Web Services' started by wptpro@gmail.com, Feb 7, 2006.

  1. Guest

    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)
    , Feb 7, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sham Ramakrishnan
    Replies:
    2
    Views:
    8,333
    Sham Ramakrishnan
    Jul 1, 2003
  2. rabbits77
    Replies:
    0
    Views:
    854
    rabbits77
    Feb 26, 2004
  3. John
    Replies:
    8
    Views:
    903
    iksrazal
    Mar 28, 2005
  4. mooseshoes

    To SOAP or Not To SOAP?

    mooseshoes, Sep 4, 2003, in forum: XML
    Replies:
    3
    Views:
    387
    Heinz Häberle
    Sep 21, 2003
  5. Peter van der veen

    How to add SOAP header to a SOAP message?

    Peter van der veen, Nov 8, 2006, in forum: ASP .Net Web Services
    Replies:
    6
    Views:
    558
    J. Dudgeon
    Nov 14, 2006
Loading...

Share This Page