From: <ext...@ti...> - 2004-10-26 15:54:55
|
=20 Hi there, =20 One thing you need to understand is what happens when you send something = on the client end and it is interpreted on the server end. If you are using, say, a Java = client to communicate with a Python server, the client may allow you to send collections of stuff, = like arrays, Lists, or basic Collection-instances of somekind. The message is serialized as = an XML-RPC message where all collections are represented by <array> elements, regardless of = what the original collection type was. When received on the server end, the server = implementation converts the <array> into whatever collection representation that particular = implementation uses. =20 For the Marquee library, clients may send several types of collections, = including arrays. The server side implementation of the Marquee library converts all inbound = <array>s into a java.util.List instance (ArrayList to be precis). That, in turn, means = that all invocation handlers on the server side must be prepared to accept a List instance. =20 In other words: =20 class MyHandler { public String[] testMethod( List strings ) { String[] result =3D new String[ strings.size() ]; =20 for ( int j =3D 0, i =3D strings.size() - 1; i >=3D 0; --i ) { result[ j ] =3D ( String ) strings.get( i ); } } } =20 The (uncompiled) example above accepts a List of strings, which means = that any XML-RPC-implementation may send it a collection of strings, regardless of the original type of = that collection. It *must* accept a List when used with the Marquee library, since that library always = converts <array>'s into List. =20 It may, however, return whatever object that is serializable by the = library. In this case, it returns an array of strings, that by the Marquee library will be serialized, again, as an = <array>. On the receiving end, that array is transformed into whatever representation that implementation = has for <array>s. If the sending end is also the Marquee implementation, the client must be ready to accept = it as a List, because that is what the String[] has become during the Java->XML-RPC->Java conversion. =20 To sum up: your invocation handlers must use parameters that are = XML-RPC-compatible. It cannot accept arrays or other custom types. It must be one of the types documented for = the library since the message may come from any sender, not even a Java client. As a client, however, = you may send any object serializable by the library, being aware though that it may not look the = same when it arrives, since you might not even be talking to a Java server. =20 Hope this helps. -----Original Message----- From: xml...@li... = [mailto:xml...@li...]On Behalf Of = ame...@hs... Sent: den 26 oktober 2004 15:52 To: xml...@li... Subject: [Xmlrpc-users] Query , How to send a structures of array .! Hi All,=20 I am new to this community.!=20 I am facing a problem of how to send a request to an XMLRPC Server, = which consists of parameters as array.=20 For example:=20 If there is a API:=20 systemConfiguration(Authentication,SysConf) returns Acknowledegement, = Auth=20 Authentication is a structure, with to fields=20 Username -String=20 Password-String=20 SysConf is a structure=20 LanCard[] String Array <------------------ = hostname String=20 Acknowledgement is a structure=20 error_code int=20 error_description string=20 Ack is another structure=20 Bank_Id int=20 BaknName String=20 Please, can somebody tell me how to pass these structure to a invoke() = call and how to received the response.=20 Waiting for your response, will really help me out.=20 A exostive example=20 Regards,=20 Asif Mekrani=20 *********************** HSS-Private ***********************=20 "Please note:The email domain of Hughes Software Systems Ltd. has been = changed to "hssworld.com" from hss.hns.com" "DISCLAIMER: This message is proprietary to Hughes Software Systems = Limited (HSS) and is intended=20 solely for the use of the individual to whom it is addressed. It may = contain privileged or=20 confidential information and should not be circulated or used for any = purpose other than for=20 what it is intended. If you have received this message in error, please = notify the originator=20 immediately. If you are not the intended recipient, you are notified = that you are strictly=20 prohibited from using, copying, altering, or disclosing the contents of = this message. HSS=20 accepts no responsibility for loss or damage arising from the use of the = information transmitted=20 by this email including damage from virus." |