SlideShare uma empresa Scribd logo
1 de 21
Gustavo Loureiro dos Reis
Leonardo César de Sousa Campos
Victor da Silva Montalvão
• Componentes da Aplicação

• utilizam Protocolos Abertos

• Completo e Autodescrito
• Disponibilizados através da
  Web para outras aplicações
Arquivo .asmx – extensão ASP.NET para XML Web Services
<%@ WebService Language="VBScript" Class="TempConvert" %>

Imports System
Imports System.Web.Services

Public Class TempConvert :Inherits WebService

<WebMethod()> Public Function FahrenheitToCelsius
(ByVal Fahrenheit As String) As String
  dim fahr
  fahr=trim(replace(Fahrenheit,",","."))
  if fahr="" or IsNumeric(fahr)=false then return "Error"
  return ((((fahr) - 32) / 9) * 5)
end function

<WebMethod()> Public Function CelsiusToFahrenheit
(ByVal Celsius As String) As String
  dim cel
  cel=trim(replace(Celsius,",","."))
  if cel="" or IsNumeric(cel)=false then return "Error"
  return ((((cel) * 9) / 5) + 32)
end function

end class


                                           http://www.w3schools.com/webservices/ws_example.asp
Transport Protocol
• HTTP, FTP, SMTP


Messaging Protocol
• SOAP, WS-Addressing


Description Protocol
• Public Interface
• WSDL

Discovery Protocol
• Available Services
• UDDL*
• Protocolo baseado em XML
• Troca de informações via HTTP
  Blocks
  Envelope


   Header


   Body


   Fault
POST /InStock HTTP/1.1
Host: www.example.org
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn

<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Body xmlns:m="http://www.example.org/stock">
  <m:GetStockPrice>
                                   HTTP/1.1 200 OK
    <m:StockName>IBM</m:StockName>
                                   Content-Type: application/soap+xml; charset=utf-8
  </m:GetStockPrice>
                                   Content-Length: nnn
</soap:Body>
                                   <?xml version="1.0"?>
</soap:Envelope>
                                   <soap:Envelope
                                   xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
                                   soap:encodingStyle="http://www.w3.org/2001/12/soap-
                                   encoding">

                                   <soap:Body xmlns:m="http://www.example.org/stock">
                                     <m:GetStockPriceResponse>
                                       <m:Price>34.5</m:Price>
                                     </m:GetStockPriceResponse>
                                   </soap:Body>

                                   </soap:Envelope>
