> Hi,
>
> I want to do some validation on the client in my soap server, before the
> zend_soap_server is actually loaded.
> I wrote it like this:
>
> $validatorObj = new Myclass_Validator();
> if ($validatorObj->isValid($this->getRequest())===false){
> if (isset($_GET['wsdl'])){
> //return an empty wdl
> $this->handleWSDL('Service_Empty');
> } else {
> $server = new Zend_Soap_Server();
> $server->fault('not valid');
> }
> } else {
> //valide
> if(isset($_GET['wsdl'])) {
> //return the WSDL
> $this->handleWSDL('Service_Functions');
> } else {
> //handle SOAP request
> $this->handleSOAP('Service_Functions');
> }
> }
>
>
> The problem is that I don't get the soap fault 'not valid'. How should I do
> this?
>
> Thanks,
> Mark
>
>
I would do the validation in the soap served class (the class you
supply to the SOAP server by using the setClass() method).
I have this sort of process to allow users to supply data (or ask for
a WSDL file or the HTML documentation).
When they supply data, the method called does the validation and
throws normal exceptions. My exceptions generate an email and are
restricted to only send 1 email for a particular exception per day.
The email contains a full stack trace and indicators of how many times
the exception has been thrown since I last examined the code.
By registering the exceptions with the soap server class (
registerFaultException($Exceptions) ), I can get SOAP faults back to
the client.
I'm new to Zend and I'm currently only using Zend_Soap (Client,
Server, WSDL, AutoDiscover), but it seems to be working really well
for me.
Does that make sense?
Regards,
Richard.
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
没有评论:
发表评论