Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: XML-RPC Java Call: msg#00009

cms.opengroupware.xmlrpc.devel

Subject: Re: XML-RPC Java Call


On 18.08.2004, at 00:32, Christoph Guse wrote:

Hello,

i want to write my diploma thesis about Macromedia Flex and OpenGroupware. Further information can be found on http://guse.conquer.de .
In order to provide Ogo Data to Macromedia Flex i want to use Java and XML-RPC. Today i managed to configure the Ogo server properly, so simple XML-RPC calls work fine. But i'm not able to execute a more complex call like person.fetch, because i'm not able to give over the complex argument. The example i found in the xml-rpc-de.pfd is for python.
I found the JOGI project, but i'm probably forced to make my own interface. Can you guys give me a little piece of code where i can learn the correct give over of the complex arguments?

Using Apache's XmlRpcClient (http://ws.apache.org/xmlrpc/) it should work like this:


public static void main(String[] args) throws IOException, XmlRpcException {
XmlRpcClient xmlRpcClient = new XmlRpcClient("http://myogoserver:8050/RPC2";);

xmlRpcClient.setBasicAuthentication("root", "ogo");

Hashtable fetchSpec = new Hashtable();
String qualifier = "name = 'root'";
fetchSpec.put("qualifier", qualifier);
Vector sortOrdering = new Vector();
sortOrdering.add("name");
fetchSpec.put("sortOrdering", sortOrdering);

Vector params = new Vector();
params.add(fetchSpec);
Object result = xmlRpcClient.execute("person.fetch", params);

System.out.println("Result class: " + result.getClass());
System.out.println("Result: " + result);
}

The output should look like this:

Result class: class java.util.Vector
Result: [{isAccount=true, url=, name=root, id=skyrix://myogoserver/Sx_hampton/300750, phones={02_tel={type=02_tel, number=, info=, telephoneId=300810}, 03_tel_funk={type=03_tel_funk, number=, info=, telephoneId=300820}, 10_fax={type=10_fax, number=, info=, telephoneId=300840}, 15_fax_private={type=15_fax_private, number=, info=, telephoneId=300850}, 01_tel={type=01_tel, number=, info=, telephoneId=300800}, 05_tel_private={type=05_tel_private, number=, info=, telephoneId=300830}}, owner={}, phoneTypes=[01_tel, 02_tel, 03_tel_funk, 05_tel_private, 10_fax, 15_fax_private], number=SKY300750, addresses={location={type=location, id=skyrix://myogoserver/Sx_hampton/300790}, private={type=private, id=skyrix://myogoserver/Sx_hampton/300770}, mailing={type=mailing, id=skyrix://myogoserver/Sx_hampton/300780}}, isPrivate=false, extendedKeys=[email1, email2, email3, job_title, other_title1, other_title2], login=root, extendedAttrs={}, objectVersion=2, isComplete=true}]

Apache's XmlRpcClient wants a list of parameters encoded in a java.util.Vector even if you only one parameter. The person.fetch XMLRPC needs a FetchSpecification as a 'struct' which is represented in Apache's XmlRpcClient as a java.util.Hashtable (see: http://ws.apache.org/xmlrpc/types.html). There you have to put a qualifier (String) and optional a sortordering.

If you use "name like 's*'" as qualifier you'll get all persons with a name starting with s sorted by name.

Hope this helps.

-Stefan

Attachment: smime.p7s
Description: S/MIME cryptographic signature

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
hardware.arm.at...    cms.citadel.dev...    video.gstreamer...    java.facelets.u...    misc.basics.qna...    web.wiki.instik...    network.uip.use...    xdg.devel/2003-...    tex.bibtex.bibd...    finance.quotesp...    ietf.zeroconf/2...    redhat.blinux.g...    suse.db2/2003-0...    php.phpesp/2004...    uml.devel/2003-...    gnome.labyrinth...    qnx.openqnx.dev...    boot-loaders.gr...    db.dataperfect....    audio.audacity....    linux.uclinux.m...    editors.j.devel...    os.openbsd.tech...    kde.users.multi...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation