SlideShare uma empresa Scribd logo
1 de 33
Baixar para ler offline
SAPO Mail - Webservices
                     14 de Novembro 2007




      •Nuno Loureiro <nuno@co.sapo.pt>
      •Carlos Pires <acmpires@co.sapo.pt>
      •André Luís <aluis@co.sapo.pt>
SAPO Mail - Webservices

     Arquitectura

     Aspectos Gerais

     Credenciais

     Mail

     Contactos

     Exemplos Práticos
Arquitectura do Webmail
SAPO Mail - Webservices

     Arquitectura

     Aspectos Gerais

     Credenciais

     Mail

     Contactos

     Exemplos Práticos
Mail Webservices - Aspectos Gerais

     Operações disponíveis:
        Mail:
           GetStatus;
           GetLastMails;
           GetMailbox;
        Contactos:
           ListAllContacts;
           GetContact;
           AddContact;
           DeleteContact;
           SearchContacts;
           SetContact.
Mail Webservices - Aspectos Gerais

End-Point:
 http://services.sapo.pt/Mail
WSDL:
 http://services.sapo.pt/Metadata/Contract/Mail
Namespace:
 http://services.sapo.pt/definitions
Exemplo Prático:
 http://services.mail.sapo.pt/codebits
Operator (Firefox):
 http://addons.mozilla.org/en-US/firefox/addon/4106
User-script para Operator (Firefox):
 http://services.mail.sapo.pt/operator/js/sapomail.js
SAPO Mail - Webservices

     Arquitectura

     Aspectos Gerais

     Credenciais

     Mail

     Contactos

     Exemplos Práticos
Mail Webservices - Credenciais - Objecto ESBCredentials
1
                              ESBCredentials
                     • ESBUsername
                     • ESBPassword



Usado para a autenticação nos webservices do mail;

Todas as operações dos webservices do mail requerem a definição
    de um SOAP Header com as credenciais do utilizador.


                  class ESBCredentials {
                      public $ESBUsername; //string
                      public $ESBPassword; //string
                  }
SAPO Mail - Webservices

     Arquitectura

     Aspectos Gerais

     Credenciais

     Mail

     Contactos

     Exemplos Práticos
Mail Webservices - Mail - Objectos
1
                                    Mailbox
                     • Status
                     • ArrayOfLastMail




                                               ArrayOfLastMail
                                          • PageInfo
                                          • LastMail




         Status               PageInfo                           LastMail
    • Total              • PageNumber                  • MessageId   • Recent
    • Unseen             • RecordsCount                • FromName    • Answered
    • Recent             • MaxRecords                  • FromEMail   • Deleted
                                                       • Subject     • Flagged
                                                       • Date        • Size (in bytes)
                                                       • Seen
Mail Webservices - Mail - Operações (1)




                               GetStatus
GetStatus




                       class Status {
                           public $Total; //int
                           public $Unseen; //int
                           public $Recent; //int
                       }
Mail Webservices - Mail - Operações (2)

                                     GetLastMails
 GetLastMails               • page (1 by default)
                            • limit (10 by default, max 50)



                                                         Headers das mensagens pedidas;
                                                         Ordenação: ARRIVAL DATE DESC
class ArrayOfLastMail {
    public $PageInfo;
    public $LastMail = array();               class LastMail {
}                                                 public $MessageId;    //int (imap uid)
                                                  public $FromName;     //string
                                                  public $FromEMail;    //string
                                                  public $Subject;      //string
                                                  public $Date;         //string
     class PageInfo {                             public $Seen;         //boolean
         public $PageNumber;   //int              public $Recent;       //boolean
         public $RecordsCount; //int              public $Answered;     //boolean
         public $MaxRecords;   //int              public $Deleted;      //boolean
     }                                            public $Flagged;      //booelan
                                                  public $Size;         //int (in bytes)
                                              }
Mail Webservices - Mail - Operações (3)

                                    GetMailbox
 GetMailbox               • page (1 by default)
                          • limit (10 by default, max 50)




class Mailbox {
    public $Status;
    public $ArrayOfLastMail;
                                         class ArrayOfLastMail {
}                                            public $PageInfo;           //PageInfo
                                             public $LastMail = array(); //LastMail
                                         }
       class Status {
           public $Total; //int
                                                      Headers das mensagens pedidas;
           public $Unseen; //int
           public $Recent; //int
                                                      Ordenação: ARRIVAL DATE DESC
       }
Mail Webservices - Mail
SAPO Mail - Webservices

     Arquitectura

     Aspectos Gerais

     Credenciais

     Mail

     Contactos

     Exemplos Práticos
Mail Webservices - Contactos - Objectos
1
                                         ArrayOfContact
                              • ContactInfo
                              • Contact




                                                                  ContactInfo
                    Contact
    • ContactId          • CellPhone                 • RecordsCount
    • Name               • Fax                       • SearchExpression (opcional)
    • Alias              • Title
    • Email              • Company
    • HomeAddress        • Notes
    • WorkAddress        • PGPPublicKey
    • HomePhone          • SMimePublicKey
    • WorkPhone          • FreeBusyURL
Mail Webservices - Contactos - Operações (1)

                                    ListAllContacts
 ListAllContacts


                                           class Contact {
                                               public $ContactId;        //string
                                               public $Name;             //string
class ArrayOfContact {
                                               public $Alias;            //string
    public $ContactInfo;
                                               public $Email;            //string
    public $Contact = array();                 public $HomeAddress;      //string
}                                              public $WorkAddress;      //string
                                               public $HomePhone;        //string
                                               public $WorkPhone;        //string
                                               public $CellPhone;        //string
                                               public $Fax;              //string
                                               public $Title;            //string
class ContactInfo {
                                               public $Company;          //string
    public $RecordsCount;     //int
                                               public $Notes;            //string
    public $SearchExpression; //string
                                               public $PGPPublicKey;     //string
}
                                               public $SMimePublicKey;   //string
                                               public $FreeBusyURL;      //string
                                           }
Mail Webservices - Contactos - Operações (2)

                                GetContact
GetContact            • ContactID (string)



                        class Contact {
                            public $ContactId;        //string
                            public $Name;             //string
                            public $Alias;            //string
                            public $Email;            //string
                            public $HomeAddress;      //string
                            public $WorkAddress;      //string
                            public $HomePhone;        //string
                            public $WorkPhone;        //string
                            public $CellPhone;        //string
                            public $Fax;              //string
                            public $Title;            //string
                            public $Company;          //string
                            public $Notes;            //string
                            public $PGPPublicKey;     //string
                            public $SMimePublicKey;   //string
                            public $FreeBusyURL;      //string
                        }
Mail Webservices - Contactos - Operações (3)

                               AddContact
AddContact            • Contact (object)


                                   Campo gerado pelo webservice:
                                       ContactId;
                                   Obrigatório:
                                       Name.




              057259c0271b5cf71bb8e9be7ace49e2


                    ContactId (hash md5)
Mail Webservices - Contactos - Operações (4)

                                SetContact
SetContact            • ContactID (string)
                      • Contact (object)



                                    Campo ignorado pelo webservice:
                                        ContactId;




                   true                       false


                  Sucesso                      Erro
Mail Webservices - Contactos - Operações (5)

                                       SearchContact
SearchContact             • SearchExpression (string != ‘’)                  Nome
                                                                             E-mail


                                                      class Contact {
 class ArrayOfContact {
                                                          public $ContactId;        //string
     public $ContactInfo;                                 public $Name;             //string
     public $Contact = array();                           public $Alias;            //string
 }                                                        public $Email;            //string
                                                          public $HomeAddress;      //string
                                                          public $WorkAddress;      //string
                                                          public $HomePhone;        //string
                                                          public $WorkPhone;        //string
                                                          public $CellPhone;        //string
     class ContactInfo {
                                                          public $Fax;              //string
         public $RecordsCount;     //int
                                                          public $Title;            //string
         public $SearchExpression; //string
                                                          public $Company;          //string
     }
                                                          public $Notes;            //string
                                                          public $PGPPublicKey;     //string
                                                          public $SMimePublicKey;   //string
                                                          public $FreeBusyURL;      //string
                                                      }
Mail Webservices - Contactos - Operações (6)




                              DeleteContact
DeleteContact         • ContactID (string)




                    true                      false


                  Sucesso                     Erro
Mail Webservices - Contactos
Mail Webservices - Contactos
SAPO Mail - Webservices

     Arquitectura

     Aspectos Gerais

     Credenciais

     Mail

     Contactos

     Exemplos Práticos
Mail Webservices - Exemplos Práticos - SOAP Request



<?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?>
<SOAP-ENV:Envelope
  xmlns:SOAP-ENV=quot;http://schemas.xmlsoap.org/soap/envelope/quot;
  xmlns:ns1=quot;http://services.sapo.pt/definitionsquot;>
  <SOAP-ENV:Header>
    <ns1:ESBCredentials>
      <ns1:ESBUsername>someuser@sapo.pt</ns1:ESBUsername>
      <ns1:ESBPassword>somepass</ns1:ESBPassword>
    </ns1:ESBCredentials>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <ns1:GetMailbox>
      <ns1:page>1</ns1:page>
      <ns1:limit>10</ns1:limit>
    </ns1:GetMailbox>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Mail Webservices - Exemplos Práticos - SOAP Request




<?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?>
<SOAP-ENV:Envelope
  xmlns:SOAP-ENV=quot;http://schemas.xmlsoap.org/soap/envelope/quot;
  xmlns:ns1=quot;http://services.sapo.pt/definitionsquot;>
  <SOAP-ENV:Header>
    <ns1:ESBCredentials>
      <ns1:ESBUsername>someuser@sapo.pt</ns1:ESBUsername>
      <ns1:ESBPassword>somepass</ns1:ESBPassword>
    </ns1:ESBCredentials>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <ns1:ListAllContacts/>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Mail Webservices - Exemplos Práticos - PHP5 Client Example


<?php

require_once dirname(__FILE__) . '/Mail_client_conf.php'; // Config
require_once dirname(__FILE__) . '/Mail_types.php';       // Class types

$user = 'someuser@sapo.pt';
$pass = 'somepass';

$ESBC = new ESBCredentials_t();
$ESBC->ESBUsername = $user;
$ESBC->ESBPassword = $pass;

$GetMailbox = new GetMailbox_t();
$GetMailbox->page = 1;
$GetMailbox->limit = 10;

$paramMailbox = (isset($GetMailbox))
    ? array('parameters' => $GetMailbox)
    : array();

                                              // [ ---> Continua ]
Mail Webservices - Exemplos Práticos - PHP5 Client Example (2)


$client = new SoapClient(
    /* This should be local, avoid one network call */
    'http://services.sapo.pt/Metadata/Contract/Mail',
    array('location' => quot;http://services.sapo.pt/Mailquot;,
          'classmap' => $classmap)
);

$header = new SoapHeader('http://services.sapo.pt/definitions',
    'ESBCredentials', $ESBC);

try {
    $response = $client->__soapCall('GetMailbox', $paramMailbox, null,
$header);
    /* Your Code Here */

} catch (SoapFault $e) {
    $text = (!$e->getMessage()) ? $e->faultstring : $e->getMessage();
    echo quot;SOAP FAULT: $textnquot;;
}

?>
Mail Webservices - Exemplos Práticos - PHP CodeGenerator


<?php

require_once dirname(__FILE__) . '/Mail_client_conf.php';
require_once dirname(__FILE__) . '/Mail_client.php';

$client = new Mail_client($conf);
$client->makeHeader('someuser@sapo.pt', 'somepass');

/* GetMailbox(page, limit) */
$response = $client->GetMailbox(1, 10);

/* ListAllContacts */
//$response = $client->ListAllContacts();

/* AddContact(Contact) */
//$Contact = new Contact_t();
//$Contact->Name = 'somename';
// ...
//$response = $client->AddContact($Contact);

/* Your Code Here */
?>
Mail Webservices - Exemplos Práticos - Em Acção (1)

Agora é tempo de ver tudo isto em acção:
 Listagem de Mails e Contactos:
    Webservices:
       GetMailbox;
       ListAllContacts;
 Importação de contactos para o webmail:
    Webservices:
       AddContact;
    Ferramentas:
       Microformatos;
       Operator (extensão Firefox);
Mail Webservices - Exemplos Práticos - Em Acção (2)

Screencasts de demos de utilização:
 ListAllContacts:
    http://services.mail.sapo.pt/codebits/swf/ListAllContacts.swf
 GetMailbox:
    http://services.mail.sapo.pt/codebits/swf/GetMailbox.swf

Screencast de instalação e uso de um user-script para a extensão
  para Firefox Operator:
  Adicionar hCard de uma página ao webmail do SAPO:
   http://services.mail.sapo.pt/codebits/swf/Operator.swf
http://mail.blogs.sapo.pt/

Mais conteúdo relacionado

Destaque

Arnim Hilgendorf Photographer
Arnim Hilgendorf PhotographerArnim Hilgendorf Photographer
Arnim Hilgendorf PhotographerArnim Hilgendorf
 
Simply Abu Dhabi The First Edition
Simply  Abu Dhabi  The  First  EditionSimply  Abu Dhabi  The  First  Edition
Simply Abu Dhabi The First EditionArnie S Hira
 
Good sites useful sites (2) مواقع مفيدة
Good sites useful sites (2) مواقع مفيدةGood sites useful sites (2) مواقع مفيدة
Good sites useful sites (2) مواقع مفيدةArab Muslim
 
¿Cómo abrir una cuenta en hotmail?
¿Cómo abrir una cuenta en hotmail?¿Cómo abrir una cuenta en hotmail?
¿Cómo abrir una cuenta en hotmail?male_tati
 
Sintesis informativa 05 10 2012
Sintesis informativa 05 10 2012Sintesis informativa 05 10 2012
Sintesis informativa 05 10 2012megaradioexpress
 
Algorithms
AlgorithmsAlgorithms
AlgorithmsDevMix
 
Sistema para Estacionamento
Sistema para EstacionamentoSistema para Estacionamento
Sistema para EstacionamentoBruno Polidoro
 
Roteiro 1⺠eletromecã‚nica
Roteiro 1⺠eletromecã‚nicaRoteiro 1⺠eletromecã‚nica
Roteiro 1⺠eletromecã‚nicaeeeppacatuba
 
TriPollar Stop
TriPollar StopTriPollar Stop
TriPollar StopStop Time
 
Vocab Tanyas Reunion
Vocab Tanyas ReunionVocab Tanyas Reunion
Vocab Tanyas Reunionmadterrell
 
Webdesign para blogs literários
Webdesign para blogs literáriosWebdesign para blogs literários
Webdesign para blogs literáriosBilly Blay
 
CORREÇÃO FGTS - Nota Técnica Dieese
CORREÇÃO FGTS - Nota Técnica DieeseCORREÇÃO FGTS - Nota Técnica Dieese
CORREÇÃO FGTS - Nota Técnica DieeseFabio Motta
 
Karen almengor
Karen almengorKaren almengor
Karen almengorkaren_6
 

Destaque (20)

Arnim Hilgendorf Photographer
Arnim Hilgendorf PhotographerArnim Hilgendorf Photographer
Arnim Hilgendorf Photographer
 
MsM student handbook 2013-2014
MsM student handbook 2013-2014MsM student handbook 2013-2014
MsM student handbook 2013-2014
 
