When I started this, I knew nothing about SOAP or how it worked. I learned a lot in the first few hours and the result was an operational test of the SOAP service (which I'm writing in PHP). I was able to create the SOAP client in both PHP and Visual Studio (which is what I 'm really aiming for) and return the information I wanted.
Since it was just a test and I wanted to return more (and better formatted) information, I started messing around with it. I added some types and wrote some schemas that I imported. When I finished adding everything I needed (this was all for one result) I saved it all and tested it. It ran without error, but didn't return anything.
I'm trying to return an array with 8 elements, with differing types. Here are the elements and types of that array:
Title - string LinkId - int Date - int Author - string Content - string Id - int Icon - int Edited - boolean
The function GetNews will return 25 of those arrays (per page, the input is an integer for which page of results to get).
I cannot figure out how to serialize the ar开发者_JAVA技巧ray so that SOAP will return it properly.
Here's the URL to my WSDL file:
http://api.infectionist.com/soap.wsdl
PLEASE help me out, I am completely stuck. I can't see anything wrong with the code, and it's running without error in PHP and Visual Studio, it's just returning an empty result.
I'm guessing you are trying to return the entire array at once from within PHP? If so, you need to make sure that you return an XML string. Like:
<?php
return '
<data>
<title>Actual title</title>
<linkId>154278</linkId>
...
</data>
';
?>
Have you considered using a JSON string as an alternative to send the data from the SOAP server? This would allow you to have all the elements you need in one element and retain flexibility to add/remove elements later (you would need to inform your clients of this).
精彩评论