SlideShare uma empresa Scribd logo
1 de 34
ChoreUnit: Testing framework for
Web Services
Felipe Besson, Guilherme Nogueira, Leonardo Leite
{besson, gmaio, leofl}@ime.usp.br
Porto Alegre, July 2nd, 2011
Services
?
Product Vs Service
Product Vs Service
Web Services
Message exchange standards (xml)
among systems through Internet (http)
Web Services - Applications
● Machine-machine communication
00111100
10111010
10111101
11110000
Web Services - Applications
● Machine-machine communication
● Integrate heterogeneous systems
Web Services - Applications
● Machine-machine communication
● Integrate heterogeneous systems
● Business automation
Comprar
Z
z
z
z
z
zz
Z
Z
Web Services - Applications
● Machine-machine communication
● Integrate heterogeneous systems
● Business automation
Buy
Z
z
z
z
z
zz
Z
Z
Service provider
Client
Web Services - Applications
● Machine-machine communication
● Integrate heterogeneous systems
● Business automation
● Data access
WS
Web Services - Applications
● Machine-machine communication
● Integrate heterogeneous systems
● Business automation
● Data access and creation (colaborative)
WS
Now: billions of web pages
Future: billions of web services
SOAP
WSDL
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://hello/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://hello/"
name="HelloWorldService">
<types>
<xsd:schema>
<xsd:import namespace="http://hello/"
schemaLocation="http://localhost:8080/hello?xsd=1"></xsd:import>
</xsd:schema>
</types>
<message name="sayHelloTo">
<part name="parameter" element="tns:sayHelloTo"></part>
</message>
<message name="sayHelloToResponse">
<part name="parameter" element="tns:sayHelloToResponse"></part>
</message>
<portType name="HelloWorld">
<operation name="sayHelloTo">
<input message="tns:sayHelloTo"></input>
<output message="tns:sayHelloToResponse"></output>
</operation>
</portType>
Web Services Clients in Java
● Apache Axis2
● Jax-WS (Java EE API)
WS Client with Jax-WS
...
<portType name="StoreWS">
<operation name="searchByArtist">
<input message="tns:searchByArtist"/>
<output message="tns:searchByArtistResponse"/>
</operation>
<operation name="searchByGenre">
<input message="tns:searchByGenre"/>
<output message="tns:searchByGenreResponse"/>
</operation>
<operation name="searchByTitle">
<input message="tns:searchByTitle"/>
<output message="tns:searchByTitleResponse"/>
</operation>
<operation name="purchase">
<input message="tns:purchase"/>
<output message="tns:purchaseResponse"/>
</operation>
</portType>
...
WS Client with Jax-WS
public interface Store {
List<CD> searchByArtist(String artist);
List<CD> searchByGenre(String genre);
List<CD> searchByTitle(String title);
Boolean purchase(CD cd, Customer customer);
}
WS Client with Jax-WS
$wsimport -s src http://choreos.ime.usp.br/store?wsdl
WS Client with Jax-WS
$wsimport -s src http://choreos.ime.usp.br/store?wsdl
ObjectFactory  
package­info   
StoreWS
StoreWSService
CD
Customer
SearchByGenre          
SearchByGenreResponse  
SearchByTitle          
SearchByTitleResponse
SearchByArtist         
SearchByArtistResponse  
Purchase       
PurchaseResponse        
WS Client with Jax-WS
StoreWSService service = new StoreWSService();
StoreWS store = service.getStoreWSPort();
List<CD> cds = store.searchByGenre("Rock");
TDD
Test-driven development
TDD
Write test
Make test pass
Refactoring
Our Framework
Stub creation can be a problem
Process:
1. create stubs
2. add classes to
project
3. understand classes
Service interface
changed!
%$#@
Developer
Problems when testing
● Tests must be almost completely
rewritten
● Problem to integrate different services
● How to do TDD without stubs?
%$#@
Our Goals
Make testing web services easy
● Interact with web services without stubs
● Easily validate the operation's responses
● Writing tests before the actual implementation
● Integrate tests and framework to the development
environment
Overview
Usage (1)
WSClient – dinamic client
// criation
WSClient service = new WSClient (String wsdl);
// Invoking an operation
Item resposta = service.request (String operation,
Item parameters);
Usage (2)
Item – recursive structure representing
complex types
<ns: getProductByNameResponse>
<ns:return xsi:type=”ax26:Item”>
<barcode>153</barcode>
<brand>adidas</brand>
<description>A cleat</description>
<name>Soccer cleat</name>
<price>90.0</price>
<sport>soccer</sport>
</ns:return>
</ns:getProductByNameResponse>
Item response = ws.request(“getProductByName”, “Soccer
cleat”);
Item response = ws.request(“getProductByName”, “Soccer
cleat”);
Item item = response.getChild(“return”);
Item.getName(); => “return”
Item.gettagAttribute(“xsi:type”); => “ax26:Item”
Item response = ws.request(“getProductByName”, “Soccer
cleat”);
Item item = response.getChild(“return”);
Item.getName(); => “return”
Item.gettagAttribute(“xsi:type”); => “ax26:Item”
item.getChild(“barcode”).getContent(); => “153”
Item.getChild(“brand”).getContent(); => “adidas”
Item.getChild(“description”).getContent(); => “A cleat”
…
Comparison
Conclusion
WSClient code is bigger!
● Is it really??
● No, Jax-WS code uses stubs that were
previously generated =P
Demo
Next steps
● Implement new features
● REST services support
● Integration test
– Validate messages exchanged
between services
● Experimentation
Questions?
This research has received finding from:
More Information: http://ccsl.ime.usp.br/baile/VandV
Repository: https://github.com/choreos/choreos_v-v/

