Reputation: 522
I am brand new to SOAP with PHP (and SOAP in general). I am having trouble with the SoapClient class. It takes four parameters (request, location, action, version), but I really don't know what those should be as they pertain to the web service I'm trying to use.
See
http://wiki.agemni.com/Getting_Started/APIs/Agemni_CMS_Sync and http://www.agemni.com/_anet/ADBAccess.asmx?op=getCMSTables
Here is my best guess:
$wsdl = 'http://www.agemni.com/_anet/ADBAccess.asmx?WSDL';
$action = 'http://webservice.agemni.com/getCMSTables';
$request = 'POST /_anet/ADBAccess.asmx HTTP/1.1
Host: www.agemni.com
Content-Type: text/xml; charset=utf-8
Content-Length: 10000
SOAPAction: "http://webservice.agemni.com/getCMSTables"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<getCMSTables xmlns="http://webservice.agemni.com/getCMSTables" />
</soap:Body>
</soap:Envelope>"
';
$location = 'http://www.agemni.com/_anet/ADBAccess.asmx';
$version ='1';
$client = new SoapClient($wsdl);
$response = $client->__doRequest($request, $location, $action, $version);
I'm not asking for anyone to do this for me, but if you could help clarify what $action, $request, and $location should be (pretty sure $version is just an int 1 or 2) I would be very grateful.
Upvotes: 1
Views: 2603
Reputation: 1514
Well, if you don't want to deal with the details of the request and you have the WSDL file, you don't need to set those parameters. Just instantiate with the path of the WSDL file and it suppose to contain everything else. The you just call
$response = $client->getCMSTables();
See: http://php.net/manual/en/soapclient.soapclient.php
Upvotes: 1