2009年5月7日星期四

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

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.

没有评论: