Bug #53234 [Com]: "SOAP-ERROR: Encoding: object hasn't 'xxx' property" for xsd-choice element

From: Date: Sat, 03 Nov 2018 15:02:55 +0000
Subject: Bug #53234 [Com]: "SOAP-ERROR: Encoding: object hasn't 'xxx' property" for xsd-choice element
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-217804@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=53234&edit=1

 ID:                 53234
 Comment by:         xt8848 at 126 dot xom
 Reported by:        vadim dot sacharow at pali dot de
 Summary:            "SOAP-ERROR: Encoding: object hasn't 'xxx' property"
                     for xsd-choice element
 Status:             No Feedback
 Type:               Bug
 Package:            SOAP related
 Operating System:   Windows XP
 PHP Version:        5.2.14
 Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

So sad, I met this problem. Anyone can help me?

php version information is:
PHP 7.1.14 (cli) (built: Feb  7 2018 18:33:30) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies

details in wsdl:
<xs:complexType name="organizationResponse">
<xs:sequence>
<xs:element minOccurs="0" name="code" type="xs:string"/>
<xs:element minOccurs="0" name="errorInfo" type="xs:string"/>
<xs:element minOccurs="0" name="msg" type="xs:string"/>
<xs:element maxOccurs="unbounded" minOccurs="0" name="result"
nillable="true" type="tns:organizationReturnDetails"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="organizationReturnDetails">
<xs:sequence>
<xs:element minOccurs="0" name="financeOrgName"
type="xs:string"/>
<xs:element minOccurs="0" name="orgAssociate" type="xs:string"/>
<xs:element minOccurs="0" name="orgCode" type="xs:string"/>
<xs:element name="orgId" type="xs:int"/>
<xs:element minOccurs="0" name="orgName" type="xs:string"/>
<xs:element minOccurs="0" name="orgNamePy" type="xs:string"/>
<xs:element name="orgType" type="xs:int"/>
<xs:element minOccurs="0" name="parentFinanceOrgName"
type="xs:string"/>
<xs:element name="parentOrgAssociate" type="xs:int"/>
<xs:element minOccurs="0" name="parentOrgCode"
type="xs:string"/>
<xs:element name="parentOrgId" type="xs:int"/>
<xs:element minOccurs="0" name="parentOrgName"
type="xs:string"/>
<xs:element minOccurs="0" name="parentOrgNamePy"
type="xs:string"/>
<xs:element name="parentOrgType" type="xs:int"/>
</xs:sequence>
</xs:complexType>

The error:
Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object has no
'orgAssociate' property in
/Users/taoli/php-workspace/vendor/zendframework/zend-soap/src/Client.php:1166 Stack trace: #0
/Users/taoli/php-workspace/vendor/zendframework/zend-soap/src/Client.php(1166):
SoapClient->__soapCall('getOrganization', Array, Array, Array, Array) #1
/Users/taoli/php-workspace/soap.php(30): Zend\Soap\Client->__call('getOrganization',
Array) #2 {main} thrown in /Users/taoli/php-workspace/vendor/zendframework/zend-soap/src/Client.php
on line 1166


Previous Comments:
------------------------------------------------------------------------
[2015-06-07 04:22:19] php-bugs at lists dot php dot net

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.

------------------------------------------------------------------------
[2015-05-27 21:07:38] cmb@php.net

Bug #50997 has been fixed since a long time. Can this ticket also
be closed, Vadim?

------------------------------------------------------------------------
[2010-11-03 14:06:05] vadim dot sacharow at pali dot de

Some new information: the problem occurs, if the first element of the choice-group is a xs:sequence.
If the first element is a xs:element (xs:sequence as second element), then everything works fine.

------------------------------------------------------------------------
[2010-11-03 10:54:11] vadim dot sacharow at pali dot de

The bug 50997 seems to describe the same problem

------------------------------------------------------------------------
[2010-11-03 10:51:44] vadim dot sacharow at pali dot de

Description:
------------
I have the following xsd-part:
<xs:choice>
    <xs:sequence>
	<xs:element name="Company">
	    <xs:complexType>
		<xs:complexContent>
			<xs:extension base="Company"/>
		</xs:complexContent>
	    </xs:complexType>
	</xs:element>
	<xs:element name="ContactPerson" type="Person" minOccurs="0">
	</xs:element>
    </xs:sequence>
    <xs:element name="Person" type="Person">
    </xs:element>
</xs:choice>

Its a choice-element. I expect, that my request must have just one of following two elements:
a. sequence of Company and ContactPerson
b. Person

But when i try to send a request, that has a Person, i get the SOAP-ERROR: Encoding: object
hasn't 'Company' property

If i change the places of a and b in wsdl definition file - everything works perfect with Person.

I think, that SoapClient working in wsdl-mode doesn't understand the choice-element in the
right way. SoapClient just takes the first one and says, that this element is required - but its
false, because just one of the both (a or b) is required, and not the first element in the
choice-group.



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=53234&edit=1


Thread (8 messages)

« previous php.bugs (#217804) next »