SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Andere mochten auch

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
 

Andere mochten auch (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Kürzlich hochgeladen

WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 

Kürzlich hochgeladen (20)

E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 

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