Edu 290 pp
Edu 290 ppEdu 290 pp
Edu 290 pp
 
Simply Abu Dhabi The First Edition
Simply  Abu Dhabi  The  First  EditionSimply  Abu Dhabi  The  First  Edition
Simply Abu Dhabi The First Edition
 
Good sites useful sites (2) مواقع مفيدة
Good sites useful sites (2) مواقع مفيدةGood sites useful sites (2) مواقع مفيدة
Good sites useful sites (2) مواقع مفيدة
 
¿Cómo abrir una cuenta en hotmail?
¿Cómo abrir una cuenta en hotmail?¿Cómo abrir una cuenta en hotmail?
¿Cómo abrir una cuenta en hotmail?
 
Bobina de tesla
Bobina de teslaBobina de tesla
Bobina de tesla
 
Edital 20x20 prorrogado
Edital 20x20 prorrogadoEdital 20x20 prorrogado
Edital 20x20 prorrogado
 
Secretarias municipais as (1)
Secretarias municipais as (1)Secretarias municipais as (1)
Secretarias municipais as (1)
 
Sintesis informativa 05 10 2012
Sintesis informativa 05 10 2012Sintesis informativa 05 10 2012
Sintesis informativa 05 10 2012
 
Algorithms
AlgorithmsAlgorithms
Algorithms
 
Sistema para Estacionamento
Sistema para EstacionamentoSistema para Estacionamento
Sistema para Estacionamento
 
Roteiro 1⺠eletromecã‚nica
Roteiro 1⺠eletromecã‚nicaRoteiro 1⺠eletromecã‚nica
Roteiro 1⺠eletromecã‚nica
 
Excel tecnologia
Excel tecnologiaExcel tecnologia
Excel tecnologia
 
TriPollar Stop
TriPollar StopTriPollar Stop
TriPollar Stop
 
Vocab Tanyas Reunion
Vocab Tanyas ReunionVocab Tanyas Reunion
Vocab Tanyas Reunion
 
Webdesign para blogs literários
Webdesign para blogs literáriosWebdesign para blogs literários
Webdesign para blogs literários
 
CORREÇÃO FGTS - Nota Técnica Dieese
CORREÇÃO FGTS - Nota Técnica DieeseCORREÇÃO FGTS - Nota Técnica Dieese
CORREÇÃO FGTS - Nota Técnica Dieese
 
Karen almengor
Karen almengorKaren almengor
Karen almengor
 
Concurso Público SSP/SC
Concurso Público SSP/SCConcurso Público SSP/SC
Concurso Público SSP/SC
 

Semelhante a SAPO Mail WebServices

Remy Sharp The DOM scripting toolkit jQuery
Remy Sharp The DOM scripting toolkit jQueryRemy Sharp The DOM scripting toolkit jQuery
Remy Sharp The DOM scripting toolkit jQuerydeimos
 
Practical PHP 5.3
Practical PHP 5.3Practical PHP 5.3
Practical PHP 5.3Nate Abele
 
Pim Elshoff "Technically DDD"
Pim Elshoff "Technically DDD"Pim Elshoff "Technically DDD"
Pim Elshoff "Technically DDD"Fwdays
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applicationselliando dias
 
TYPO3 Flow and the Joy of Development (FOSDEM 2013)
TYPO3 Flow and the Joy of Development (FOSDEM 2013)TYPO3 Flow and the Joy of Development (FOSDEM 2013)
TYPO3 Flow and the Joy of Development (FOSDEM 2013)Robert Lemke
 
PHPCon 2016: PHP7 by Witek Adamus / XSolve
PHPCon 2016: PHP7 by Witek Adamus / XSolvePHPCon 2016: PHP7 by Witek Adamus / XSolve
PHPCon 2016: PHP7 by Witek Adamus / XSolveXSolve
 
Dealing with Legacy Perl Code - Peter Scott
Dealing with Legacy Perl Code - Peter ScottDealing with Legacy Perl Code - Peter Scott
Dealing with Legacy Perl Code - Peter ScottO'Reilly Media
 
Design Patterns in PHP5
Design Patterns in PHP5 Design Patterns in PHP5
Design Patterns in PHP5 Wildan Maulana
 
Web Hooks On Pbwiki
Web Hooks On PbwikiWeb Hooks On Pbwiki
Web Hooks On Pbwikiguest7e115a
 
JavaScript for PHP developers
JavaScript for PHP developersJavaScript for PHP developers
JavaScript for PHP developersStoyan Stefanov
 
Alexander Makarov "Let’s talk about code"
Alexander Makarov "Let’s talk about code"Alexander Makarov "Let’s talk about code"
Alexander Makarov "Let’s talk about code"Fwdays
 
Applications for the Enterprise with PHP (CPEurope)
Applications for the Enterprise with PHP (CPEurope)Applications for the Enterprise with PHP (CPEurope)
Applications for the Enterprise with PHP (CPEurope)Robert Lemke
 
Zend Certification Preparation Tutorial
Zend Certification Preparation TutorialZend Certification Preparation Tutorial
Zend Certification Preparation TutorialLorna Mitchell
 
A Gentle Introduction To Object Oriented Php
A Gentle Introduction To Object Oriented PhpA Gentle Introduction To Object Oriented Php
A Gentle Introduction To Object Oriented PhpMichael Girouard
 
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכיריםמ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכיריםMiriam Schwab
 
