haxr (XML RPC) rendering of string values

with haxr-20050621, I have trouble interfacing to Java.
When I build an XML RPC call with haxr, containing a struct, I get
<?xml version='1.0' ?>
<methodName
>vorlesungen
but when I build the same call with org.apache.xmlrpc, I get
<?xml version="1.0"?><methodCall><methodName>vorlesungen</methodName>
<params><param><value><struct><member><name>matrikel</name><value>531</value></member>
<member><name>schule</name><value>HTWK</value></member> ...
the difference is that haxr has extra <string> tags
for values of arguments. I don't think this is right?
Best regards,
--
-- Johannes Waldmann -- Tel/Fax (0341) 3076 6479/80 --
---- http://www.imn.htwk-leipzig.de/~waldmann/ -------

Johannes Waldmann wrote:
with haxr-20050621, I have trouble interfacing to Java.
When I build an XML RPC call with haxr, containing a struct, I get
<?xml version='1.0' ?>
<methodName >vorlesungen
but when I build the same call with org.apache.xmlrpc, I get
<?xml version="1.0"?><methodCall><methodName>vorlesungen</methodName> <params><param><value><struct><member><name>matrikel</name><value>531</value></member> <member><name>schule</name><value>HTWK</value></member> ...
the difference is that haxr has extra <string> tags for values of arguments. I don't think this is right?
Best regards,
Ah, I seem to have missed one important sentence in the XML-RPC spec [1]: "If no type is indicated, the type is string.". The way I understand the spec, having the <string>...</string> is optional. So what HAXR produces is valid and should be accepted by any implementation. However, I think HaXR won't accept a call without an explicit type tag. In other words, I would expect HaXR's calls to be understood by anyone, but that HaXR won't understand all valid calls. Is that what happens? /Björn [1] http://www.xmlrpc.com/spec

explicit type tag. In other words, I would expect HaXR's calls to be understood by anyone, but that HaXR won't understand all valid calls. Is that what happens?
Yes, this is what it looks like for the one direction I checked (Client: java, Server: haxr) - Best regards, -- -- Johannes Waldmann -- Tel/Fax (0341) 3076 6479/80 -- ---- http://www.imn.htwk-leipzig.de/~waldmann/ -------

Johannes Waldmann wrote:
with haxr-20050621, I have trouble interfacing to Java.
When I build an XML RPC call with haxr, containing a struct, I get
<?xml version='1.0' ?>
<methodName >vorlesungen
but when I build the same call with org.apache.xmlrpc, I get
<?xml version="1.0"?><methodCall><methodName>vorlesungen</methodName> <params><param><value><struct><member><name>matrikel</name><value>531</value></member> <member><name>schule</name><value>HTWK</value></member> ...
the difference is that haxr has extra <string> tags for values of arguments. I don't think this is right?
There is an fix in darcs now. It's untested; I'll test it as soon as I get a test environment set up. Let me know how it works out for you. Thanks to Malcom Wallace for suggesting a low-resistance way to fix this. /Björn

There is an fix in darcs now. It's untested; I'll test it as soon as I get a test environment set up. Let me know how it works out for you.
thanks for the fix. now there seems to be another problem: my java client (using org.apache.xmlrpc.XmlRpcClientLite) seems to encode spaces in strings when it creates a Request, but haxr does not seem to decode this. My Haskell function on the Server gets to see something like Actor { schule = "HTWK Leipzig" , matrikel = "531" } when actually it should be Actor { schule = "HTWK Leipzig" , matrikel = "531" } (this latter form is also constructed by the haxr client). Best regards, -- -- Johannes Waldmann -- Tel/Fax (0341) 3076 6479/80 -- ---- http://www.imn.htwk-leipzig.de/~waldmann/ -------

Johannes Waldmann wrote:
There is an fix in darcs now. It's untested; I'll test it as soon as I get a test environment set up. Let me know how it works out for you.
thanks for the fix. now there seems to be another problem: my java client (using org.apache.xmlrpc.XmlRpcClientLite) seems to encode spaces in strings when it creates a Request, but haxr does not seem to decode this.
My Haskell function on the Server gets to see something like Actor { schule = "HTWK Leipzig" , matrikel = "531" } when actually it should be Actor { schule = "HTWK Leipzig" , matrikel = "531" } (this latter form is also constructed by the haxr client).
Best regards,
Ah, that's a clever way to get around the problems in the XML-RPC spec regarding the treatment of whitespace in string values. The spec says: "Any characters are allowed in a string except < and &, which are encoded as < and &. A string can be used to encode binary data." Nothing is said about which additional entities should be supported in the input. I'm looking into this. /Björn

"Any characters are allowed in a string except < and &, which are encoded as < and &. A string can be used to encode binary data."
I made the quick "fix" of adding the last line in Internals: readString :: Monad m => String -> Err m String readString = return . replace "&" "&" . replace "<" "<" . replace ">" ">" . replace " " " " -- -- Johannes Waldmann -- Tel/Fax (0341) 3076 6479/80 -- ---- http://www.imn.htwk-leipzig.de/~waldmann/ -------

Johannes Waldmann wrote:
"Any characters are allowed in a string except < and &, which are encoded as < and &. A string can be used to encode binary data."
I made the quick "fix" of adding the last line in Internals:
readString :: Monad m => String -> Err m String readString = return . replace "&" "&" . replace "<" "<" . replace ">" ">" . replace " " " "
Since this only adds to my already incredibly inefficient hack for handling entity references, it's of course not a long term solution. I'll try to write something better. I had forgotten that I used this crazy hack. /Björn
participants (2)
-
Björn Bringert
-
Johannes Waldmann