Skip to content

Latest commit

 

History

History
46 lines (35 loc) · 1.72 KB

soap_api_usage.md

File metadata and controls

46 lines (35 loc) · 1.72 KB

Allegro SOAP Api usage

Situation here is very similar to the Rest Api. Just use ready request objects to get responses.

Wsdl mapping was made with wsdl2phpgenerator/wsdl2phpgenerator

TOC

  1. Request classes
  2. Create AllegroClient object
  3. Send request / get response
  4. sessionId, sessionHandle, webapiKey in requests
  5. Exceptions

Request classes

All classes generated from wsdl are here but you can find it hard to search there. Just use good IDE to get autocompletion. If you know the name of the method you want to use, it's quite simple.

For example - start typing in PHPStorm new DoGet... and you will get beautiful hints.

Create AllegroClient object

Same as HERE

Send request / get response

Short and simple example to get user login:

use Imper86\AllegroRestApiSdk\Model\SoapWsdl\DoGetUserLoginRequest;

$req = new DoGetUserLoginRequest(1, 12345);
$response = $allegroClient->soapRequest($req, $sessionId);

sessionId, sessionHandle, webapiKey in requests

Here you can be a little bit lazy - if your request requires webapiKey, you can leave it with null, AllegroClient will check if setWebapiKey method is in request object, and will set the value for you.

Also, if you put sessionId in the second argument of $allegroClient->soapRequest($req, $sessionId), lib will check for setSessionId and setSessionHandle methods and will handle it for you.

Exceptions

Sending request may lead to a standard \SoapFault. Nothing special here.