You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@ws.apache.org by Tanya Brethour <br...@ncsa.uiuc.edu> on 2003/11/03 17:51:05 UTC

XmlRpc.parse problems

Hello. I am getting a java.lang.NumberFormatException when calling execute
on my client with specific parameters (the stack trace and debug output is
below).  I am trying to call execute with 5 parameters. Each of them is a
string, but for some reason the parser is trying to convert the two date
strings to integers. I need them to be strings and not integers or the
date type, in order for the xml-rpc server to process the call. Here is
the call (from debug output).

Client calling procedure 'PIPES.NetworkMeasurement' with parameters [V4,
STTL, DNVR, 20031102000000, 20031103000000]

Anyone have any idea how I can force it to not convert the date strings to
integers? 


Stack Trace and Debug:
Client calling procedure 'PIPES.NetworkMeasurement' with parameters [V4,
STTL, DNVR, 20031102000000, 20031103000000]
Beginning parsing XML input stream
startElement: methodResponse
startElement: params
startElement: param
startElement: value
startElement: struct
startElement: member
startElement: name
endElement: name
startElement: value
startElement: struct
startElement: member
startElement: name
endElement: name
startElement: value
startElement: int
endElement: int
java.lang.NumberFormatException: For input string: "20031103000000"
        at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
        at java.lang.Integer.parseInt(Integer.java:438)
        at java.lang.Integer.<init>(Integer.java:567)
        at org.apache.xmlrpc.XmlRpc$Value.characterData(Unknown Source)
        at org.apache.xmlrpc.XmlRpc.endElement(Unknown Source)
        at uk.co.wilson.xml.MinML.parse(Unknown Source)
        at uk.co.wilson.xml.MinML.parse(Unknown Source)
        at org.apache.xmlrpc.XmlRpc.parse(Unknown Source)
        at org.apache.xmlrpc.XmlRpcClient$Worker.execute(Unknown Source)
        at org.apache.xmlrpc.XmlRpcClient.execute(Unknown Source)
        at
net.nlanr.dast.advisor.gui.AdvisorThread.getPipesData(AdvisorThread.java:149)
        at
net.nlanr.dast.advisor.gui.AdvisorGUI.actionPerformed(AdvisorGUI.java:251)
        at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1764)
        at
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1817)
        at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:419)
        at
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
        at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
        at java.awt.Component.processMouseEvent(Component.java:5134)
        at java.awt.Component.processEvent(Component.java:4931)
        at java.awt.Container.processEvent(Container.java:1566)
        at java.awt.Component.dispatchEventImpl(Component.java:3639)
        at java.awt.Container.dispatchEventImpl(Container.java:1623)
        at java.awt.Component.dispatchEvent(Component.java:3480)
        at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
        at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:3165)
        at
java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
        at java.awt.Container.dispatchEventImpl(Container.java:1609)
        at java.awt.Window.dispatchEventImpl(Window.java:1590)
        at java.awt.Component.dispatchEvent(Component.java:3480)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
        at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
        at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
(snip)


TIA,
Tanya





Re: XmlRpc.parse problems

Posted by Tanya Brethour <br...@ncsa.uiuc.edu>.
> > I'm using the org.apache.xmlrpc.XmlRpcClient. Here is the code I have
> > to create the client (changed a bit for privacy):
> >
> > client = new
> > XmlRpcClient("http://someurl.org/xmlrpc_server.cgi");
> >
> > Vector xmlrpcParams = new Vector();
> >       xmlrpcParams.add("V4");
> >       xmlrpcParams.add("STTL");
> >       xmlrpcParams.add("DNVR");
> >
> >       xmlrpcParams.add("20031102000000");
> >       xmlrpcParams.add("20031103000000");
> >
> >       Vector results = (Vector)
> > client.execute("PIPES.NetworkMeasurement", xmlrpcParams);
> >
> >> You would be better off sending your "date" values as <string>s if
> >> you want to use this format.
> >
> > I guess thats what I thought I was doing by adding them to the execute
> > vector parameter as strings.
> 
> The code you post looks fine. However it does not correspond to the parse
> trace you posted. Is it possible that you are not running the code you
> posted?

Hmm. No, its the same code. I even deleted the class files and recompiled
to make sure and also tried toggling debug output on and off. So I am sure
its the same code.

Actually, could this be an error in the response instead of the request?
 
Thats probably why it says "startElement: methodResponse"... heh. Ok, if
so, I'll have to contact the person who wrote the server to get it sorted
out I guess. Darn, sorry for the trouble.

Thanks,
Tanya



Re: XmlRpc.parse problems

Posted by John Wilson <tu...@wilson.co.uk>.
Tanya Brethour wrote:
>>> Client calling procedure 'PIPES.NetworkMeasurement' with parameters
>>> [V4, STTL, DNVR, 20031102000000, 20031103000000]
>>>
>>> Anyone have any idea how I can force it to not convert the date
>>> strings to integers?
>>>
>>>
>>> Stack Trace and Debug:
>>> Client calling procedure 'PIPES.NetworkMeasurement' with parameters
>>> [V4, STTL, DNVR, 20031102000000, 20031103000000]
>>> Beginning parsing XML input stream
>>> startElement: methodResponse
>>> startElement: params
>>> startElement: param
>>> startElement: value
>>> startElement: struct
>>> startElement: member
>>> startElement: name
>>> endElement: name
>>> startElement: value
>>> startElement: struct
>>> startElement: member
>>> startElement: name
>>> endElement: name
>>> startElement: value
>>> startElement: int
>>> endElement: int
[snip]
> I'm using the org.apache.xmlrpc.XmlRpcClient. Here is the code I have
> to create the client (changed a bit for privacy):
>
> client = new
> XmlRpcClient("http://someurl.org/xmlrpc_server.cgi");
>
> Vector xmlrpcParams = new Vector();
>       xmlrpcParams.add("V4");
>       xmlrpcParams.add("STTL");
>       xmlrpcParams.add("DNVR");
>
>       xmlrpcParams.add("20031102000000");
>       xmlrpcParams.add("20031103000000");
>
>       Vector results = (Vector)
> client.execute("PIPES.NetworkMeasurement", xmlrpcParams);
>
>> You would be better off sending your "date" values as <string>s if
>> you want to use this format.
>
> I guess thats what I thought I was doing by adding them to the execute
> vector parameter as strings.

The code you post looks fine. However it does not correspond to the parse
trace you posted. Is it possible that you are not running the code you
posted?

John Wilson
The Wilson Partnership
http://www.wilson.co.uk


Re: XmlRpc.parse problems

Posted by Tanya Brethour <br...@ncsa.uiuc.edu>.
> > Client calling procedure 'PIPES.NetworkMeasurement' with parameters
> > [V4, STTL, DNVR, 20031102000000, 20031103000000]
> >
> > Anyone have any idea how I can force it to not convert the date
> > strings to integers?
> >
> >
> > Stack Trace and Debug:
> > Client calling procedure 'PIPES.NetworkMeasurement' with parameters
> > [V4, STTL, DNVR, 20031102000000, 20031103000000]
> > Beginning parsing XML input stream
> > startElement: methodResponse
> > startElement: params
> > startElement: param
> > startElement: value
> > startElement: struct
> > startElement: member
> > startElement: name
> > endElement: name
> > startElement: value
> > startElement: struct
> > startElement: member
> > startElement: name
> > endElement: name
> > startElement: value
> > startElement: int
> > endElement: int
> > java.lang.NumberFormatException: For input string: "20031103000000"
> 
> What XML-RPC client are you using? It is sending the "date" values as
> <int>s. It's also sending the first parameter as a <struct> with the first
> member being another <struct> with the "data" as the first member of the
> inner <struct>.

I'm using the org.apache.xmlrpc.XmlRpcClient. Here is the code I have to
create the client (changed a bit for privacy):

client = new 
XmlRpcClient("http://someurl.org/xmlrpc_server.cgi"); 

Vector xmlrpcParams = new Vector();
      xmlrpcParams.add("V4");
      xmlrpcParams.add("STTL");
      xmlrpcParams.add("DNVR");

      xmlrpcParams.add("20031102000000");
      xmlrpcParams.add("20031103000000");
      
      Vector results = (Vector) client.execute("PIPES.NetworkMeasurement",
xmlrpcParams);

> You would be better off sending your "date" values as <string>s if you want
> to use this format.

I guess thats what I thought I was doing by adding them to the execute
vector parameter as strings. 

-Tanya


Re: XmlRpc.parse problems

Posted by John Wilson <tu...@wilson.co.uk>.
Tanya Brethour wrote:
> Hello. I am getting a java.lang.NumberFormatException when calling
> execute on my client with specific parameters (the stack trace and
> debug output is below).  I am trying to call execute with 5
> parameters. Each of them is a string, but for some reason the parser
> is trying to convert the two date strings to integers. I need them to
> be strings and not integers or the date type, in order for the
> xml-rpc server to process the call. Here is the call (from debug
> output).
>
> Client calling procedure 'PIPES.NetworkMeasurement' with parameters
> [V4, STTL, DNVR, 20031102000000, 20031103000000]
>
> Anyone have any idea how I can force it to not convert the date
> strings to integers?
>
>
> Stack Trace and Debug:
> Client calling procedure 'PIPES.NetworkMeasurement' with parameters
> [V4, STTL, DNVR, 20031102000000, 20031103000000]
> Beginning parsing XML input stream
> startElement: methodResponse
> startElement: params
> startElement: param
> startElement: value
> startElement: struct
> startElement: member
> startElement: name
> endElement: name
> startElement: value
> startElement: struct
> startElement: member
> startElement: name
> endElement: name
> startElement: value
> startElement: int
> endElement: int
> java.lang.NumberFormatException: For input string: "20031103000000"

What XML-RPC client are you using? It is sending the "date" values as
<int>s. It's also sending the first parameter as a <struct> with the first
member being another <struct> with the "data" as the first member of the
inner <struct>.

You would be better off sending your "date" values as <string>s if you want
to use this format.

John Wilson
The Wilson Partnership
http://www.wilson.co.uk