Mais conteúdo relacionado

Semelhante a ChorUnit Fisl 12

CHOReOS Web Services FISL Conference Brazil 2012
CHOReOS Web Services FISL Conference Brazil 2012CHOReOS Web Services FISL Conference Brazil 2012
CHOReOS Web Services FISL Conference Brazil 2012choreos
 
Defy Occassionally Connected Challenges With Smart Client Applications
Defy Occassionally Connected Challenges With Smart Client ApplicationsDefy Occassionally Connected Challenges With Smart Client Applications
Defy Occassionally Connected Challenges With Smart Client ApplicationsClint Edmonson
 
Actively looking for an opportunity to work as a challenging Dot Net Developer
Actively looking for an opportunity to work as a challenging Dot Net DeveloperActively looking for an opportunity to work as a challenging Dot Net Developer
Actively looking for an opportunity to work as a challenging Dot Net DeveloperKarthik Reddy
 
Actively looking for an opportunity to work as a challenging Dot Net Developer
Actively looking for an opportunity to work as a challenging Dot Net DeveloperActively looking for an opportunity to work as a challenging Dot Net Developer
Actively looking for an opportunity to work as a challenging Dot Net DeveloperKarthik Reddy
 
Refacoring vs Rewriting WixStores
Refacoring vs Rewriting WixStoresRefacoring vs Rewriting WixStores
Refacoring vs Rewriting WixStoresDoron Rosenstock
 
Intro to .NET for Government Developers
Intro to .NET for Government DevelopersIntro to .NET for Government Developers
Intro to .NET for Government DevelopersFrank La Vigne
 
Day Of Cloud - Windows Azure Platform
Day Of Cloud - Windows Azure PlatformDay Of Cloud - Windows Azure Platform
Day Of Cloud - Windows Azure PlatformWade Wegner
 
Netserv Technology Services
Netserv Technology ServicesNetserv Technology Services
Netserv Technology Servicessthicks14
 
20170209 dev day-websites_vs_cloudservices_vsservicefabric_scenarios
20170209 dev day-websites_vs_cloudservices_vsservicefabric_scenarios20170209 dev day-websites_vs_cloudservices_vsservicefabric_scenarios
20170209 dev day-websites_vs_cloudservices_vsservicefabric_scenariosRicardo González
 
Whats New In 2010 (Msdn & Visual Studio)
Whats New In 2010 (Msdn & Visual Studio)Whats New In 2010 (Msdn & Visual Studio)
Whats New In 2010 (Msdn & Visual Studio)Steve Lange
 
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...Amazon Web Services
 
Faites évoluer votre accès aux données avec MongoDB Stitch
Faites évoluer votre accès aux données avec MongoDB StitchFaites évoluer votre accès aux données avec MongoDB Stitch
Faites évoluer votre accès aux données avec MongoDB StitchMongoDB
 
RichardChauvetShortResume2015
RichardChauvetShortResume2015RichardChauvetShortResume2015
RichardChauvetShortResume2015Richard Chauvet
 
Refactoring to Microservices
Refactoring to MicroservicesRefactoring to Microservices
Refactoring to MicroservicesJacinto Limjap
 
Best Online Training Institute on Oracle SOA/BPEL
Best Online Training Institute on Oracle SOA/BPELBest Online Training Institute on Oracle SOA/BPEL
Best Online Training Institute on Oracle SOA/BPELVirtual Nuggets
 

Semelhante a ChorUnit Fisl 12 (20)

CHOReOS Web Services FISL Conference Brazil 2012
CHOReOS Web Services FISL Conference Brazil 2012CHOReOS Web Services FISL Conference Brazil 2012
CHOReOS Web Services FISL Conference Brazil 2012
 
Silverlight & WCF RIA
Silverlight & WCF RIASilverlight & WCF RIA
Silverlight & WCF RIA
 
Defy Occassionally Connected Challenges With Smart Client Applications
Defy Occassionally Connected Challenges With Smart Client ApplicationsDefy Occassionally Connected Challenges With Smart Client Applications
Defy Occassionally Connected Challenges With Smart Client Applications
 
Actively looking for an opportunity to work as a challenging Dot Net Developer
Actively looking for an opportunity to work as a challenging Dot Net DeveloperActively looking for an opportunity to work as a challenging Dot Net Developer
Actively looking for an opportunity to work as a challenging Dot Net Developer
 
Actively looking for an opportunity to work as a challenging Dot Net Developer
Actively looking for an opportunity to work as a challenging Dot Net DeveloperActively looking for an opportunity to work as a challenging Dot Net Developer
Actively looking for an opportunity to work as a challenging Dot Net Developer
 
MSDN Dec2007
MSDN Dec2007MSDN Dec2007
MSDN Dec2007
 
Refacoring vs Rewriting WixStores
Refacoring vs Rewriting WixStoresRefacoring vs Rewriting WixStores
Refacoring vs Rewriting WixStores
 
Industrial training in .net
Industrial training in .netIndustrial training in .net
Industrial training in .net
 
Intro to .NET for Government Developers
Intro to .NET for Government DevelopersIntro to .NET for Government Developers
Intro to .NET for Government Developers
 
Day Of Cloud - Windows Azure Platform
Day Of Cloud - Windows Azure PlatformDay Of Cloud - Windows Azure Platform
Day Of Cloud - Windows Azure Platform
 
Netserv Technology Services
Netserv Technology ServicesNetserv Technology Services
Netserv Technology Services
 
20170209 dev day-websites_vs_cloudservices_vsservicefabric_scenarios
20170209 dev day-websites_vs_cloudservices_vsservicefabric_scenarios20170209 dev day-websites_vs_cloudservices_vsservicefabric_scenarios
20170209 dev day-websites_vs_cloudservices_vsservicefabric_scenarios
 
Whats New In 2010 (Msdn & Visual Studio)
Whats New In 2010 (Msdn & Visual Studio)Whats New In 2010 (Msdn & Visual Studio)
Whats New In 2010 (Msdn & Visual Studio)
 
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
 
Faites évoluer votre accès aux données avec MongoDB Stitch
Faites évoluer votre accès aux données avec MongoDB StitchFaites évoluer votre accès aux données avec MongoDB Stitch
Faites évoluer votre accès aux données avec MongoDB Stitch
 
RichardChauvetShortResume2015
RichardChauvetShortResume2015RichardChauvetShortResume2015
RichardChauvetShortResume2015
 
SeniorNET Bhanu Resume
SeniorNET Bhanu ResumeSeniorNET Bhanu Resume
SeniorNET Bhanu Resume
 
Refactoring to Microservices
Refactoring to MicroservicesRefactoring to Microservices
Refactoring to Microservices
 
Techdays 2011 - Things I will remember
Techdays 2011 - Things I will rememberTechdays 2011 - Things I will remember
Techdays 2011 - Things I will remember
 
Best Online Training Institute on Oracle SOA/BPEL
Best Online Training Institute on Oracle SOA/BPELBest Online Training Institute on Oracle SOA/BPEL
Best Online Training Institute on Oracle SOA/BPEL
 

Último

Presentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptxPresentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptxgindu3009
 
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...ssifa0344
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...RohitNehra6
 
GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)Areesha Ahmad
 
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptxUnlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptxanandsmhk
 
VIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PVIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PPRINCE C P
 
GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)Areesha Ahmad
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSarthak Sekhar Mondal
 
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 bAsymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 bSérgio Sacani
 
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls AgencyHire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls AgencySheetal Arora
 
Physiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptxPhysiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptxAArockiyaNisha
 
Nanoparticles synthesis and characterization​ ​
Nanoparticles synthesis and characterization​  ​Nanoparticles synthesis and characterization​  ​
Nanoparticles synthesis and characterization​ ​kaibalyasahoo82800
 
Formation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disksFormation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disksSérgio Sacani
 
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.Nitya salvi
 
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 60009654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000Sapana Sha
 
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...anilsa9823
 
Biological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfBiological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfmuntazimhurra
 
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bNightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bSérgio Sacani
 
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticsPulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticssakshisoni2385
 

Último (20)

Presentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptxPresentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptx
 
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...
 
GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)
 
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptxUnlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptx
 
VIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PVIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C P
 
GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)
 
The Philosophy of Science
The Philosophy of ScienceThe Philosophy of Science
The Philosophy of Science
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
 
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 bAsymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
 
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls AgencyHire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
 
Physiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptxPhysiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptx
 
Nanoparticles synthesis and characterization​ ​
Nanoparticles synthesis and characterization​  ​Nanoparticles synthesis and characterization​  ​
Nanoparticles synthesis and characterization​ ​
 
Formation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disksFormation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disks
 
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
 
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 60009654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
 
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
 
Biological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfBiological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdf
 
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bNightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
 
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticsPulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
 

