xml - SoapFault in PHP Soap Server (Error Handling) -


i'm working on new soap web service. previous web service used return array('error'=>"please login first"); when error encountered. i've read, better use soapfault instead.

the following line used call soapfault:

throw new soapfault($faultcode, $faultstring, $faultactor, $faultdetail, $faultname, $headerfault); 

i saw soap has pre-defined codes, namely: versionmismatch, mustunderstand, client , server.

please me understand answering/correcting following:

  1. can use own custom faultcodes "auth" or "error55".
    1. some use array("namespace", "errorcode"). should rather used? , should value of namespace be?
  2. i assume faultstring can user "please login first".
  3. what purpose of faultactor?
  4. faultdetail array containing detail of fault. kind of detail?
  5. what purpose of faultname?
  6. what purpose of headerfault?

i believe it's discouraged ask multiple questions in single question. also, of answered reading section 4.4, "soap fault", of the soap spec.

  1. faultcode

    the faultcode element intended use software provide algorithmic mechanism identifying fault. faultcode must present in soap fault element , faultcode value must qualified name defined in section 3. soap defines small set of soap fault codes covering basic soap faults...the namespace identifier [default] faultcode values "http://schemas.xmlsoap.org/soap/envelope/"

  2. faultstring

    the faultstring element intended provide human readable explanation of fault , not intended algorithmic processing.

  3. faultactor

    "the faultactor element intended provide information caused fault happen within message path (see section 2). similar soap actor attribute (see section 4.2.2) instead of indicating destination of header entry, indicates source of fault. value of faultactor attribute uri identifying source. applications not act ultimate destination of soap message must include faultactor element in soap fault element. ultimate destination of message may use faultactor element indicate explicitly generated fault (see detail element below)."

  4. faultdetail string, not array, , should contain

    application specific error information related body element


Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -