php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #45093 soap exceptions problem
Submitted: 2008-05-26 15:17 UTC Modified: 2016-12-31 00:34 UTC
Votes:4
Avg. Score:4.8 ± 0.4
Reproduced:4 of 4 (100.0%)
Same Version:3 (75.0%)
Same OS:1 (25.0%)
From: romain dot lamarche at april-waf dot com Assigned:
Status: Open Package: SOAP related
PHP Version: 5.2.6 OS: Windows XP
Private report: No CVE-ID: None
 [2008-05-26 15:17 UTC] romain dot lamarche at april-waf dot com
Description:
------------
I'm using php-soap as a client for webservices in WSDL mode. (webservices in java)
When the service which is call throw a specific exception (eg MyException) which exist in PHP and in Java (and classmap ok), the soap call throw a "SoapFault" instead of a "MyException".

It could be very very ... very useful if PHP could map the exception to "MyException" with all its fields, instead of throwing SoapFault with just the message as detail.

In the soap response of the webservice, the Exception is detailled as any other object, with all custom fields of "MyException".


Reproduce code:
---------------
class MyException extends Exception
{
  protected myDetail;

  public function getMyDetail()
  {
    return $this->myDetail;
  }

  public function setMyDetail($myDetail)
  {
    $this->myDetail = $myDetail;
  }
}

(and the same in Java)

Service's pojo on the java side :

class MyService
{
  public String testException() throws MyException
  {
    MyException e = new MyException();
    e->setMyDetail("test detail");

    throw e;
  }
}

and the service call : (assuming the soap client with classmap array('MyException' => MyException) :

(in PHP)
$service = new MyService();

try {
  $service->testException()
} catch (MyException $e) {
  echo $e->getMyDetail();
}




Expected result:
----------------
test detail

Actual result:
--------------
SoapFault exception is thrown.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-31 00:34 UTC] cmb@php.net
-Package: Feature/Change Request +Package: SOAP related
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC