:) Yes, we are in circles. No, I do not generate any XML-RPC elements from
jsp or anything else. Well, here is waht i've found:
1) Xindice is a native xml bd
2) It is so killing stupid sometimes
3) That is why if you want to be happy, you will need XML-RPC
4) I hate the day i started to use it ;)

minor and more concrete.
1) Xindice xml-rpc seats ontop of the apache xml-rpc
2) There are 2 classes in Xindice xml-rpc
  a) RPCOperations (that is generic with Xindice api and nothing
interesting)
  b) XmlRpc handler (here is the stuff)
3) These classes are packed in jar and plugged to the Xindice /lib together
with org.apache.xmlrpc package. Xindice works with Xerces. That jar wirk as
filter, you access the database via http://servername:4080

then, if you need to call any method via xml-rpc (let's say
getDocumentCount(String path)); you can do it from wherether you want
(that's what I like). From Xindice documentation that is like this:

 XmlRpcClient  client = new XmlRpcClient("http://localhost:4080";);
            Vector params = new Vector();
            params.addElement("/db/root");
            Integer result = (Integer) client.execute("db.getDocumentCount",
params);
            System.out.println(result);
So it can be done from Servlet, jsp or elsewhere. It can be done via io
taglib etc. BUT! There is no way to tell what encoding to use. Im gonna die.
Twice.

I see the problrm in returning the operation result. The result of any
operation (getDocument) returns to xmlrpcServer as an InputStream.
byte[] blah = xmlrpc.execute(gateway.getInputStream());

So the problem is in encoding the Response in Xindice xml-rpc sources, which
are dealing with apache.xml-rpc (that is why Iam boring you now:))
I've tried different things:

XmlRpcServer xmlrpc = new XmlRpcServer();
         xmlrpc.addHandler ("db", new RPCOperations());

         byte[] result = xmlrpc.execute(gateway.getInputStream());

         String r = new String(xmlrpc.execute(gateway.getInputStream()));
              System.out.println("1: "+r);
         r = new String(r.getBytes("utf-8"));
              System.out.println("2: "+r);
         r = new String(r.getBytes(), "utf-8");
              System.out.println("3: "+r);
         r = new String(r.getBytes("utf-8"), "utf-8");
              System.out.println("4: "+r);
         r = new String(r.getBytes("ISO-8859-1"), "utf-8");
              System.out.println("5: "+r);
         r = new String(r.getBytes(), "ISO-8859-1");
              System.out.println("6: "+r);

and it prints out <?xml version="1.0" encoding="ISO-8859-1"?> with ???
anyway. If you can not help me, I'll sell all my books about java, by ticket
to where ppl made Xindice live and make them feel bad, shure. Well, maybe
the problem is in how to reencode InputStream... maybe readUTF will save
me... maybe not.

current mood: devil
current mysic: du hast mich
Phil.


----- Original Message -----
From: "John Wilson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 10, 2002 3:11 AM
Subject: Re: xml-rpc & encoding


> Philipp Chudinov wrote:
> > John, there is no encoding attribute in my documents. they are all
> > UTF-8, and, since it is default encoding, I do not have this
> > attribute,but that is in_my_documents. You see, I have no idea where
> > it takes this encoding (see the sample below)
> >
> > <?xml version="1.0" encoding="ISO-8859-1"?> //I Do not know, where it
> > came from! My jsp page is UTF-8 too... io taglib is set attr utf-8
>
> We may be going round in circles a little here....
>
> If I understand this correctly you are generating the whole of the
response
> (including the XML-RPC elements and the XML declaration) from a JSP page.
So
> some part of the JSP process must be producing the XML declaration
(forgive
> me if I have got this wrong - I am not a JSP/Struts developer). If you can
> modify your JSP system not to generate the XML declaration then replacing
> MinML with Xerces in the XML-RPC client should work. However, can you tell
> your JSP system to encode using ISO 8859/1? If you can tell it to encode
in
> UTF-8 I would have thought that you could have told it to use some other
> encoding. This would let XML-RPC work "as is".
>
> > there is a method setEncoding() in apache xml-rpc. Could you provide
> > any code sample? Since Iam not so strong in abstract classes (this
> > method is at abstract XmlRpc.java) I just do not know yet how to
> > implement it in XmlRpc Handler... If it is possible to do somehow...
>
> Setting the system default encoding to UTF-8 (set the system property
> file.encoding to UTF-8) should make MinML (but not Xerces) treat the input
> bytes as UTF-8 encoded. Note this is a really nasty hack and may well
break
> with a later XML-RPC release.
>
> John Wilson
> The Wilson Partnership
> http://www.wilson.co.uk
>
>

Reply via email to