You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_dtcl@tcl.apache.org by yahalom emet <ya...@zvia.org.il> on 2002/05/19 11:18:52 UTC

post data

Hello

I am sending in a post operation this xml data:
<test>
<testAttribute test="2"/>
<testSemi>2;3434;23434;34</testSemi>
</test>

when I do "var all" I get :
{<test>
<testAttribute test} {"2"/>
<testSemi>2} 3434 {} 23434 {} {34</testSemi>

</test>

} {}

how should I retrieve the sent xml?

Thanks


Yahalom Emet
Software Developer
Xor Technologies Ltd.

Tel: +972 (0)4-6619164
E-mail: yahalom@zvia.org.il
Web: http://www.xortechnologies.com



Re: post data

Posted by "David N. Welton" <da...@dedasys.com>.
"yahalom emet" <ya...@zvia.org.il> writes:

I don't know anything about visual basic, but I'm almost %100 sure
that the problem is the same.

> but it happend from other languages like vb:
> Set oXml = New MSXML.XMLHTTPRequest
> oXml.open "POST", "http://192.168.10.150/xmlServer/xmlServer.ttml" ', True,
> "DEMO", "TESFLY"
> 
> oXml.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

> s = " <test>"
>     s = s & "<testAttribute test=""2" & """" & "/>"
>     s = s & "<testSemi>2;3434;23434;34</testSemi>"
>     s = s & "</test>"
> oXml.send s

It doesn't like you are doing anything to transform 's' into a
properly formatted query string.

> in oXml.responseText I get:
> { <test><testAttribute test} {"2"/><testSemi>2} 3434 {} 23434 {}
> 34</testSemi></test> {}

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
     Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
   Apache Tcl: http://tcl.apache.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: mod_dtcl-unsubscribe@tcl.apache.org
For additional commands, e-mail: mod_dtcl-help@tcl.apache.org


Re: post data

Posted by "David N. Welton" <da...@dedasys.com>.
"yahalom emet" <ya...@zvia.org.il> writes:

> I do it in tcl but the problem exists also from other languages.
> the content type is "application/x-www-form-urlencoded"

There is a problem with the following code:
 
> in tcl:
> set data "<test>
>  <testAttribute test="2"/>
>  <testSemi>2;3434;23434;34</testSemi>
>  </test>
> "
> set response [http::geturl
> http://192.168.10.150/xmlServer/xmlServer.ttml -query  $data -timeout 50000]

You need to encode the data:

set data {<test>
    <testAttribute test="2"/>
    <testSemi>2;3434;23434;34</testSemi>
    </test>
}

set response [http::geturl http://localhost/post.ttml -query [http::formatQuery foo $data] -timeout 50000]
puts [http::data $response]

That gives me:

foo {<test>
    <testAttribute test="2"/>
    <testSemi>2;3434;23434;34</testSemi>
    </test>
}

Otherwise, you are sending it 'raw', and things like = and ; are not
encoded, and are thus seen by the parser, which then dutifully mangles
the string:-)

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
     Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
   Apache Tcl: http://tcl.apache.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: mod_dtcl-unsubscribe@tcl.apache.org
For additional commands, e-mail: mod_dtcl-help@tcl.apache.org


Re: post data

Posted by "David N. Welton" <da...@dedasys.com>.
"yahalom emet" <ya...@zvia.org.il> writes:

> I am sending in a post operation this xml data:
> <test>
> <testAttribute test="2"/>
> <testSemi>2;3434;23434;34</testSemi>
> </test>

How *exactly* are you sending it in?
 
> when I do "var all" I get :
> {<test>
> <testAttribute test} {"2"/>
> <testSemi>2} 3434 {} 23434 {} {34</testSemi>
> 
> </test>
> 
> } {}

To me, it looks as if it's getting parsed one too many times, or that
it's not getting encoded when it's sent.  See how it things that
everything before test="2" is a variable name, and that 2 and the
stuff that follows untill ; is its value?

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
     Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
   Apache Tcl: http://tcl.apache.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: mod_dtcl-unsubscribe@tcl.apache.org
For additional commands, e-mail: mod_dtcl-help@tcl.apache.org


Re: post data

Posted by "David N. Welton" <da...@dedasys.com>.
"yahalom emet" <ya...@zvia.org.il> writes:

> I am sending in a post operation this xml data:
> <test>
> <testAttribute test="2"/>
> <testSemi>2;3434;23434;34</testSemi>
> </test>
> 
> when I do "var all" I get :
> {<test>
> <testAttribute test} {"2"/>
> <testSemi>2} 3434 {} 23434 {} {34</testSemi>
> 
> </test>
> 
> } {}
> 
> how should I retrieve the sent xml?

Hrm... that's an odd one.  Try using the other 'var' commands and see
what happens.  I will look into it...

Thanks,
-- 
David N. Welton
   Consulting: http://www.dedasys.com/
     Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
   Apache Tcl: http://tcl.apache.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: mod_dtcl-unsubscribe@tcl.apache.org
For additional commands, e-mail: mod_dtcl-help@tcl.apache.org