It is a strange case.

I have 900 customer ids.

I use php soapclient connect to a asp.net wsdl. loop through these 900 records, and send id as the parameter in request, get back the response object.

And I use $result->Customers->Item->Customer->Name to get the name value.

Within these 900 records, 600 records get the name values in return.

But other 300 records gave me the notice "calling method on non object property" and failed to return the name.

It is the same script and same wsdl method, I only loop around, and somehow the results are different.

And instead of calling object, I used
$Customer[0]->Name, then these 300 records return right names. But these 600 records cannot return value now.

In simple words, same script, same asp.net wsdl. Some records I have to use object like $result->Customers->Item->Customer->Name to get returns, some I have to use $Customer[0]->Name to get the returns. What is going on?

Does it mean somehow php soapclient failed to create object on the asp.net wsdl return and in these cases, use the array works?

Thanks!

    I am guessing it might be a limit, especially since the numbers you give are so round (300, 600), that hardly sounds like coincidence.

    However, I'd suggest catching the error with an IF statement, and doing var_dumps when an error occurs, to see what you're working with exactly.

    I must say I do recall experiencing more or less the same thing, though not through ASP or whatever, but directly in PHP.

    You could try doing a var_dump on the dataset you get, to verify that. Also, you could maybe try simplifying (or commenting out) all logic that happens within the loop.

      Thanks. Sorry I round up the numbers in my question get you confused.

      I found the reasons. For the 600 records, there was only one $result->Customers->Item->Customer object returned. So I cannot use array on $result->Customers->Item->Customer.

      But for these 300 records, there were multiple $result->Customers->Item->Customer objects returned, so I have to use array on them.

      To make all 900 works, I have to use is_array first. I thought it would only be one $result->Customers->Item->Customer and didn't use is_array.

      Maybe it would be a better practice that if I don't know multiple or singular elements would be returned. Just covert the result to array by using (array), so I don't have to worry about it?

      Thanks!

        Write a Reply...