ChorUnit Fisl 12

  • 1. ChoreUnit: Testing framework for Web Services Felipe Besson, Guilherme Nogueira, Leonardo Leite {besson, gmaio, leofl}@ime.usp.br Porto Alegre, July 2nd, 2011
  • 5. Web Services Message exchange standards (xml) among systems through Internet (http)
  • 6. Web Services - Applications ● Machine-machine communication 00111100 10111010 10111101 11110000
  • 7. Web Services - Applications ● Machine-machine communication ● Integrate heterogeneous systems
  • 8. Web Services - Applications ● Machine-machine communication ● Integrate heterogeneous systems ● Business automation Comprar Z z z z z zz Z Z
  • 9. Web Services - Applications ● Machine-machine communication ● Integrate heterogeneous systems ● Business automation Buy Z z z z z zz Z Z Service provider Client
  • 10. Web Services - Applications ● Machine-machine communication ● Integrate heterogeneous systems ● Business automation ● Data access WS
  • 11. Web Services - Applications ● Machine-machine communication ● Integrate heterogeneous systems ● Business automation ● Data access and creation (colaborative) WS
  • 12. Now: billions of web pages Future: billions of web services
  • 13. SOAP
  • 14. WSDL <?xml version="1.0" encoding="UTF-8"?> <definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://hello/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://hello/" name="HelloWorldService"> <types> <xsd:schema> <xsd:import namespace="http://hello/" schemaLocation="http://localhost:8080/hello?xsd=1"></xsd:import> </xsd:schema> </types> <message name="sayHelloTo"> <part name="parameter" element="tns:sayHelloTo"></part> </message> <message name="sayHelloToResponse"> <part name="parameter" element="tns:sayHelloToResponse"></part> </message> <portType name="HelloWorld"> <operation name="sayHelloTo"> <input message="tns:sayHelloTo"></input> <output message="tns:sayHelloToResponse"></output> </operation> </portType>
  • 15. Web Services Clients in Java ● Apache Axis2 ● Jax-WS (Java EE API)
  • 16. WS Client with Jax-WS ... <portType name="StoreWS"> <operation name="searchByArtist"> <input message="tns:searchByArtist"/> <output message="tns:searchByArtistResponse"/> </operation> <operation name="searchByGenre"> <input message="tns:searchByGenre"/> <output message="tns:searchByGenreResponse"/> </operation> <operation name="searchByTitle"> <input message="tns:searchByTitle"/> <output message="tns:searchByTitleResponse"/> </operation> <operation name="purchase"> <input message="tns:purchase"/> <output message="tns:purchaseResponse"/> </operation> </portType> ...
  • 17. WS Client with Jax-WS public interface Store { List<CD> searchByArtist(String artist); List<CD> searchByGenre(String genre); List<CD> searchByTitle(String title); Boolean purchase(CD cd, Customer customer); }
  • 18. WS Client with Jax-WS $wsimport -s src http://choreos.ime.usp.br/store?wsdl
  • 19. WS Client with Jax-WS $wsimport -s src http://choreos.ime.usp.br/store?wsdl ObjectFactory   package­info    StoreWS StoreWSService CD Customer SearchByGenre           SearchByGenreResponse   SearchByTitle           SearchByTitleResponse SearchByArtist          SearchByArtistResponse   Purchase        PurchaseResponse        
  • 20. WS Client with Jax-WS StoreWSService service = new StoreWSService(); StoreWS store = service.getStoreWSPort(); List<CD> cds = store.searchByGenre("Rock");
  • 22. TDD Write test Make test pass Refactoring
  • 24. Stub creation can be a problem Process: 1. create stubs 2. add classes to project 3. understand classes Service interface changed! %$#@ Developer
  • 25. Problems when testing ● Tests must be almost completely rewritten ● Problem to integrate different services ● How to do TDD without stubs? %$#@
  • 26. Our Goals Make testing web services easy ● Interact with web services without stubs ● Easily validate the operation's responses ● Writing tests before the actual implementation ● Integrate tests and framework to the development environment
  • 28. Usage (1) WSClient – dinamic client // criation WSClient service = new WSClient (String wsdl); // Invoking an operation Item resposta = service.request (String operation, Item parameters);
  • 29. Usage (2) Item – recursive structure representing complex types <ns: getProductByNameResponse> <ns:return xsi:type=”ax26:Item”> <barcode>153</barcode> <brand>adidas</brand> <description>A cleat</description> <name>Soccer cleat</name> <price>90.0</price> <sport>soccer</sport> </ns:return> </ns:getProductByNameResponse> Item response = ws.request(“getProductByName”, “Soccer cleat”); Item response = ws.request(“getProductByName”, “Soccer cleat”); Item item = response.getChild(“return”); Item.getName(); => “return” Item.gettagAttribute(“xsi:type”); => “ax26:Item” Item response = ws.request(“getProductByName”, “Soccer cleat”); Item item = response.getChild(“return”); Item.getName(); => “return” Item.gettagAttribute(“xsi:type”); => “ax26:Item” item.getChild(“barcode”).getContent(); => “153” Item.getChild(“brand”).getContent(); => “adidas” Item.getChild(“description”).getContent(); => “A cleat” …
  • 31. Conclusion WSClient code is bigger! ● Is it really?? ● No, Jax-WS code uses stubs that were previously generated =P
  • 32. Demo
  • 33. Next steps ● Implement new features ● REST services support ● Integration test – Validate messages exchanged between services ● Experimentation
  • 34. Questions? This research has received finding from: More Information: http://ccsl.ime.usp.br/baile/VandV Repository: https://github.com/choreos/choreos_v-v/