public HTTPRequest()
    {
        try {
            HttpClient httpclient = new DefaultHttpClient();
            String body="Data";
            String bodyLength=new Integer(body.length()).toString();
            System.out.println(bodyLength);

            URI uri=new URI("SOMEURL?Param1=1234&Param2=abcd");
            HttpPost httpPost = new HttpPost(uri);
            httpPost.addHeader( "SOAPAction", strReferenceToSoapActionValue );
            StringEntity entity = new StringEntity(body,
"text/xml",HTTP.DEFAULT_CONTENT_CHARSET);
            httpPost.setEntity(entity);

           RequestWrapper requestWrapper=new RequestWrapper(httpPost);
           requestWrapper.setMethod("POST");
           requestWrapper.setHeader( "SOAPAction", strReferenceToSoapActionValue );
           requestWrapper.removeHeaders("Host");
           requestWrapper.setHeader("Host", “...");
           HttpResponse response = httpclient.execute(requestWrapper);
       } catch (Exception e) { e.printStackTrace();     }
   }
• XML-based Language for
  Locating and Describing
  Web Services
• JAX-WS é uma biblioteca de chamadas
  remotas de procedimento (RPC), que
  permite implementar serviços baseados
  nas normas XSD, WSDL e SOAP
...Definir o mapeamento de
     WSDL para Java e vice-versa

... implementar Web Services partindo de
   um contrato WSDL ou de código Java

        ...criar código cliente de
      invocação de Web Services
Chamadas remotas de procedimento, passo-a-passo:
OBS: Definição do acordo WSDL entre cliente e servidor
Web Services
Web Services
Web Services
Web Services

Mais conteúdo relacionado

Mais procurados

Mule esb using file to string and logger component
Mule esb using file to string and logger componentMule esb using file to string and logger component
Mule esb using file to string and logger componentGermano Barba
 
GeeCON 2013 - EJB application guided by tests
GeeCON 2013 - EJB application guided by testsGeeCON 2013 - EJB application guided by tests
GeeCON 2013 - EJB application guided by testsJakub Marchwicki
 
Routine per aprire documenti da vb6 [santi caltabiano].txt blocco note
Routine per aprire documenti da vb6 [santi caltabiano].txt   blocco noteRoutine per aprire documenti da vb6 [santi caltabiano].txt   blocco note
Routine per aprire documenti da vb6 [santi caltabiano].txt blocco notesanti caltabiano
 
Searched gems which supports only ruby 2.6
Searched gems which supports only ruby 2.6Searched gems which supports only ruby 2.6
Searched gems which supports only ruby 2.6Maki Toshio
 
Reactive Web - Servlet & Async, Non-blocking I/O
Reactive Web - Servlet & Async, Non-blocking I/OReactive Web - Servlet & Async, Non-blocking I/O
Reactive Web - Servlet & Async, Non-blocking I/OArawn Park
 
MySql cheat sheet
MySql cheat sheetMySql cheat sheet
MySql cheat sheetLam Hoang
 
Transmogrifier: Migrating to Plone with less pain
Transmogrifier: Migrating to Plone with less painTransmogrifier: Migrating to Plone with less pain
Transmogrifier: Migrating to Plone with less painLennart Regebro
 
Process monitoring in UNIX shell scripting
Process monitoring in UNIX shell scriptingProcess monitoring in UNIX shell scripting
Process monitoring in UNIX shell scriptingDan Morrill
 
Additional action script 3.0
Additional action script 3.0Additional action script 3.0
Additional action script 3.0Brian Kelly
 

Mais procurados (12)

Mule parsing with json
Mule parsing with jsonMule parsing with json
Mule parsing with json
 
Mule esb using file to string and logger component
Mule esb using file to string and logger componentMule esb using file to string and logger component
Mule esb using file to string and logger component
 
Php sql-android
Php sql-androidPhp sql-android
Php sql-android
 
GeeCON 2013 - EJB application guided by tests
GeeCON 2013 - EJB application guided by testsGeeCON 2013 - EJB application guided by tests
GeeCON 2013 - EJB application guided by tests
 
Routine per aprire documenti da vb6 [santi caltabiano].txt blocco note
Routine per aprire documenti da vb6 [santi caltabiano].txt   blocco noteRoutine per aprire documenti da vb6 [santi caltabiano].txt   blocco note
Routine per aprire documenti da vb6 [santi caltabiano].txt blocco note
 
Searched gems which supports only ruby 2.6
Searched gems which supports only ruby 2.6Searched gems which supports only ruby 2.6
Searched gems which supports only ruby 2.6
 
Reactive Web - Servlet & Async, Non-blocking I/O
Reactive Web - Servlet & Async, Non-blocking I/OReactive Web - Servlet & Async, Non-blocking I/O
Reactive Web - Servlet & Async, Non-blocking I/O
 
MySql cheat sheet
MySql cheat sheetMySql cheat sheet
MySql cheat sheet
 
Transmogrifier: Migrating to Plone with less pain
Transmogrifier: Migrating to Plone with less painTransmogrifier: Migrating to Plone with less pain
Transmogrifier: Migrating to Plone with less pain
 
Example esb flow
Example esb flowExample esb flow
Example esb flow
 
Process monitoring in UNIX shell scripting
Process monitoring in UNIX shell scriptingProcess monitoring in UNIX shell scripting
Process monitoring in UNIX shell scripting
 
Additional action script 3.0
Additional action script 3.0Additional action script 3.0
Additional action script 3.0
 

Destaque

CORE - RedeCASD Lightning Talks
CORE - RedeCASD Lightning TalksCORE - RedeCASD Lightning Talks
CORE - RedeCASD Lightning TalksVictor Montalvão
 
Rotas de Rede - RedeCASD 2012
Rotas de Rede - RedeCASD 2012Rotas de Rede - RedeCASD 2012
Rotas de Rede - RedeCASD 2012Victor Montalvão
 
Are APIs and SOA Converging?
Are APIs and SOA Converging?Are APIs and SOA Converging?
Are APIs and SOA Converging?Akana
 
Amazon’s lower cost structure cascade chart
Amazon’s lower cost structure cascade chartAmazon’s lower cost structure cascade chart
Amazon’s lower cost structure cascade chartMekko Graphics
 

Destaque (7)

CORE - RedeCASD Lightning Talks
CORE - RedeCASD Lightning TalksCORE - RedeCASD Lightning Talks
CORE - RedeCASD Lightning Talks
 
Apresentação DOO 2013
Apresentação DOO 2013Apresentação DOO 2013
Apresentação DOO 2013
 
Rotas de Rede - RedeCASD 2012
Rotas de Rede - RedeCASD 2012Rotas de Rede - RedeCASD 2012
Rotas de Rede - RedeCASD 2012
 
Java, PortalH8 e RedeCASD
Java, PortalH8 e RedeCASDJava, PortalH8 e RedeCASD
Java, PortalH8 e RedeCASD
 
Are APIs and SOA Converging?
Are APIs and SOA Converging?Are APIs and SOA Converging?
Are APIs and SOA Converging?
 
Amazon’s lower cost structure cascade chart
Amazon’s lower cost structure cascade chartAmazon’s lower cost structure cascade chart
Amazon’s lower cost structure cascade chart
 
Amazon's secret sauce
Amazon's secret sauceAmazon's secret sauce
Amazon's secret sauce
 

Semelhante a Web Services

Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jerseyb_kathir
 
2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...
2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...
2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...PHP Conference Argentina
 
8 Minutes On Rack
8 Minutes On Rack8 Minutes On Rack
8 Minutes On Rackdanwrong
 
Creating a polyglottestframework
Creating a polyglottestframeworkCreating a polyglottestframework
Creating a polyglottestframeworkerwindeg
 
Introduction to Ajax programming
Introduction to Ajax programmingIntroduction to Ajax programming
Introduction to Ajax programmingFulvio Corno
 
Using and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middlewareUsing and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middlewareAlona Mekhovova
 

Semelhante a Web Services (20)

Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jersey
 
Ajax
AjaxAjax
Ajax
 
2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...
2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...
2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...
 
8 Minutes On Rack
8 Minutes On Rack8 Minutes On Rack
8 Minutes On Rack
 
Ajax and xml
Ajax and xmlAjax and xml
Ajax and xml
 
servlets
servletsservlets
servlets
 
Os Pruett
Os PruettOs Pruett
Os Pruett
 
Soap Component
Soap ComponentSoap Component
Soap Component
 
Server Side Swift: Vapor
Server Side Swift: VaporServer Side Swift: Vapor
Server Side Swift: Vapor
 
Ajax - a quick introduction
Ajax - a quick introductionAjax - a quick introduction
Ajax - a quick introduction
 
Creating a polyglottestframework
Creating a polyglottestframeworkCreating a polyglottestframework
Creating a polyglottestframework
 
Core Java tutorial at Unit Nexus
Core Java tutorial at Unit NexusCore Java tutorial at Unit Nexus
Core Java tutorial at Unit Nexus
 
Introduction to Ajax programming
Introduction to Ajax programmingIntroduction to Ajax programming
Introduction to Ajax programming
 
Aimaf
AimafAimaf
Aimaf
 
Ajax
AjaxAjax
Ajax
 
AJAX
AJAXAJAX
AJAX
 
AJAX
AJAXAJAX
AJAX
 
How to use soap component
How to use soap componentHow to use soap component
How to use soap component
 
08 ajax
08 ajax08 ajax
08 ajax
 
Using and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middlewareUsing and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middleware
 

Último

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
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
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 

Último (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
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
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 

Web Services

  • 1. Gustavo Loureiro dos Reis Leonardo César de Sousa Campos Victor da Silva Montalvão
  • 2. • Componentes da Aplicação • utilizam Protocolos Abertos • Completo e Autodescrito • Disponibilizados através da Web para outras aplicações
  • 3. Arquivo .asmx – extensão ASP.NET para XML Web Services <%@ WebService Language="VBScript" Class="TempConvert" %> Imports System Imports System.Web.Services Public Class TempConvert :Inherits WebService <WebMethod()> Public Function FahrenheitToCelsius (ByVal Fahrenheit As String) As String dim fahr fahr=trim(replace(Fahrenheit,",",".")) if fahr="" or IsNumeric(fahr)=false then return "Error" return ((((fahr) - 32) / 9) * 5) end function <WebMethod()> Public Function CelsiusToFahrenheit (ByVal Celsius As String) As String dim cel cel=trim(replace(Celsius,",",".")) if cel="" or IsNumeric(cel)=false then return "Error" return ((((cel) * 9) / 5) + 32) end function end class http://www.w3schools.com/webservices/ws_example.asp
  • 4.
  • 5. Transport Protocol • HTTP, FTP, SMTP Messaging Protocol • SOAP, WS-Addressing Description Protocol • Public Interface • WSDL Discovery Protocol • Available Services • UDDL*
  • 6. • Protocolo baseado em XML • Troca de informações via HTTP Blocks Envelope Header Body Fault
  • 7. POST /InStock HTTP/1.1 Host: www.example.org Content-Type: application/soap+xml; charset=utf-8 Content-Length: nnn <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:Body xmlns:m="http://www.example.org/stock"> <m:GetStockPrice> HTTP/1.1 200 OK <m:StockName>IBM</m:StockName> Content-Type: application/soap+xml; charset=utf-8 </m:GetStockPrice> Content-Length: nnn </soap:Body> <?xml version="1.0"?> </soap:Envelope> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap- encoding"> <soap:Body xmlns:m="http://www.example.org/stock"> <m:GetStockPriceResponse> <m:Price>34.5</m:Price> </m:GetStockPriceResponse> </soap:Body> </soap:Envelope>
  • 8. public HTTPRequest() { try { HttpClient httpclient = new DefaultHttpClient(); String body="Data"; String bodyLength=new Integer(body.length()).toString(); System.out.println(bodyLength); URI uri=new URI("SOMEURL?Param1=1234&Param2=abcd"); HttpPost httpPost = new HttpPost(uri); httpPost.addHeader( "SOAPAction", strReferenceToSoapActionValue ); StringEntity entity = new StringEntity(body, "text/xml",HTTP.DEFAULT_CONTENT_CHARSET); httpPost.setEntity(entity); RequestWrapper requestWrapper=new RequestWrapper(httpPost); requestWrapper.setMethod("POST"); requestWrapper.setHeader( "SOAPAction", strReferenceToSoapActionValue ); requestWrapper.removeHeaders("Host"); requestWrapper.setHeader("Host", “..."); HttpResponse response = httpclient.execute(requestWrapper); } catch (Exception e) { e.printStackTrace(); } }
  • 9. • XML-based Language for Locating and Describing Web Services
  • 10.
  • 11.
  • 12.
  • 13.
  • 14. • JAX-WS é uma biblioteca de chamadas remotas de procedimento (RPC), que permite implementar serviços baseados nas normas XSD, WSDL e SOAP
  • 15. ...Definir o mapeamento de WSDL para Java e vice-versa ... implementar Web Services partindo de um contrato WSDL ou de código Java ...criar código cliente de invocação de Web Services
  • 16. Chamadas remotas de procedimento, passo-a-passo:
  • 17. OBS: Definição do acordo WSDL entre cliente e servidor