Code Monkey home page Code Monkey logo

adobecampaignclientbundle's Introduction

AdobeCampaignClientBundle

Build Status Scrutinizer Code Quality Code Coverage

Provide access to adobe campaign SOAP API

Installation

Add AdobeCampaignClientBundle to your composer.json, then update

{
    ...
    "require": {
        "lafourchette/adobe-campaign-client-bundle": "~1.0"
    },
    ...
}

Add AdobeCampaignClientBundle to your application kernel

    // app/AppKernel.php
    public function registerBundles()
    {
        return array(
            // ...
            new LaFourchette\AdobeCampaignBundle\LaFourchetteAdobeCampaignBundle(),
            // ...
        );
    }

Update your configuration

# app/config/config.yml
adobe_campaign_client:
    base_uri: http://adobe_campaign.uri.com
    login: login
    password: password
    schemas: #A client instance will be created for each schema you need
        query_def:
            name: query_def
            schema: xtk:queryDef

Usage

// Retrieve client service
$client = $container->get('adobe_campaign_client.client.query_def');

// Prepare SOAP envelope
$envelope = <<<EOT
<x:Envelope xmlns:x="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:xtk:queryDef">
  <x:Header/>
  <x:Body>
    <urn:ExecuteQuery>
      <urn:sessiontoken>%s</urn:sessiontoken>
      <entity xsi:type='ns:Element' SOAP-ENV:encodingStyle='http://xml.apache.org/xml-soap/literalxml'>
        <queryDef operation="select" schema="nms:broadLogRcp" xtkschema="xtk:queryDef" lineCount="100">
          <select>
            <node expr="@id"/>
            <node expr="[recipient/@id]"/>
            <node expr="[delivery/@label]"/>
          </select>
          <where>
            <condition expr="[@recipient-id] = %s"/>
          </where>
          <orderBy>
            <node expr="@eventDate" sortDesc="true"/>
          </orderBy>
        </queryDef>
      </entity>
    </urn:ExecuteQuery>
  </x:Body>
</x:Envelope>
EOT;

// Execute SOAP request
$xmlResponse = $client->doCustomSoapRequest(
    sprintf($envelope, $client->getConfiguration()->getSession(), $idCustomer),
    'ExecuteQuery'
);

// Parse results
$campaignList = array();
foreach ($xmlResponse->xpath('/Envelope/Body/ExecuteQueryResponse/pdomOutput/broadLogRcp-collection/broadLogRcp') as $broadLogRcp) {

    $delivery = $broadLogRcp->xpath('delivery');
    $delivery = current($delivery);

    $campaignList[] = array(
        'id' => (int) $broadLogRcp['id'],
        'label' => (string) $delivery['label']
        )
    );
}

return $campaignList;

License

This bundle is under the MIT license.

adobecampaignclientbundle's People

Contributors

olaurendeau avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.