[RESOLVED] WSDL issue
http://www.champions.co.nz/global/Af...ices.asmx?WSDL
I'm trying to access this webservice, I have this code to try see the catalogue list, it outputs the below.
I've got another .net script which works so I know the codes i'm using are correct, what is wrong?
Code:
stdClass Object ( [Catalogue_ListResult] => stdClass Object ( [any] => ) )
PHP Code:
<?php
$client = new SoapClient ( "http://www.champions.co.nz/global/AffiliateServices.asmx?WSDL" );
$result = $client -> Catalogue_List (array( 'ID' => 99 , 'Guid' => "MyCode" , 'Satellite' => 1 ));
print_r ( $result );
?>
According to the WSDL document, the "Catalogue_List" operation utilizes three input parameters (two of which are required - the first and the last): AffiliateID, AffiliateGuid, and Satellite. You've only provided one of those three.
sorry Guid is AffiliateGuid and ID is AffiliateID, I've already updated my code and tested it. It still does not work.
when I do a var_dump I get this, does it need to output it differently to use this information?
HTML Code:
object(stdClass)[2]
public 'Catalogue_ListResult' =>
object(stdClass)[3]
public 'any' => string '<Affiliate_Catalogue_List xmlns="" SatelliteID="1" SatelliteName="Champions Of The World" > <Catalogues> <Catalogue CatalogueID="10" Name="All Blacks" Order="10" ParentID="0" Url="http://www.champions.co.nz/rd.ashx?iSAMS=A& afID=79& C=10" > <Catalogue CatalogueID="125" Name="New Releases" Order="1" ParentID="10" Url="http://www.champions.co.nz/rd.ashx?iSAMS=A& afID=79& C=125" /> <Catalogue CatalogueID="235" Name="2012 All Blacks Range" Order="1" ParentID="10" Url="http://www.champions.co.nz/rd.ashx?iSA'... (length=13747)
Pedantic Curmudgeon
__getFunctions and __getTypes tells you what the methods return and their types. In this case, there is a chunk of XML in there that appears to have some information in it; have you tried parsing it?
Those functions give me this output, i'm at a loss with what to do with this?...
HTML Code:
array
0 => string 'Product_ListResponse Product_List(Product_List $parameters)' (length=59)
1 => string 'Satellite_Currency_ListResponse Satellite_Currency_List(Satellite_Currency_List $parameters)' (length=92)
2 => string 'Catalogue_ListResponse Catalogue_List(Catalogue_List $parameters)' (length=65)
3 => string 'Product_ListResponse Product_List(Product_List $parameters)' (length=59)
4 => string 'Satellite_Currency_ListResponse Satellite_Currency_List(Satellite_Currency_List $parameters)' (length=92)
5 => string 'Catalogue_ListResponse Catalogue_List(Catalogue_List $parameters)' (length=65)
array
0 => string 'struct Product_List {
int AffiliateID;
string AffiliateGuid;
int Catalogue;
int StripHtml;
int Currency;
int Satellite;
}' (length=127)
1 => string 'struct Product_ListResponse {
Product_ListResult Product_ListResult;
}' (length=71)
2 => string 'struct Product_ListResult {
<anyXML> any;
}' (length=44)
3 => string 'struct Satellite_Currency_List {
int AffiliateID;
string AffiliateGuid;
}' (length=75)
4 => string 'struct Satellite_Currency_ListResponse {
Satellite_Currency_ListResult Satellite_Currency_ListResult;
}' (length=104)
5 => string 'struct Satellite_Currency_ListResult {
<anyXML> any;
}' (length=55)
6 => string 'struct Catalogue_List {
int AffiliateID;
string AffiliateGuid;
int Satellite;
}' (length=82)
7 => string 'struct Catalogue_ListResponse {
Catalogue_ListResult Catalogue_ListResult;
}' (length=77)
8 => string 'struct Catalogue_ListResult {
<anyXML> any;
}' (length=46)
Pedantic Curmudgeon
Read them and determine what types of data are returned by the functions (which requires a bit of logical thinking on your part). For example:
Code:
Catalogue_ListResponse Catalogue_List(Catalogue_List $parameters)
tells you that the "Catalogue_List" method returns a "Catalogue_ListResponse". What's a "Catalogue_ListResponse"?
Code:
struct Catalogue_ListResponse {
Catalogue_ListResult Catalogue_ListResult;
}
It's an object with a "Catalogue_ListResult" property that is of type "Catalogue_ListResult". But what's a "Catalogue_ListResult"?
Code:
struct Catalogue_ListResult {
<anyXML> any;
}
It's an object that has an "any" property containing XML.
Originally Posted by
Weedpacket
In this case, there is a chunk of XML in there that appears to have some information in it; have you tried parsing it?
Right okay so how do I access the XML data within $result?
PHP Code:
$result = $client -> Catalogue_List (array( 'AffiliateID' => 99 , 'AffiliateGuid' => " $Code " , 'Satellite' => 1 ));
I thought this might access it but i does not.
PHP Code:
foreach( $result -> Catalogue_ListResult [ 0 ]-> attributes () as $a => $b ) {
echo $a , '="' , $b , "\"\n" ;
}
I know know that somewhere within $result is a XML file, I just don't get how i'm to access it to parse it
PHP Code:
print_r ( $result -> Catalogue_ListResult );
this prints
HTML Code:
stdClass Object ( [any] => )
Pedantic Curmudgeon
Originally Posted by
NZ_Kiwis
PHP Code:
print_r ( $result -> Catalogue_ListResult );
See your second post in this thread.
Originally Posted by
NZ_Kiwis
Code:
stdClass Object ( [any] => )
So it's a one of the properties in this object. Which is it, I wonder?
Originally Posted by
Weedpacket
It's an object that has an "any" property containing XML.
See your second post for information about what type of value is stored in the property (hint: you will need an XML parser to parse the XML).
okay I have this code, am I getting closer?
PHP Code:
$xml = new SimpleXMLElement ( $result -> Catalogue_ListResult -> any );
print_r ( $xml );
echo "<hr>" ;
foreach( $xml -> Catalogues -> Catalogue as $cat ){
echo $cat [ "Name" ] . "<br>" ;
}
It echo's the first 9 rows, there is more though? what is wrong?
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks