help! why doesnt this work...or is there a better way?

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

  1. Guest

    I need to send a soap message, is this 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.or...

    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://sche...

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

  2. Josh Twist Guest

    You'd really need to look at what the end result of strRequest is...
    Debug your code and/or write it to a file. Then make sure you're
    creating valid XML by viewing it in an XML editor (or Internet
    Explorer).

    If all that is OK - then we can have a look at your soap for you :)

    Josh
    http://www.thejoyofcode.com/
    Josh Twist, Feb 10, 2006
    #2
    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. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,739
    Smokey Grindel
    Dec 2, 2006
  2. user
    Replies:
    3
    Views:
    646
    =?ISO-8859-1?Q?G=F6ran_Andersson?=
    Mar 31, 2007
  3. Janaka Perera
    Replies:
    0
    Views:
    1,106
    Janaka Perera
    Oct 29, 2007
  4. Replies:
    3
    Views:
    420
    alex23
    May 27, 2008
  5. Paul Rubin
    Replies:
    5
    Views:
    407
    Hendrik van Rooyen
    Aug 6, 2009
Loading...

Share This Page