SlideShare a Scribd company logo
1 of 33
Download to read 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/

More Related Content

Viewers also liked

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
 

Viewers also liked (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
 

Similar to 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
 
WordPress: From Antispambot to Zeroize
WordPress: From Antispambot to ZeroizeWordPress: From Antispambot to Zeroize
WordPress: From Antispambot to ZeroizeYoav Farhi
 
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכיריםמ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכיריםMiriam Schwab
 
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
 

Similar to 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
 
WordPress: From Antispambot to Zeroize
WordPress: From Antispambot to ZeroizeWordPress: From Antispambot to Zeroize
WordPress: From Antispambot to Zeroize
 
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכיריםמ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
 
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
 

More from 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
 

More from 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
 

Recently uploaded

Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarPrecisely
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Will Schroeder
 

Recently uploaded (20)

Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity Webinar
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
 

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