php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50544 SOAPServer incorrectly decodes request
Submitted: 2009-12-21 17:37 UTC Modified: 2009-12-22 00:16 UTC
From: mmalone at nutshell dot com Assigned:
Status: Open Package: SOAP related
PHP Version: 5.3.1 OS: Mac OS 10.6.2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mmalone at nutshell dot com
New email:
PHP Version: OS:

 

 [2009-12-21 17:37 UTC] mmalone at nutshell dot com
Description:
------------
When working in non-WSDL mode, SoapServer passes a decoded request that is missing elements present in the raw string request. I ran into this while writing a PHP client for handling MS Exchange subscription notifications: the PHP function that I was using to handle requests was receiving a stdClass object that did not have the "Id" or "ChangeKey" elements, even though they were present in request.

Reproduce code:
---------------
$request = '<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><m:SendNotification xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"><m:ResponseMessages><m:SendNotificationResponseMessage ResponseClass="Success"><m:ResponseCode>NoError</m:ResponseCode><m:Notification><t:SubscriptionId>FgBleDA3c3AxLmxpdHdhcmVpbmMuY29tEAAAABJAlgb9bHJPjOSIOHbadcA=</t:SubscriptionId><t:PreviousWatermark>AQAAAKBgA1CARqtBm1sPvLCyqCvNaQAAAAAAAAE=</t:PreviousWatermark><t:MoreEvents>false</t:MoreEvents><t:ModifiedEvent><t:Watermark>AQAAAKBgA1CARqtBm1sPvLCyqCvUaQAAAAAAAAE=</t:Watermark><t:TimeStamp>2009-12-21T07:10:06Z</t:TimeStamp><t:ItemId Id="AAAWAG1tYWxvbmVAbGl0d2FyZWluYy5jb20ARgAAAAAAAoypmxk6K0mPSfdXOELPmwcAKnuHVTIh8kKtS0vk2Ng8DALEfnSYPwAAKnuHVTIh8kKtS0vk2Ng8DALQCov5BwAA" ChangeKey="DwAAAA==" /><t:ParentFolderId Id="AAAWAG1tYWxvbmVAbGl0d2FyZWluYy5jb20ALgAAAAAAAoypmxk6K0mPSfdXOELPmwEAKnuHVTIh8kKtS0vk2Ng8DALEfnSYPwAA" ChangeKey="AQAAAA==" /></t:ModifiedEvent></m:Notification></m:SendNotificationResponseMessage></m:ResponseMessages></m:SendNotification></soap:Body></soap:Envelope>';

function SendNotification($response) {
    print_r($response); die;
}

$server = new SoapServer(NULL, array('soap_version' => SOAP_1_2, 'uri' => 'http://192.68.1.27/api/v1/exchange'));
$server->addFunction('SendNotification');
$server->handle($request);
~                                                                

Expected result:
----------------
stdClass Object
(   
    [SendNotificationResponseMessage] => stdClass Object
        (   
            [ResponseCode] => NoError
            [Notification] => stdClass Object
                (   
                    [SubscriptionId] => FgBleDA3c3AxLmxpdHdhcmVpbmMuY29tEAAAABJAlgb9bHJPjOSIOHbadcA=
                    [PreviousWatermark] => AQAAAKBgA1CARqtBm1sPvLCyqCvNaQAAAAAAAAE=
                    [MoreEvents] => false
                    [ModifiedEvent] => stdClass Object
                        (   
                            [Watermark] => AQAAAKBgA1CARqtBm1sPvLCyqCvUaQAAAAAAAAE=
                            [TimeStamp] => 2009-12-21T07:10:06Z
                            [ItemId] => stdClass Object
                                (   
                                    [Id] => AAAWAG1tYWxvbmVAbGl0d2FyZWluYy5jb20ARgAAAAAAAoypmxk6K0mPSfdXOELPmwcAKnuHVTIh8kKtS0vk2Ng8DALEfnSYPwAAKnuHVTIh8kKtS0vk2Ng8DALQCov5BwAA
                                    [ChangeKey] => DwAAAA==
                                )

                            [ParentFolderId] => stdClass Object
                                (   
                                    [Id] => AAAWAG1tYWxvbmVAbGl0d2FyZWluYy5jb20ALgAAAAAAAoypmxk6K0mPSfdXOELPmwEAKnuHVTIh8kKtS0vk2Ng8DALEfnSYPwAA
                                    [ChangeKey] => AQAAAA==
                                )

                        )

                )

        )

)                           

Actual result:
--------------
stdClass Object
(
    [SendNotificationResponseMessage] => stdClass Object
        (
            [ResponseCode] => NoError
            [Notification] => stdClass Object
                (
                    [SubscriptionId] => FgBleDA3c3AxLmxpdHdhcmVpbmMuY29tEAAAABJAlgb9bHJPjOSIOHbadcA=
                    [PreviousWatermark] => AQAAAKBgA1CARqtBm1sPvLCyqCvNaQAAAAAAAAE=
                    [MoreEvents] => false
                    [ModifiedEvent] => stdClass Object
                        (
                            [Watermark] => AQAAAKBgA1CARqtBm1sPvLCyqCvUaQAAAAAAAAE=
                            [TimeStamp] => 2009-12-21T07:10:06Z
                            [ItemId] => 
                            [ParentFolderId] => 
                        )

                )

        )

)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-22 00:16 UTC] mmalone at nutshell dot com
The line wrapping in the reproduce code causes problems. Here's a version on pastebin: http://pastebin.com/f34c966a0
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC