Closed IljaN closed 10 years ago
I followed the documentation found here and injected Service definition in to my file but the result does not get unserialized.
I am getting the following error:
array<Acme\Bundle\TestBundle\Entity\Building> must exist and implement a static fromCommand() method
It looks as if the JMSSerializer is not loaded correctly. On a side note: I installed JMSSerializer after guzzle-bundle.
services.yml
test.api.service_description: class: "%guzzle.service_description.class%" factory_class: "%guzzle.service_description.class%" factory_method: factory arguments: - "%test.api.service_description_file%" test.api.client: class: "%guzzle.client.class%" calls: - [setDescription, [@test.api.service_description]] tags: - {name: "guzzle.client"} test.sync_service: class: Acme\Bundle\TestBundle\Service\SyncService arguments: [@doctrine.orm.default_entity_manager, @test.api.client,%api_key%]
service description:
{ "name": "Management Api", "baseUrl": "http://acme.de/management/api", "operations": { "GetBuildings":{ "httpMethod":"GET", "uri":"building", "summary":"Gets buildings", "responseClass":"array<Acme\\Bundle\\TestBundle\\Entity\\Building>", "data": { "jms_serializer.groups": "result", "jms_serializer.version": 1, "jms_serializer.max_depth_checks": true }, "parameters":{ "token":{ "sentAs": "token", "location":"query", "type":"string", "description":"API Key", "required": true } } } }
Call to service:
$command = $this->client->getCommand('GetBuildings',array( 'token' => $this->apiKey )); $this->client->execute($command);
Cheerz Ilja
Okay forget it. The content type from the api response was not set to json thus falling back to other response parsers.
I followed the documentation found here and injected Service definition in to my file but the result does not get unserialized.
I am getting the following error:
It looks as if the JMSSerializer is not loaded correctly. On a side note: I installed JMSSerializer after guzzle-bundle.
services.yml
service description:
Call to service:
Cheerz Ilja