Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOAP-ERROR: Encoding: object has no 'propety_name' property in object #18

Closed
ashgaliyev opened this issue May 22, 2017 · 4 comments
Closed

Comments

@ashgaliyev
Copy link

ashgaliyev commented May 22, 2017

Hello!
I have a complex object with an array of other complex objects (several hundred). It is generated automatically once per day and saved serialised into a file. And I have web-service based on yii2-soap-server, which serves this object from the file to clients. Sometimes it returns following error:

SOAP-ERROR: Encoding: object has no 'property_name' property in
/var/www/site/vendor/subdee/yii2-soap-server/SoapService.php:172

Maybe one or few objects miss this 'property_name' while generating stage, but I haven't found the bug yet.

My question: is there a way to find (var_dump maybe) the object which causes the error ?

yii2-soap-server : ea980cf
php version: 7.0.15

@subdee
Copy link
Owner

subdee commented May 22, 2017

That, or use logging at the debug level to record the object about to be encoded.

However, it looks like the object you are passing doesn't have all the required properties.

@subdee subdee closed this as completed May 22, 2017
@ashgaliyev
Copy link
Author

@subdee Thank you! But where in SoapService I can place var_dump to find the object ?

@subdee
Copy link
Owner

subdee commented May 22, 2017

Try adding var_dump($provider); right before line 172 ($server->handle();)

@ashgaliyev
Copy link
Author

ashgaliyev commented Jun 19, 2017

The problem is with Array of objects

For example:

public class sampleController
{
    /**
     * @return Foo[]
     * @soap
     */
    public function foo() {
        $foo = new Foo();
        $foo->message = 'test';
        return [ $foo; ]
    }
}

public class Foo
{
      public $message;
}

Method call raises the error: SOAP-ERROR: Encoding: object has no 'message' property.
Because SoapServer tries to set 'message' property on array.

Which in turn is caused by wrong wsdl format.

I replaced WsdlGenerator with code from another repository
https://github.com/borodulin/yii2-services/blob/master/WsdlGenerator.php and it all worked.

I don't know what exactly wrong with WsdlGenerator.

Maybe this workaround helps with someone who stuck with the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants