Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

HTTP, XML & Tcl

16 views
Skip to first unread message

alf

unread,
Feb 21, 2006, 4:12:25 PM2/21/06
to
Hi

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

Steve Ball

unread,
Feb 21, 2006, 8:10:19 PM2/21/06
to
Have you looked at the http package? You want something like this:

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

alf

unread,
Feb 22, 2006, 8:39:24 AM2/22/06
to
Steve

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

Donal K. Fellows

unread,
Feb 22, 2006, 11:23:32 AM2/22/06
to

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.

alf

unread,
Feb 22, 2006, 6:37:30 PM2/22/06
to
Hi

Your advices were very useful and I finally got it work...

Thank you all
alf

0 new messages