2009年5月13日星期三

Re: [fw-webservices] [Question] How to create a Java client for a Zend_Soap server using autodiscover functionality

Hi Fabien,
my function example was more about to use complex parameters.
If my Zend Soap Client can send array and object, why my java client can
not?
To speak more about use case, I've got some functions called get_users,
create_users, ... so you can see that I need to pass array containing
objects. I think they are quite classic common web service functions. I
guess there is a good way/pratice to use Zend_soap_server+autodiscover and
be able to write a Java client?


Bugzilla from fabien@crespel.net wrote:
>
> Hello,
>
> mouneyrac wrote :
>> I have to pass some params inside the function that are a new java
>> generated
>> class call Array(), that should contains some sort of SOAPElement. I have
>> no
>> idea how to create these params. In the PHP server side you can see that
>> is
>> a associative array.
>> Were the classes well generated? How to use them ?
>
> As far as I know the soap-enc:Array type is not an associative array, but
> a
> classical "flat" one.. meanwhile, the type of the contained elements isn't
> described here, so the caller has no clue what kind of content the service
> expects. I wouldn't really recommend using "@param array" at all.
>
> Instead I would suggest using 2 string parameters like this:
>
> /**
> * Some description...
> * @param string $username
> * @param string $password
> * @return integer
> function get_token($username, $password) {
> if ($username == 'wsuser' && $password == 'wspassword') {
> return '456';
> } else {
> throw new moodle_exception('wrongusernamepassword');
> }
> }
>
> If you still want only 1 parameter, you could use a class, but it seems
> easier to
> use the solution above.
>
> - Fabien.
>
>
>

--
View this message in context: http://www.nabble.com/-Question--How-to-create-a-Java-client-for-a-Zend_Soap-server-using-autodiscover-functionality-tp23419682p23516784.html
Sent from the Zend Web Services mailing list archive at Nabble.com.

没有评论: