Hi,
I am new to this formum and XML, but hope someone can share some
help.
I am integrating the Clickatell SMS XML Batch api into a asp based
page. Not .net but I hope the xml will be relevance for this post.

When sending I am getting an error "XML error: Reserved XML Name at
line 1"
Clickatell provide a sms api with the provision to post xml for bulk
sms sends.
They have a test send page I have used at http://api.clickatell.com/xml/tst.html
 As you will see below the markup is send within <clickAPI></clickAPI>
tags.
I have tried each <clickAPI> within my code in the clickatell test
page with success.
However on running I receive the error
"XML error: Reserved XML Name at line 1"

I then tried retrieving the sessionID, by stopping the code and
writing the response to the browser. I then declared the sessionID to
retrieve the batchID the same way. Then I ran successfully.


So I tried using a Status = 200 to ensure the postback before
continuing to the next block but to no avail. Didnt work. Same error.
I think the problem is somewhere in the xml, applying the callback
value but not sure.

Thanks for any help or suggestions you can give,

Mike

'--------------------- Code is as follows -->

dim sURL, str

sURL = "http://api.clickatell.com/xml/xml";
str = "<clickAPI>"
        str = str & "<auth>"
                str = str & "<api_id>MY API ID HERE</api_id>"
                str = str & "<user>MY_USERNAME</user>"
                str = str & "<password>MY_PASSWORD</password>"
        str = str & "</auth>"
str = str & "</clickAPI>"
str="data=" & str

'retrieve session id: returnSession with this post
        set oXMLHTTP = server.CreateObject("Microsoft.XMLHTTP")
        oXMLHTTP.open "POST", sURL, false
        oXMLHTTP.SetRequestHeader "Content-Type", "application/x-www-form-
urlencoded"
        oXMLHTTP.Send str
        returnSession = oXMLHTTP.responseText
        set oXMLHTTP = nothing

'post session id back with startBatch to retrieve returnBatch

str = "<clickAPI>"
        str = str & "<startBatch>"
                str = str & "<session_id>" & returnSession & "</session_id>"
                str = str & "<from>AUTHORISED FROM</from>"
                str = str & "<template>MY MESSAGE</template>"
        str = str & "</startBatch>"
str = str & "</clickAPI>"
str="data=" & str

'return batch id with this post, includes the returnSession var
        set oXMLHTTP = server.CreateObject("Microsoft.XMLHTTP")
        oXMLHTTP.open "POST", sURL, false
        oXMLHTTP.SetRequestHeader "Content-Type", "application/x-www-form-
urlencoded"
        oXMLHTTP.Send str
        returnBatch = oXMLHTTP.responseText
        set oXMLHTTP = nothing
' I am now going to loop thru the recipients array where 0 = firstname
and 1 = mobile number
'NOTE I have the comlete international string for the mobile number
entered in my test data so no prob there

str = "<clickAPI>"
        for i = 0 to ubound(rows,2)
                str = str & "<sendItem>"
                        str = str & "<session_id>" & returnSession & 
"</session_id>"
                        str = str & "<batch_id>" & returnBatch & "</batch_id>"
                        str = str & "<to>" & recipients(1,i) & "</to>"
                        str = str & "<field1>" & recipients(0,i) & "</field1>"
                str = str & "</sendItem>"
        next
str = str & "</clickAPI>"
str="data=" & str

'post sends send item details and returns success message

set oXMLHTTP = server.CreateObject("Microsoft.XMLHTTP")
oXMLHTTP.open "POST", sURL, false
oXMLHTTP.SetRequestHeader "Content-Type", "application/x-www-form-
urlencoded"
oXMLHTTP.Send str
sResult = oXMLHTTP.responseText
set oXMLHTTP = nothing
response.write(sResult)

Reply via email to