php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52726 getCode() from SoapFault thrown from call to AWS 3.0 returns HTTP not 410 4
Submitted: 2010-08-28 22:53 UTC Modified: -
From: zippy1981 at gmail dot com Assigned:
Status: Open Package: SOAP related
PHP Version: 5.3.3 OS: All
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: zippy1981 at gmail dot com
New email:
PHP Version: OS:

 

 [2010-08-28 22:53 UTC] zippy1981 at gmail dot com
Description:
------------
Exception::getCode() should return an int as per the documentation. Therefore 
SoapFault::getCode() should return the http code.

If you make a soap call to the deprecated Amazon Web Service 3.0 wsdl, a html 410 
(Gone) error is returned. SoapFault::getCode() and SoapFault::faultcode should 
both be 410, but they are HTTP.

Test script:
---------------
<?php
$client = new SoapClient('http://soap.amazon.com/schemas2/AmazonWebServices.wsdl', array('trace' => true));
$request = array(
        'keyword' => 'Stuff',
        'page' => '1',
        'mode' => 'books',
        'tag' => 'you\'re it',
        'type' => 'medium',
        'devtag' => 'YOUR-TOKEN-HERE'
);
try {
        $client->KeywordSearchRequest($request);
}
catch (SoapFault $ex) {
        if ($ex->faultstring != 'Gone') throw $ex;
        if ($ex->getCode() != '410') {
                echo "UnexpectedCode: " . $ex->getCode();
                throw $ex;
        }
}


Expected result:
----------------
 Nothing

Actual result:
--------------
UnexpectedCode: 0PHP Fatal error:  Uncaught SoapFault exception: [HTTP] Gone in 
/home/zippy/src/testfest/ext/soap/tests/client_error001.phpt:20
Stack trace:
#0 [internal function]: SoapClient->__doRequest('<?xml version="...', 
'http://soap.ama...', 'http://soap.ama...', 1, 0)
#1 [internal function]: SoapClient->__call('KeywordSearchRe...', Array)
#2 /home/zippy/src/testfest/ext/soap/tests/client_error001.phpt(20): SoapClient-
>KeywordSearchRequest(Array)
#3 {main}
  thrown in /home/zippy/src/testfest/ext/soap/tests/client_error001.phpt on line 
20


Patches

Pull Requests

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC