From: Gamshad, M. <Moh...@sc...> - 2006-03-23 17:45:26
|
Btw, I should have explained that when ever you need to have your message to be in a certain exact structure, including attributes and element namespace declarations, you should create new objects based on soapval class. You start declaring objects from the inner most elements to the outter ones. Once you've got the innter ones defined, then place them in an array to provide that as data for the outter element declaration. Thus, the sequence of the code I provided. Once you know you've to use arrays and soapval objects, then you can use the serialize() method on the soapval object to see what the structure looks like, without having to make the actuall call. Then when you've got it all sorted out, make the call. One thing that I ran into recently that worth mentioning: I had a case where I needed something like this: <First> <Input>some-input</Input> <Msg> some-value <Msg> <Msg>another-value</Msg> </First> i.e., you have a case where you need multilple instances of the same element. You can code for that by delcaring each of those to be a new soapval object and then putting them into an array. As in: $msg1 =3D new soapval('Msg', 'MsgClass', 'some-value'); See my other post on how to handle complex data from the client side. Mohsen =20 =20 -----Original Message----- From: nus...@li... [mailto:nus...@li...] On Behalf Of Gamshad, Mohsen Sent: Thursday, March 23, 2006 9:30 AM To: Peter Lauri; nus...@li... Subject: RE: [Nusoap-general] Attribute and NuSOAP Here's how to code it from the client side: $role =3D new soapval('platformCore:role', 'Role', '', false, false, array('internalId' =3D> '3')); The empty third parameter indicates no value, just the element. $account =3D new soapval('platformCore:account', 'Account', '111111'); $pwd =3D new soapval('platformCore:password', 'Password', 'Cracker1') $email =3D new soapval('platformCore:email', 'Email', = 'eb...@ya...'); $passportVal =3D array ($email, $pwd, $account, $role); $passport =3D = new soapval('platformMsgs:passport', 'Passport', $passportVal, false, false); $msg =3D new soapval('platformMsgs:login', 'Login', $passport, false, false); $xmlout =3D $msg->serialize(); $response =3D $client->($yourPortName, $outxml, ...); Also, if you want to just see the serialized data, comment out your call to the client and instead do this: echo "Serialized ouput =3D "."<xmp>".$xmlout."</xmp>"; HTH, Mohsen =20 -----Original Message----- From: nus...@li... [mailto:nus...@li...] On Behalf Of Peter Lauri Sent: Wednesday, March 22, 2006 11:23 PM To: nus...@li... Subject: [Nusoap-general] Attribute and NuSOAP Hi, I have been trying to find a simple example of how to add attributes to the requests, but after two days search I can not find an example. The $param is easy to create if it does not contain any attributes. This is what I want to create, but the internalId is giving me troubles: ------------------- <soap:Body> <platformMsgs:login> <platformMsgs:passport> <platformCore:email>eb...@ya...</platformCore:email> <platformCore:password>Cracker1</platformCore:password> <platformCore:account>111111</platformCore:account> <platformCore:role internalId=3D"3"/> </platformMsgs:passport> </platformMsgs:login> </soap:Body> ------------------- So I started: $param =3D array( 'passport'=3D>array( 'email'=3D>'eb...@ya...', 'password'=3D>'Cracker1', 'account'=3D>'1111111', //But here I have no clue what to write ) ); Maybe the reason is that you can not do that with NuSOAP, but I am a newbie so I have no clue. Best regards, Peter Lauri ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&dat=3D= 121642 _______________________________________________ Nusoap-general mailing list Nus...@li... https://lists.sourceforge.net/lists/listinfo/nusoap-general ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=3Dk&kid=110944&bid$1720&dat=121642 _______________________________________________ Nusoap-general mailing list Nus...@li... https://lists.sourceforge.net/lists/listinfo/nusoap-general |