WordPress: From Antispambot to Zeroize
WordPress: From Antispambot to ZeroizeWordPress: From Antispambot to Zeroize
WordPress: From Antispambot to ZeroizeYoav Farhi
 
Node.js for PHP developers
Node.js for PHP developersNode.js for PHP developers
Node.js for PHP developersAndrew Eddie
 
Gérer vos objets
Gérer vos objetsGérer vos objets
Gérer vos objetsThomas Gasc
 

Semelhante a SAPO Mail WebServices (20)

Remy Sharp The DOM scripting toolkit jQuery
Remy Sharp The DOM scripting toolkit jQueryRemy Sharp The DOM scripting toolkit jQuery
Remy Sharp The DOM scripting toolkit jQuery
 
Practical PHP 5.3
Practical PHP 5.3Practical PHP 5.3
Practical PHP 5.3
 
Kick Start Jpa
Kick Start JpaKick Start Jpa
Kick Start Jpa
 
Pim Elshoff "Technically DDD"
Pim Elshoff "Technically DDD"Pim Elshoff "Technically DDD"
Pim Elshoff "Technically DDD"
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applications
 
TYPO3 Flow and the Joy of Development (FOSDEM 2013)
TYPO3 Flow and the Joy of Development (FOSDEM 2013)TYPO3 Flow and the Joy of Development (FOSDEM 2013)
TYPO3 Flow and the Joy of Development (FOSDEM 2013)
 
Rack Middleware
Rack MiddlewareRack Middleware
Rack Middleware
 
PHPCon 2016: PHP7 by Witek Adamus / XSolve
PHPCon 2016: PHP7 by Witek Adamus / XSolvePHPCon 2016: PHP7 by Witek Adamus / XSolve
PHPCon 2016: PHP7 by Witek Adamus / XSolve
 
Dealing with Legacy Perl Code - Peter Scott
Dealing with Legacy Perl Code - Peter ScottDealing with Legacy Perl Code - Peter Scott
Dealing with Legacy Perl Code - Peter Scott
 
Design Patterns in PHP5
Design Patterns in PHP5 Design Patterns in PHP5
Design Patterns in PHP5
 
Web Hooks On Pbwiki
Web Hooks On PbwikiWeb Hooks On Pbwiki
Web Hooks On Pbwiki
 
JavaScript for PHP developers
JavaScript for PHP developersJavaScript for PHP developers
JavaScript for PHP developers
 
Alexander Makarov "Let’s talk about code"
Alexander Makarov "Let’s talk about code"Alexander Makarov "Let’s talk about code"
Alexander Makarov "Let’s talk about code"
 
Applications for the Enterprise with PHP (CPEurope)
Applications for the Enterprise with PHP (CPEurope)Applications for the Enterprise with PHP (CPEurope)
Applications for the Enterprise with PHP (CPEurope)
 
Zend Certification Preparation Tutorial
Zend Certification Preparation TutorialZend Certification Preparation Tutorial
Zend Certification Preparation Tutorial
 
A Gentle Introduction To Object Oriented Php
A Gentle Introduction To Object Oriented PhpA Gentle Introduction To Object Oriented Php
A Gentle Introduction To Object Oriented Php
 
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכיריםמ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
 
WordPress: From Antispambot to Zeroize
WordPress: From Antispambot to ZeroizeWordPress: From Antispambot to Zeroize
WordPress: From Antispambot to Zeroize
 
Node.js for PHP developers
Node.js for PHP developersNode.js for PHP developers
Node.js for PHP developers
 
Gérer vos objets
Gérer vos objetsGérer vos objets
Gérer vos objets
 

Mais de codebits

Gis SAPO Hands On
Gis SAPO Hands OnGis SAPO Hands On
Gis SAPO Hands Oncodebits
 
Aplicações Web TV no Meo
Aplicações Web TV no MeoAplicações Web TV no Meo
Aplicações Web TV no Meocodebits
 
Forms Usability 101
Forms Usability 101Forms Usability 101
Forms Usability 101codebits
 
Speak up: como criar Speech-based apps
Speak up: como criar Speech-based appsSpeak up: como criar Speech-based apps
Speak up: como criar Speech-based appscodebits
 
XMPP Hands-On
XMPP Hands-OnXMPP Hands-On
XMPP Hands-Oncodebits
 
Mitos da Acessibilidade Web
Mitos da Acessibilidade WebMitos da Acessibilidade Web
Mitos da Acessibilidade Webcodebits
 
Getting started with mobile devices development - Openmoko Freerunner
Getting started with mobile devices development - Openmoko FreerunnerGetting started with mobile devices development - Openmoko Freerunner
Getting started with mobile devices development - Openmoko Freerunnercodebits
 
Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...
Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...
Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...codebits
 
Getting started with mobile devices development - Openmoko Freerunner
Getting started with mobile devices development - Openmoko FreerunnerGetting started with mobile devices development - Openmoko Freerunner
Getting started with mobile devices development - Openmoko Freerunnercodebits
 
Exploring XMPP
Exploring XMPPExploring XMPP
Exploring XMPPcodebits
 
