php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44265 incorrect SOAP Encoding ERROR on response
Submitted: 2008-02-27 13:54 UTC Modified: 2008-10-29 01:00 UTC
Votes:14
Avg. Score:3.9 ± 1.4
Reproduced:10 of 10 (100.0%)
Same Version:3 (30.0%)
Same OS:4 (40.0%)
From: gdk-spam at yes-co dot nl Assigned:
Status: No Feedback Package: SOAP related
PHP Version: 5.2.5 OS: Debian r4.0
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-02-27 13:54 UTC] gdk-spam at yes-co dot nl
Description:
------------
The PHP SOAP server incorrectly reports an SOAP-ERROR when the SOAP response is returned in WSDL mode. The error indicates an optional property is missing. The property is defined within a XML Schema sequence which has its 'minOccurs' attribute set to '0', which should make the properties optional.

The WSDL validates correctly against WS-I Basic Profile 1.1 + SOAP Binding Profile 1.0 checks using Mindreef SOAPscope.

We recently upgraded from PHP 5.1.4 to PHP 5.2.4 (ZendCore package). We are unable to reproduce this error in 5.1.4.

We've stripped down the Webservice and request/response, the production code is ofcourse much more complicated.

If you uncomment the 'Letter' and 'Volgnummer' properties the SOAP response is returned without a problem

Reproduce code:
---------------
WSDL: http://devel.yes-co.com/zendbugs/ws_kadaster.wsdl

SOAP Server: http://devel.yes-co.com/zendbugs/ws_kadaster.phps

SOAP Client: http://devel.yes-co.com/zendbugs/ws_kadaster_client.phps

Expected result:
----------------
ws_kadaster_client.php output:

stdClass Object ( )

Actual result:
--------------
ws_kadaster_client.php output:

SoapFault Object
(
    [message:protected] => SOAP-ERROR: Encoding: object hasn't 'Letter' property
    [string:private] => 
    [code:protected] => 0
    [file:protected] => /vol/vol0/home/geoffrey/public_html/ws_kadaster_client.php
    [line:protected] => 11
    [trace:private] => Array
        (
            [0] => Array
                (
                    [function] => __call
                    [class] => SoapClient
                    [type] => ->
                    [args] => Array
                        (
                            [0] => GetKadastraalBericht
                            [1] => Array
                                (
                                    [0] => stdClass Object
                                        (
                                        )

                                )

                        )

                )

            [1] => Array
                (
                    [file] => /vol/vol0/home/geoffrey/public_html/ws_kadaster_client.php
                    [line] => 11
                    [function] => GetKadastraalBericht
                    [class] => SoapClient
                    [type] => ->
                    [args] => Array
                        (
                            [0] => stdClass Object
                                (
                                )

                        )

                )

        )

    [faultstring] => SOAP-ERROR: Encoding: object hasn't 'Letter' property
    [faultcode] => SOAP-ENV:Server
)
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://webservice.yes-co.nl/ws_kadaster"><SOAP-ENV:Body><ns1:GetKadastraalBerichtRequest/></SOAP-ENV:Body></SOAP-ENV:Envelope>
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>SOAP-ERROR: Encoding: object hasn't 'Letter' property</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-08 08:02 UTC] benprim at gmail dot com
I had the same issue when i change my WSDL from RPC/Encoded to document literal.

But i think the problem comes from the former way i Use to return my results.

My Response message looks something like this
<xsd:element name="UpdateUserResponseParams">
   <xsd:complexType>
      <xsd:sequence>
	<xsd:element name="ReturnValue" type="boolean"></xsd:element>
      </xsd:sequence>
   </xsd:complexType>
</xsd:element>


So i had to change my server code from
function updateUser($user){
	// Internal Code
	return $value;
}

to 

function updateUser($user){
	// Internal Code
	return array("ReturnValue" => $value);
}


So I think your server client should be changed to 

public function GetKadastraalBericht($request) {
      $response = new StdClass();
      return array("Letter" => $response->Letter,"Volgnummer" =>$response->Volgnummer);
}
 [2008-10-21 11:31 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2008-10-29 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue May 18 18:01:23 2021 UTC