You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlrpc-dev@ws.apache.org by Lucio Crusca <lu...@sulweb.org> on 2010/04/13 08:38:40 UTC

how to get the xml bytes

Hello *,

I'm coding some XMLRPC client tests for certain XMLRPC webservices. The server 
is Django and it's being written by someone else, but that's only to say I 
have no control over that code. All I have to do is to write client Java tests 
for the documented services.

Now one of my tests fails. The developer who writes server code asked me to 
add to my failed test output the xml string sent by my client to his server. 
Here is my current java code:

    XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
    config.setServerURL(new URL(url));
    config.setBasicUserName("admin");
    config.setBasicPassword("admin");

    XmlRpcClient client = new XmlRpcClient();
    client.setConfig(config);

    String rpcmethod = "resources.myrpcservice";
    params = new Object[]{1};
    client.execute(rpcmethod, params);

(basically cut & pasted from the examples). How do I intercept the xml string 
my client sends to the server?

Thanks in advance,
Lucio.

Re: how to get the xml bytes [SOLVED]

Posted by paulbakker <p....@sourcesense.com>.
Hi Lucio,

It's long ago, but can you tell a bit more about the TypeFactoryImpl you
wrote?

Paul


Lucio Crusca-2 wrote:
> 
> In data martedì 13 aprile 2010 16:14:01, countzero@cyberdeck.org ha
> scritto:
>> Simply set enabledForExtensions() in your client.
>> 
>> See http://ws.apache.org/xmlrpc/types.html for details on what additional
>> data types this grants access to.
> 
> Tried, but the type Django uses is
> 
> <nil />
> 
> not
> 
> <ex:nil />
> 
> so enabledForExtensions() doesn't fix the problem. I ended up creating a
> custom 
> TypeFactoryImpl.
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/how-to-get-the-xml-bytes-tp28226421p31971173.html
Sent from the Apache Xml-RPC - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


Re: how to get the xml bytes [SOLVED]

Posted by Lucio Crusca <lu...@sulweb.org>.
In data martedì 13 aprile 2010 16:14:01, countzero@cyberdeck.org ha scritto:
> Simply set enabledForExtensions() in your client.
> 
> See http://ws.apache.org/xmlrpc/types.html for details on what additional
> data types this grants access to.

Tried, but the type Django uses is

<nil />

not

<ex:nil />

so enabledForExtensions() doesn't fix the problem. I ended up creating a custom 
TypeFactoryImpl.


Re: how to get the xml bytes

Posted by co...@cyberdeck.org.
Simply set enabledForExtensions() in your client.

See http://ws.apache.org/xmlrpc/types.html for details on what additional
data types this grants access to.

-CZ

On Tue, 13 Apr 2010, Lucio Crusca wrote:

> In data martedì 13 aprile 2010 15:47:22, Lucio Crusca ha scritto:
> > tag in the reply. Is this standard maybe in a new version of XMLRPC spec?
> >  If not, is it possible to have xmlrpc recognize it even without the ex:
> >  namespace?
> >
>
> http://ontosys.com/xml-rpc/extensions.php
>
> So the question becomes: how do I xmlrpc accept this extension of the spec?
>
>

Re: how to get the xml bytes

Posted by Lucio Crusca <lu...@sulweb.org>.
In data martedì 13 aprile 2010 15:47:22, Lucio Crusca ha scritto:
> tag in the reply. Is this standard maybe in a new version of XMLRPC spec?
>  If not, is it possible to have xmlrpc recognize it even without the ex:
>  namespace?
> 

http://ontosys.com/xml-rpc/extensions.php

So the question becomes: how do I xmlrpc accept this extension of the spec?

Re: how to get the xml bytes

Posted by John Wilson <tu...@wilson.co.uk>.
On 13 Apr 2010, at 14:47, Lucio Crusca wrote:

> In data martedì 13 aprile 2010 15:38:24, Lucio Crusca ha scritto:
>> 
>> Is there any chance to get this exception from xmlrpc even when the reply
>> is NOT nil?
> 
> I reply myself: that exception has nothing to do with the reply being empty or 
> nil, but it's caused by a 
> 
> <nil />
> 
> tag in the reply. Is this standard maybe in a new version of XMLRPC spec? 

It\s not part of the XML-RPC spec. It was proposed a few years ago and Dave Winer (who invented XML-RPC and who "owns" the spec) explicitly and vehemently rejected it.

John Wilson


Re: how to get the xml bytes

Posted by Lucio Crusca <lu...@sulweb.org>.
In data martedì 13 aprile 2010 15:38:24, Lucio Crusca ha scritto:
> 
> Is there any chance to get this exception from xmlrpc even when the reply
>  is NOT nil?

I reply myself: that exception has nothing to do with the reply being empty or 
nil, but it's caused by a 

<nil />

tag in the reply. Is this standard maybe in a new version of XMLRPC spec? If 
not, is it possible to have xmlrpc recognize it even without the ex: 
namespace?

Re: how to get the xml bytes

Posted by Lucio Crusca <lu...@sulweb.org>.
In data martedì 13 aprile 2010 14:45:25, Don Albertson ha scritto:
> Being a contrary individual, I would ask the person who wants to see the
> XML to grab it when it gets to the server and show me what I'm doing
> wrong to break his server.

I've done just that, using polite words. He showed me the server it's doing 
the right job, so I moved to tcpdump, which in turn showed me the server is 
doing the right job and the reply goes through the tcp socket.

However my xlmrpc client lib raises this exception:

[...]
Caused by: org.xml.sax.SAXParseException: Unknown type: nil
        at 
org.apache.xmlrpc.parser.RecursiveTypeParserImpl.startElement(RecursiveTypeParserImpl.java:122)
        at org.apache.xmlrpc.parser.MapParser.startElement(MapParser.java:155)
        at ... 
[if you need I'll copy the whole stack trace]

Is there any chance to get this exception from xmlrpc even when the reply is 
NOT nil?

Re: how to get the xml bytes

Posted by Don Albertson <dg...@psu.edu>.
Lucio Crusca wrote:
>> Use tcpdump, wireshark, or a similar tool.
>>     
>
> Er... it's not me wanting the xml stream, maybe I didn't make it clear 
> enough... my customer (the one who pays me) asked me a java test suite (not a 
> *nix script) to produce that kind of output.
>
>   
Being a contrary individual, I would ask the person who wants to see the 
XML to grab it when it gets to the server and show me what I'm doing 
wrong to break his server.
dga


> Besides, I suspect that the xmlrpc library uses some kind of OutputStream to 
> send the xml request, and I would be disappointed if the API gave no 
> opportunity to change that stream.
>
> However now I'm going to suggest my customer to use tcpdump, I hope he's in a 
> good mood...
>
>
>
>   



Re: how to get the xml bytes

Posted by Jochen Wiedmann <jo...@gmail.com>.
I understand the words "Now one of my tests fails" to mean that you
only want this output occasionally to see what's wrong? In that case,
the tools I mentioned are the best choice, because they aren't
intrusive.

To capture the output as part of the regular unit tests, you should
subclass your transport and transport factory to produce that output
for you.

Jochen



On Tue, Apr 13, 2010 at 10:46 AM, Lucio Crusca <lu...@sulweb.org> wrote:
>> Use tcpdump, wireshark, or a similar tool.
>
> Er... it's not me wanting the xml stream, maybe I didn't make it clear
> enough... my customer (the one who pays me) asked me a java test suite (not a
> *nix script) to produce that kind of output.
>
> Besides, I suspect that the xmlrpc library uses some kind of OutputStream to
> send the xml request, and I would be disappointed if the API gave no
> opportunity to change that stream.
>
> However now I'm going to suggest my customer to use tcpdump, I hope he's in a
> good mood...
>
>



-- 
Germanys national anthem is the most boring in the world - how telling!

Re: how to get the xml bytes

Posted by Lucio Crusca <lu...@sulweb.org>.
> Use tcpdump, wireshark, or a similar tool.

Er... it's not me wanting the xml stream, maybe I didn't make it clear 
enough... my customer (the one who pays me) asked me a java test suite (not a 
*nix script) to produce that kind of output.

Besides, I suspect that the xmlrpc library uses some kind of OutputStream to 
send the xml request, and I would be disappointed if the API gave no 
opportunity to change that stream.

However now I'm going to suggest my customer to use tcpdump, I hope he's in a 
good mood...


Re: how to get the xml bytes

Posted by Jochen Wiedmann <jo...@gmail.com>.
Use tcpdump, wireshark, or a similar tool.


On Tue, Apr 13, 2010 at 8:38 AM, Lucio Crusca <lu...@sulweb.org> wrote:
> Hello *,
>
> I'm coding some XMLRPC client tests for certain XMLRPC webservices. The server
> is Django and it's being written by someone else, but that's only to say I
> have no control over that code. All I have to do is to write client Java tests
> for the documented services.
>
> Now one of my tests fails. The developer who writes server code asked me to
> add to my failed test output the xml string sent by my client to his server.
> Here is my current java code:
>
>    XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
>    config.setServerURL(new URL(url));
>    config.setBasicUserName("admin");
>    config.setBasicPassword("admin");
>
>    XmlRpcClient client = new XmlRpcClient();
>    client.setConfig(config);
>
>    String rpcmethod = "resources.myrpcservice";
>    params = new Object[]{1};
>    client.execute(rpcmethod, params);
>
> (basically cut & pasted from the examples). How do I intercept the xml string
> my client sends to the server?
>
> Thanks in advance,
> Lucio.
>



-- 
Germanys national anthem is the most boring in the world - how telling!

[ANN]VTD-XML 2.8

Posted by Jimmy Zhang <cr...@comcast.net>.
VTD-XML 2.8 has been released. Please visit 
[URL="https://sourceforge.net/projects/vtd-xml/files/"]https://sourceforge.net/projects/vtd-xml/files/[/URL] 
to download the latest version.

1 Expansion of Core VTD-XML API
* VTDGen adds support for capturing white spaces
* VTDNav adds support for suport for getContentFragment(), recoverNode() 
and cloneNav()
* XMLModifier adds support for update and reparse feature
* AutoPilot adds support for retrieving all attributes
* BookMark is also enhanced.

2 Expansion of Extended VTD-XML API
* Add content extraction ability to extended VTD-XML
* VTDNavHuge now can call getElementFragment() and getElementFragmentNs()
* VTDGenHuge adds support for capturing white spaces

3 XPath
* Adds comment and processing instruction support for nodes, and performance 
enhancement
* Adds namespace axis support .
* Adds round-half-to-even()

4 A number of bug fixes and code enhancement