Sapo BUS Hands-On
Sapo BUS Hands-OnSapo BUS Hands-On
Sapo BUS Hands-Oncodebits
 
Qtractor - An Audio/MIDI multi-track sequencer
Qtractor - An Audio/MIDI multi-track sequencerQtractor - An Audio/MIDI multi-track sequencer
Qtractor - An Audio/MIDI multi-track sequencercodebits
 
Making the Chumby
Making the ChumbyMaking the Chumby
Making the Chumbycodebits
 
Globs - Gestão de Glossários
Globs - Gestão de GlossáriosGlobs - Gestão de Glossários
Globs - Gestão de Glossárioscodebits
 
ATrad - Sistema de Garantia de Qualidade de Traduções
ATrad - Sistema de Garantia de Qualidade de TraduçõesATrad - Sistema de Garantia de Qualidade de Traduções
ATrad - Sistema de Garantia de Qualidade de Traduçõescodebits
 
Alto Desempenho com Java
Alto Desempenho com JavaAlto Desempenho com Java
Alto Desempenho com Javacodebits
 
Sapo GIS Hands-On
Sapo GIS Hands-OnSapo GIS Hands-On
Sapo GIS Hands-Oncodebits
 
Practical Thin Server Architecture With Dojo Sapo Codebits 2008
Practical Thin Server Architecture With Dojo Sapo Codebits 2008Practical Thin Server Architecture With Dojo Sapo Codebits 2008
Practical Thin Server Architecture With Dojo Sapo Codebits 2008codebits
 

Mais de codebits (20)

Gis SAPO Hands On
Gis SAPO Hands OnGis SAPO Hands On
Gis SAPO Hands On
 
Aplicações Web TV no Meo
Aplicações Web TV no MeoAplicações Web TV no Meo
Aplicações Web TV no Meo
 
Forms Usability 101
Forms Usability 101Forms Usability 101
Forms Usability 101
 
Speak up: como criar Speech-based apps
Speak up: como criar Speech-based appsSpeak up: como criar Speech-based apps
Speak up: como criar Speech-based apps
 
XMPP Hands-On
XMPP Hands-OnXMPP Hands-On
XMPP Hands-On
 
Mitos da Acessibilidade Web
Mitos da Acessibilidade WebMitos da Acessibilidade Web
Mitos da Acessibilidade Web
 
Getting started with mobile devices development - Openmoko Freerunner
Getting started with mobile devices development - Openmoko FreerunnerGetting started with mobile devices development - Openmoko Freerunner
Getting started with mobile devices development - Openmoko Freerunner
 
Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...
Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...
Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...
 
CouchDB
CouchDBCouchDB
CouchDB
 
Getting started with mobile devices development - Openmoko Freerunner
Getting started with mobile devices development - Openmoko FreerunnerGetting started with mobile devices development - Openmoko Freerunner
Getting started with mobile devices development - Openmoko Freerunner
 
Exploring XMPP
Exploring XMPPExploring XMPP
Exploring XMPP
 
Sapo BUS Hands-On
Sapo BUS Hands-OnSapo BUS Hands-On
Sapo BUS Hands-On
 
Qtractor - An Audio/MIDI multi-track sequencer
Qtractor - An Audio/MIDI multi-track sequencerQtractor - An Audio/MIDI multi-track sequencer
Qtractor - An Audio/MIDI multi-track sequencer
 
Making the Chumby
Making the ChumbyMaking the Chumby
Making the Chumby
 
Globs - Gestão de Glossários
Globs - Gestão de GlossáriosGlobs - Gestão de Glossários
Globs - Gestão de Glossários
 
ATrad - Sistema de Garantia de Qualidade de Traduções
ATrad - Sistema de Garantia de Qualidade de TraduçõesATrad - Sistema de Garantia de Qualidade de Traduções
ATrad - Sistema de Garantia de Qualidade de Traduções
 
Alto Desempenho com Java
Alto Desempenho com JavaAlto Desempenho com Java
Alto Desempenho com Java
 
Sapo GIS Hands-On
Sapo GIS Hands-OnSapo GIS Hands-On
Sapo GIS Hands-On
 
Gis@sapo
Gis@sapoGis@sapo
Gis@sapo
 
Practical Thin Server Architecture With Dojo Sapo Codebits 2008
Practical Thin Server Architecture With Dojo Sapo Codebits 2008Practical Thin Server Architecture With Dojo Sapo Codebits 2008
Practical Thin Server Architecture With Dojo Sapo Codebits 2008
 

Último

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 

Último (20)

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 

SAPO Mail WebServices

  • 1. SAPO Mail - Webservices 14 de Novembro 2007 •Nuno Loureiro <nuno@co.sapo.pt> •Carlos Pires <acmpires@co.sapo.pt> •André Luís <aluis@co.sapo.pt>
  • 2. SAPO Mail - Webservices Arquitectura Aspectos Gerais Credenciais Mail Contactos Exemplos Práticos
  • 4. SAPO Mail - Webservices Arquitectura Aspectos Gerais Credenciais Mail Contactos Exemplos Práticos
  • 5. Mail Webservices - Aspectos Gerais Operações disponíveis: Mail: GetStatus; GetLastMails; GetMailbox; Contactos: ListAllContacts; GetContact; AddContact; DeleteContact; SearchContacts; SetContact.
  • 6. Mail Webservices - Aspectos Gerais End-Point: http://services.sapo.pt/Mail WSDL: http://services.sapo.pt/Metadata/Contract/Mail Namespace: http://services.sapo.pt/definitions Exemplo Prático: http://services.mail.sapo.pt/codebits Operator (Firefox): http://addons.mozilla.org/en-US/firefox/addon/4106 User-script para Operator (Firefox): http://services.mail.sapo.pt/operator/js/sapomail.js
  • 7. SAPO Mail - Webservices Arquitectura Aspectos Gerais Credenciais Mail Contactos Exemplos Práticos
  • 8. Mail Webservices - Credenciais - Objecto ESBCredentials 1 ESBCredentials • ESBUsername • ESBPassword Usado para a autenticação nos webservices do mail; Todas as operações dos webservices do mail requerem a definição de um SOAP Header com as credenciais do utilizador. class ESBCredentials { public $ESBUsername; //string public $ESBPassword; //string }
  • 9. SAPO Mail - Webservices Arquitectura Aspectos Gerais Credenciais Mail Contactos Exemplos Práticos
  • 10. Mail Webservices - Mail - Objectos 1 Mailbox • Status • ArrayOfLastMail ArrayOfLastMail • PageInfo • LastMail Status PageInfo LastMail • Total • PageNumber • MessageId • Recent • Unseen • RecordsCount • FromName • Answered • Recent • MaxRecords • FromEMail • Deleted • Subject • Flagged • Date • Size (in bytes) • Seen
  • 11. Mail Webservices - Mail - Operações (1) GetStatus GetStatus class Status { public $Total; //int public $Unseen; //int public $Recent; //int }
  • 12. Mail Webservices - Mail - Operações (2) GetLastMails GetLastMails • page (1 by default) • limit (10 by default, max 50)  Headers das mensagens pedidas;  Ordenação: ARRIVAL DATE DESC class ArrayOfLastMail { public $PageInfo; public $LastMail = array(); class LastMail { } public $MessageId; //int (imap uid) public $FromName; //string public $FromEMail; //string public $Subject; //string public $Date; //string class PageInfo { public $Seen; //boolean public $PageNumber; //int public $Recent; //boolean public $RecordsCount; //int public $Answered; //boolean public $MaxRecords; //int public $Deleted; //boolean } public $Flagged; //booelan public $Size; //int (in bytes) }
  • 13. Mail Webservices - Mail - Operações (3) GetMailbox GetMailbox • page (1 by default) • limit (10 by default, max 50) class Mailbox { public $Status; public $ArrayOfLastMail; class ArrayOfLastMail { } public $PageInfo; //PageInfo public $LastMail = array(); //LastMail } class Status { public $Total; //int  Headers das mensagens pedidas; public $Unseen; //int public $Recent; //int  Ordenação: ARRIVAL DATE DESC }
  • 15. SAPO Mail - Webservices Arquitectura Aspectos Gerais Credenciais Mail Contactos Exemplos Práticos
  • 16. Mail Webservices - Contactos - Objectos 1 ArrayOfContact • ContactInfo • Contact ContactInfo Contact • ContactId • CellPhone • RecordsCount • Name • Fax • SearchExpression (opcional) • Alias • Title • Email • Company • HomeAddress • Notes • WorkAddress • PGPPublicKey • HomePhone • SMimePublicKey • WorkPhone • FreeBusyURL
  • 17. Mail Webservices - Contactos - Operações (1) ListAllContacts ListAllContacts class Contact { public $ContactId; //string public $Name; //string class ArrayOfContact { public $Alias; //string public $ContactInfo; public $Email; //string public $Contact = array(); public $HomeAddress; //string } public $WorkAddress; //string public $HomePhone; //string public $WorkPhone; //string public $CellPhone; //string public $Fax; //string public $Title; //string class ContactInfo { public $Company; //string public $RecordsCount; //int public $Notes; //string public $SearchExpression; //string public $PGPPublicKey; //string } public $SMimePublicKey; //string public $FreeBusyURL; //string }
  • 18. Mail Webservices - Contactos - Operações (2) GetContact GetContact • ContactID (string) class Contact { public $ContactId; //string public $Name; //string public $Alias; //string public $Email; //string public $HomeAddress; //string public $WorkAddress; //string public $HomePhone; //string public $WorkPhone; //string public $CellPhone; //string public $Fax; //string public $Title; //string public $Company; //string public $Notes; //string public $PGPPublicKey; //string public $SMimePublicKey; //string public $FreeBusyURL; //string }
  • 19. Mail Webservices - Contactos - Operações (3) AddContact AddContact • Contact (object)  Campo gerado pelo webservice:  ContactId;  Obrigatório:  Name. 057259c0271b5cf71bb8e9be7ace49e2 ContactId (hash md5)
  • 20. Mail Webservices - Contactos - Operações (4) SetContact SetContact • ContactID (string) • Contact (object)  Campo ignorado pelo webservice:  ContactId; true false Sucesso Erro
  • 21. Mail Webservices - Contactos - Operações (5) SearchContact SearchContact • SearchExpression (string != ‘’)  Nome  E-mail class Contact { class ArrayOfContact { public $ContactId; //string public $ContactInfo; public $Name; //string public $Contact = array(); public $Alias; //string } public $Email; //string public $HomeAddress; //string public $WorkAddress; //string public $HomePhone; //string public $WorkPhone; //string public $CellPhone; //string class ContactInfo { public $Fax; //string public $RecordsCount; //int public $Title; //string public $SearchExpression; //string public $Company; //string } public $Notes; //string public $PGPPublicKey; //string public $SMimePublicKey; //string public $FreeBusyURL; //string }
  • 22. Mail Webservices - Contactos - Operações (6) DeleteContact DeleteContact • ContactID (string) true false Sucesso Erro
  • 23. Mail Webservices - Contactos
  • 24. Mail Webservices - Contactos
  • 25. SAPO Mail - Webservices Arquitectura Aspectos Gerais Credenciais Mail Contactos Exemplos Práticos
  • 26. Mail Webservices - Exemplos Práticos - SOAP Request <?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?> <SOAP-ENV:Envelope xmlns:SOAP-ENV=quot;http://schemas.xmlsoap.org/soap/envelope/quot; xmlns:ns1=quot;http://services.sapo.pt/definitionsquot;> <SOAP-ENV:Header> <ns1:ESBCredentials> <ns1:ESBUsername>someuser@sapo.pt</ns1:ESBUsername> <ns1:ESBPassword>somepass</ns1:ESBPassword> </ns1:ESBCredentials> </SOAP-ENV:Header> <SOAP-ENV:Body> <ns1:GetMailbox> <ns1:page>1</ns1:page> <ns1:limit>10</ns1:limit> </ns1:GetMailbox> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
  • 27. Mail Webservices - Exemplos Práticos - SOAP Request <?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?> <SOAP-ENV:Envelope xmlns:SOAP-ENV=quot;http://schemas.xmlsoap.org/soap/envelope/quot; xmlns:ns1=quot;http://services.sapo.pt/definitionsquot;> <SOAP-ENV:Header> <ns1:ESBCredentials> <ns1:ESBUsername>someuser@sapo.pt</ns1:ESBUsername> <ns1:ESBPassword>somepass</ns1:ESBPassword> </ns1:ESBCredentials> </SOAP-ENV:Header> <SOAP-ENV:Body> <ns1:ListAllContacts/> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
  • 28. Mail Webservices - Exemplos Práticos - PHP5 Client Example <?php require_once dirname(__FILE__) . '/Mail_client_conf.php'; // Config require_once dirname(__FILE__) . '/Mail_types.php'; // Class types $user = 'someuser@sapo.pt'; $pass = 'somepass'; $ESBC = new ESBCredentials_t(); $ESBC->ESBUsername = $user; $ESBC->ESBPassword = $pass; $GetMailbox = new GetMailbox_t(); $GetMailbox->page = 1; $GetMailbox->limit = 10; $paramMailbox = (isset($GetMailbox)) ? array('parameters' => $GetMailbox) : array(); // [ ---> Continua ]
  • 29. Mail Webservices - Exemplos Práticos - PHP5 Client Example (2) $client = new SoapClient( /* This should be local, avoid one network call */ 'http://services.sapo.pt/Metadata/Contract/Mail', array('location' => quot;http://services.sapo.pt/Mailquot;, 'classmap' => $classmap) ); $header = new SoapHeader('http://services.sapo.pt/definitions', 'ESBCredentials', $ESBC); try { $response = $client->__soapCall('GetMailbox', $paramMailbox, null, $header); /* Your Code Here */ } catch (SoapFault $e) { $text = (!$e->getMessage()) ? $e->faultstring : $e->getMessage(); echo quot;SOAP FAULT: $textnquot;; } ?>
  • 30. Mail Webservices - Exemplos Práticos - PHP CodeGenerator <?php require_once dirname(__FILE__) . '/Mail_client_conf.php'; require_once dirname(__FILE__) . '/Mail_client.php'; $client = new Mail_client($conf); $client->makeHeader('someuser@sapo.pt', 'somepass'); /* GetMailbox(page, limit) */ $response = $client->GetMailbox(1, 10); /* ListAllContacts */ //$response = $client->ListAllContacts(); /* AddContact(Contact) */ //$Contact = new Contact_t(); //$Contact->Name = 'somename'; // ... //$response = $client->AddContact($Contact); /* Your Code Here */ ?>
  • 31. Mail Webservices - Exemplos Práticos - Em Acção (1) Agora é tempo de ver tudo isto em acção: Listagem de Mails e Contactos: Webservices: GetMailbox; ListAllContacts; Importação de contactos para o webmail: Webservices: AddContact; Ferramentas: Microformatos; Operator (extensão Firefox);
  • 32. Mail Webservices - Exemplos Práticos - Em Acção (2) Screencasts de demos de utilização: ListAllContacts: http://services.mail.sapo.pt/codebits/swf/ListAllContacts.swf GetMailbox: http://services.mail.sapo.pt/codebits/swf/GetMailbox.swf Screencast de instalação e uso de um user-script para a extensão para Firefox Operator: Adicionar hCard de uma página ao webmail do SAPO: http://services.mail.sapo.pt/codebits/swf/Operator.swf