I need help posting an XML form to an HTTP server.
In general, this is what I want to do:
1. Connect to wctp.skytel.com:80
2. Move to wctp.skytel.com/wctp
3. Declare content type = "text/xml" ("text/html",
"text/plain")
4. Post the following:
<?xml version="1.0"?>
<!DOCTYPE wctp-Operation SYSTEM
"http://www.skytel.com/protocols/dtds/wctp/wctpv1-0.dtd">
<wctp-Operation wctpVersion="WCTP-DTD-1.1">
<wctp-SubmitClientMessage>
<wctp-SubmitClientHeader
submitTimestamp="2000-08-08T13:19:43"
>
<wctp-ClientOriginator
senderID="1234567"
/>
<wctp-ClientMessageControl
allowResponse="true"
allowTruncation="true"
deliveryPriority="HIGH"
notifyWhenDelivered="true"
notifyWhenQueued="true"
notifyWhenRead="true"
preformatted="true"
/>
<wctp-Recipient
recipientID="9999999"
/>
</wctp-SubmitClientHeader>
<wctp-Payload>
<wctp-Alphanumeric>
tst msg to internet email address
</wctp-Alphanumeric>
</wctp-Payload>
</wctp-SubmitClientMessage>
</wctp-Operation>
5. Get the response.
I do not need (yet?) to parse XML data.
I am a TCLer but know nothing about http. If I get this part right, I
will be able to take it from there.
Thanks
alf
package require http
set token [http::geturl http://wctp.skytel.com/wctp -query $xml -type
text/xml]
http::wait $token
set response [http::data $token]
where $xml contains the XML document you want to POST. Of course,
you'll want to look up all the other options and commands in the http
package to handle error conditions, feedback, progressive send/receive,
etc.
HTHs,
Steve Ball
Yes, I did look at the http package. One of the things that bogged me
down was -query whose argument must be formatted with the
::http::formatQuery command which takes pairs of arguments: key value
?key value...?.
Thanks
alf
That really depends on what the query format is. If it is XML (i.e. if
you're using the -type text/xml flag as Steve Ball suggested) then it's
not [http::formatQuery] that you should be using, but something that
produces a suitable XML document, assuming you've not already got one... ;-)
Donal.
Your advices were very useful and I finally got it work...
Thank you all
alf