SlideShare une entreprise Scribd logo
1  sur  14
Session 6
Module 2
Calling a Web Service from
an ASP.NET Web Page
Tasks for this Module
• How we’d ideally call a Web service from an
ASP.NET Web page
• Creating a Proxy class with wsdl.exe
– Using the Proxy class
– Examining the Proxy class
– Examining wsdl.exe
Time allotment for this module and questions: 75 minutes
Calling a Web Service from an
ASP.NET Web Page
• Ideally the developer calling a Web service from
an ASP.NET Web page should be able to work
with the Web service using the same syntax as if
she was working with a component local to the
Web server.
• Since calling a Web service involves marshalling
the ingoing parameters properly and being able to
marshal the return parameters properly, obviously
performing such actions in an ASP.NET Web
page would make the syntax differ wildly from
using a local component, where such explicit
marshalling was not needed.
Enter the Proxy Class
• In order to achieve the end goal of treating a Web
service call just like a call to a local component,
the .NET framework contains a command-line
program called wsdl.exe (Web Service
Description Language), which creates a proxy
class for a specific Web service.
• This proxy class serves as an intermediate
between the ASP.NET Web page and the Web
service. (The diagram on the next slide should
help clarify this…)
WEB
SERVER #2
Web service
WEB SERVER #1
SomePage.aspx
an ASP.NET Web page
PROXY CLASS
STEP 3: The Web service unmarshals the
incoming parameters, runs the method, and
marshals the output parameters. These are
sent back in an HTTP response.
The Role of the Proxy Class
STEP 1: The ASP.NET Web page
SomePage.aspx instantiates an instance of
the Proxy class:
Dim objClass = New ProxyClassName
And calls one of the Web service methods:
objClass.MethodName(paramList)
STEP 2: The proxy class marshals the
parameter list and makes an HTTP request to
the Web service sitting on Web Server #2
STEP 4: The proxy class unmarshals the
return parameters and passes back the result
to the ASP.NET Web page. Transaction
complete!
Creating a Proxy Class
• Creating a Proxy class involves three steps:
– Create the source code for the class, which depends
upon the WSDL of the Web service.
– Compile the class into a DLL
– Copy the DLL to the bin directory
• Once these three steps are complete we can use
our Proxy class to access Web service methods as
if they were methods of a local component!
Visual Studio.NET can perform all of these tasks with the
click of a button. We will examine how to do it via the
command-line for those who don’t have VS.NET installed.
Creating a Proxy Class
(Continued…)
• When creating a proxy class, you must specify the
WSDL for the Web service. This XML-formatted file
contains information on the incoming and outgoing
parameters. See
http://localhost/UCSDTeaching/Session6/SimpleWebService.asmx?WSDL
• Create the proxy class by simply calling wsdl.exe
with the full URL of the WSDL as the parameter:
Wsdl http://localhost/UCSDTeaching/Session6/SimpleWebService.asmx?WSDL
Creating a Proxy Class
(Continued…)
• Once we have the source code we need to compile
this code into a DLL.
• Finally, once we have the Proxy class compiled
into a DLL, we need to move it to the bin
directory, since that is the location where our
DLLs need to reside to be picked up automatically
by ASP.NET.
Run cl.demo1.txt demo
Using the Proxy Class
• Once we have the Proxy class compiled and
the DLL in the bin directory, we can use
it through an ASP.NET Web page.
Show CallSimpleWS.aspx Demo
• Note how, when examining the syntax, it is
impossible to tell if the instantiation of the
ucsd.Math class is referring to a local or
remote component. Mission accomplished!
Examining the Proxy Class
• Let’s take a moment and examine Math.cs, the
source code for the Proxy class created by
wsdl.exe
Examine Math.cs
• Note that the Proxy class is in C# - wsdl.exe
provides a command-line switch to specify what
language to use.
• Note that a class is created with the same name as
the Web service class (Math, in this example).
Also, for each public Web method there is a public
method in the Proxy class with the correct input
and output parameters.
Examining the Proxy Class
(Continued…)
• Note that in this Proxy class the Web
service is being called using the SOAP
request/response payloads.
• All of the complex behavior in hidden in
macros or through methods defined in base
classes from which our custom Math class
inherits from.
Examining wsdl.exe
• Wsdl.exe contains only one required parameter,
a URL or path to the WSDL for the Web service.
The following optional parameters can be
specified:
– /language:language – specifies what language the
Proxy class should be created in (vb/cs/js).
– /protocol:protocol – specifies the payload protocol
to be used (SOAP, HttpGet, HttpPost)
– /namespace:namespace – the namespace of the
generated Proxy class.
– /out:filename – the filename of the Proxy class.
Module 2 in Conclusion
• Ideally, we’d like to be able to call Web services
from an ASP.NET Web page in an identical fashion
to which we call local components.
• Creating a Proxy class allows us to call a Web
service’s methods as if the Web service resided
locally. The Proxy class handles the actual HTTP
request as well as the marshalling of the input and
output parameters.
• The command-line program wsdl.exe can create
the source code of the Proxy class for us based upon
a Web service’s WSDL. Once this class is compiled
and placed in the bin directory, it can be used
through an ASP.NET Web page.
Questions???
Now would be a great time
to ask questions! Don’t you
think? So ask away! 

Contenu connexe

Tendances

Tendances (20)

Mule java part-1
Mule java part-1Mule java part-1
Mule java part-1
 
Rust kafka-5-2019-unskip
Rust kafka-5-2019-unskipRust kafka-5-2019-unskip
Rust kafka-5-2019-unskip
 
Mule quartz
Mule quartz Mule quartz
Mule quartz
 
Servlets
ServletsServlets
Servlets
 
Servlet and JSP
Servlet and JSPServlet and JSP
Servlet and JSP
 
Servlet 01
Servlet 01Servlet 01
Servlet 01
 
Java mule
Java muleJava mule
Java mule
 
Java in mule part 1
Java in mule part 1Java in mule part 1
Java in mule part 1
 
Mule message enricher
Mule message enricherMule message enricher
Mule message enricher
 
Using spring task scheduler in java in mule
Using spring task scheduler in java in muleUsing spring task scheduler in java in mule
Using spring task scheduler in java in mule
 
Groovy with Mule
Groovy with MuleGroovy with Mule
Groovy with Mule
 
Composer intro
Composer introComposer intro
Composer intro
 
Basic terminologies for a developer
Basic terminologies for a developerBasic terminologies for a developer
Basic terminologies for a developer
 
Postman tests in jenkins
Postman tests in jenkinsPostman tests in jenkins
Postman tests in jenkins
 
Groovy in Mule
Groovy in MuleGroovy in Mule
Groovy in Mule
 
Node.js
Node.jsNode.js
Node.js
 
XMPP Academy #2
XMPP Academy #2XMPP Academy #2
XMPP Academy #2
 
Javascript internals
Javascript internalsJavascript internals
Javascript internals
 
Microservices in Scala: Play Framework
Microservices in Scala: Play FrameworkMicroservices in Scala: Play Framework
Microservices in Scala: Play Framework
 
Rails onCpanel
Rails onCpanelRails onCpanel
Rails onCpanel
 

En vedette

Computing net radiation from temperature variables: Improvising for under-res...
Computing net radiation from temperature variables: Improvising for under-res...Computing net radiation from temperature variables: Improvising for under-res...
Computing net radiation from temperature variables: Improvising for under-res...IOSR Journals
 
An Empirical Study of Seasonal Rainfall Effect in Calabar, Cross River State,...
An Empirical Study of Seasonal Rainfall Effect in Calabar, Cross River State,...An Empirical Study of Seasonal Rainfall Effect in Calabar, Cross River State,...
An Empirical Study of Seasonal Rainfall Effect in Calabar, Cross River State,...IOSR Journals
 
Academia dancing
Academia dancingAcademia dancing
Academia dancinglchafer
 
Advocating for breakfast program in schools ppt
Advocating for breakfast program in schools pptAdvocating for breakfast program in schools ppt
Advocating for breakfast program in schools pptJosephine Calderon
 
Half-metallic-ferrimagnetic Sr2CrWO6 and Sr2FeReO6 materials for room tempera...
Half-metallic-ferrimagnetic Sr2CrWO6 and Sr2FeReO6 materials for room tempera...Half-metallic-ferrimagnetic Sr2CrWO6 and Sr2FeReO6 materials for room tempera...
Half-metallic-ferrimagnetic Sr2CrWO6 and Sr2FeReO6 materials for room tempera...IOSR Journals
 
The Phase Theory towards the Unification of the Forces of Nature the Heart Be...
The Phase Theory towards the Unification of the Forces of Nature the Heart Be...The Phase Theory towards the Unification of the Forces of Nature the Heart Be...
The Phase Theory towards the Unification of the Forces of Nature the Heart Be...IOSR Journals
 
The characteristics of SecondaryCharged Particlesproduced in 4.5 A GeV/c 28Si...
The characteristics of SecondaryCharged Particlesproduced in 4.5 A GeV/c 28Si...The characteristics of SecondaryCharged Particlesproduced in 4.5 A GeV/c 28Si...
The characteristics of SecondaryCharged Particlesproduced in 4.5 A GeV/c 28Si...IOSR Journals
 
Chitosan capped Silver nanoparticles used as Pressure sensors
Chitosan capped Silver nanoparticles used as Pressure sensorsChitosan capped Silver nanoparticles used as Pressure sensors
Chitosan capped Silver nanoparticles used as Pressure sensorsIOSR Journals
 
A STUDY ON THE INFLUENCE OF JOB STRESS IN ORGANISATIONAL FACTORS
A STUDY ON THE INFLUENCE OF JOB STRESS IN ORGANISATIONAL FACTORSA STUDY ON THE INFLUENCE OF JOB STRESS IN ORGANISATIONAL FACTORS
A STUDY ON THE INFLUENCE OF JOB STRESS IN ORGANISATIONAL FACTORSeditor1knowledgecuddle
 
Gregorio lara actividad1_2mapac.pdf
Gregorio lara actividad1_2mapac.pdfGregorio lara actividad1_2mapac.pdf
Gregorio lara actividad1_2mapac.pdfGregory Lara
 

En vedette (14)

Computing net radiation from temperature variables: Improvising for under-res...
Computing net radiation from temperature variables: Improvising for under-res...Computing net radiation from temperature variables: Improvising for under-res...
Computing net radiation from temperature variables: Improvising for under-res...
 
An Empirical Study of Seasonal Rainfall Effect in Calabar, Cross River State,...
An Empirical Study of Seasonal Rainfall Effect in Calabar, Cross River State,...An Empirical Study of Seasonal Rainfall Effect in Calabar, Cross River State,...
An Empirical Study of Seasonal Rainfall Effect in Calabar, Cross River State,...
 
Hidrolisis garam
Hidrolisis garamHidrolisis garam
Hidrolisis garam
 
Academia dancing
Academia dancingAcademia dancing
Academia dancing
 
Basch keynote Why Healthier Students are Better Learners
Basch keynote Why Healthier Students are Better LearnersBasch keynote Why Healthier Students are Better Learners
Basch keynote Why Healthier Students are Better Learners
 
Advocating for breakfast program in schools ppt
Advocating for breakfast program in schools pptAdvocating for breakfast program in schools ppt
Advocating for breakfast program in schools ppt
 
Uta005
Uta005Uta005
Uta005
 
Half-metallic-ferrimagnetic Sr2CrWO6 and Sr2FeReO6 materials for room tempera...
Half-metallic-ferrimagnetic Sr2CrWO6 and Sr2FeReO6 materials for room tempera...Half-metallic-ferrimagnetic Sr2CrWO6 and Sr2FeReO6 materials for room tempera...
Half-metallic-ferrimagnetic Sr2CrWO6 and Sr2FeReO6 materials for room tempera...
 
키이스트 (054780) 알고리즘 기업분석 보고서 Plus
키이스트 (054780) 알고리즘 기업분석 보고서 Plus키이스트 (054780) 알고리즘 기업분석 보고서 Plus
키이스트 (054780) 알고리즘 기업분석 보고서 Plus
 
The Phase Theory towards the Unification of the Forces of Nature the Heart Be...
The Phase Theory towards the Unification of the Forces of Nature the Heart Be...The Phase Theory towards the Unification of the Forces of Nature the Heart Be...
The Phase Theory towards the Unification of the Forces of Nature the Heart Be...
 
The characteristics of SecondaryCharged Particlesproduced in 4.5 A GeV/c 28Si...
The characteristics of SecondaryCharged Particlesproduced in 4.5 A GeV/c 28Si...The characteristics of SecondaryCharged Particlesproduced in 4.5 A GeV/c 28Si...
The characteristics of SecondaryCharged Particlesproduced in 4.5 A GeV/c 28Si...
 
Chitosan capped Silver nanoparticles used as Pressure sensors
Chitosan capped Silver nanoparticles used as Pressure sensorsChitosan capped Silver nanoparticles used as Pressure sensors
Chitosan capped Silver nanoparticles used as Pressure sensors
 
A STUDY ON THE INFLUENCE OF JOB STRESS IN ORGANISATIONAL FACTORS
A STUDY ON THE INFLUENCE OF JOB STRESS IN ORGANISATIONAL FACTORSA STUDY ON THE INFLUENCE OF JOB STRESS IN ORGANISATIONAL FACTORS
A STUDY ON THE INFLUENCE OF JOB STRESS IN ORGANISATIONAL FACTORS
 
Gregorio lara actividad1_2mapac.pdf
Gregorio lara actividad1_2mapac.pdfGregorio lara actividad1_2mapac.pdf
Gregorio lara actividad1_2mapac.pdf
 

Similaire à Consume wsa

"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...
"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R..."Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...
"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...Fwdays
 
Web services in java
Web services in javaWeb services in java
Web services in javamaabujji
 
58615764 net-and-j2 ee-web-services
58615764 net-and-j2 ee-web-services58615764 net-and-j2 ee-web-services
58615764 net-and-j2 ee-web-serviceshomeworkping3
 
MERN SRTACK WEB DEVELOPMENT NODE JS EXPRESS
MERN SRTACK WEB DEVELOPMENT NODE JS EXPRESSMERN SRTACK WEB DEVELOPMENT NODE JS EXPRESS
MERN SRTACK WEB DEVELOPMENT NODE JS EXPRESSannalakshmi35
 
Using Java to implement SOAP Web Services: JAX-WS
Using Java to implement SOAP Web Services: JAX-WS�Using Java to implement SOAP Web Services: JAX-WS�
Using Java to implement SOAP Web Services: JAX-WSKatrien Verbert
 
Developing SOAP Web Services using Java
Developing SOAP Web Services using JavaDeveloping SOAP Web Services using Java
Developing SOAP Web Services using Javakrishnaviswambharan
 
Welcome to Web Services
Welcome to Web ServicesWelcome to Web Services
Welcome to Web ServicesShivinder Kaur
 
Asp.Net Ajax Component Development
Asp.Net Ajax Component DevelopmentAsp.Net Ajax Component Development
Asp.Net Ajax Component DevelopmentChui-Wen Chiu
 
Azure: Docker Container orchestration, PaaS ( Service Farbic ) and High avail...
Azure: Docker Container orchestration, PaaS ( Service Farbic ) and High avail...Azure: Docker Container orchestration, PaaS ( Service Farbic ) and High avail...
Azure: Docker Container orchestration, PaaS ( Service Farbic ) and High avail...Alexey Bokov
 
Continuous Integration e Delivery per (r)innovare lo sviluppo software e la g...
Continuous Integration e Delivery per (r)innovare lo sviluppo software e la g...Continuous Integration e Delivery per (r)innovare lo sviluppo software e la g...
Continuous Integration e Delivery per (r)innovare lo sviluppo software e la g...Amazon Web Services
 
Migrate your Existing Express Apps to AWS Lambda and Amazon API Gateway
Migrate your Existing Express Apps to AWS Lambda and Amazon API GatewayMigrate your Existing Express Apps to AWS Lambda and Amazon API Gateway
Migrate your Existing Express Apps to AWS Lambda and Amazon API GatewayAmazon Web Services
 
Rails web api 开发
Rails web api 开发Rails web api 开发
Rails web api 开发shaokun
 
Aws overview part 2(compute services)
Aws overview   part 2(compute services)Aws overview   part 2(compute services)
Aws overview part 2(compute services)Parag Patil
 
Java servlet technology
Java servlet technologyJava servlet technology
Java servlet technologyMinal Maniar
 

Similaire à Consume wsa (20)

"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...
"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R..."Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...
"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...
 
23003468463PPT.pptx
23003468463PPT.pptx23003468463PPT.pptx
23003468463PPT.pptx
 
Web services in java
Web services in javaWeb services in java
Web services in java
 
58615764 net-and-j2 ee-web-services
58615764 net-and-j2 ee-web-services58615764 net-and-j2 ee-web-services
58615764 net-and-j2 ee-web-services
 
MERN SRTACK WEB DEVELOPMENT NODE JS EXPRESS
MERN SRTACK WEB DEVELOPMENT NODE JS EXPRESSMERN SRTACK WEB DEVELOPMENT NODE JS EXPRESS
MERN SRTACK WEB DEVELOPMENT NODE JS EXPRESS
 
Using Java to implement SOAP Web Services: JAX-WS
Using Java to implement SOAP Web Services: JAX-WS�Using Java to implement SOAP Web Services: JAX-WS�
Using Java to implement SOAP Web Services: JAX-WS
 
Demystfying container-networking
Demystfying container-networkingDemystfying container-networking
Demystfying container-networking
 
Developing SOAP Web Services using Java
Developing SOAP Web Services using JavaDeveloping SOAP Web Services using Java
Developing SOAP Web Services using Java
 
Welcome to Web Services
Welcome to Web ServicesWelcome to Web Services
Welcome to Web Services
 
Asp.Net Ajax Component Development
Asp.Net Ajax Component DevelopmentAsp.Net Ajax Component Development
Asp.Net Ajax Component Development
 
Mule soft ppt 2
Mule soft ppt  2Mule soft ppt  2
Mule soft ppt 2
 
Play Framework
Play FrameworkPlay Framework
Play Framework
 
2310 b 13
2310 b 132310 b 13
2310 b 13
 
Azure: Docker Container orchestration, PaaS ( Service Farbic ) and High avail...
Azure: Docker Container orchestration, PaaS ( Service Farbic ) and High avail...Azure: Docker Container orchestration, PaaS ( Service Farbic ) and High avail...
Azure: Docker Container orchestration, PaaS ( Service Farbic ) and High avail...
 
Building Web Services
Building Web ServicesBuilding Web Services
Building Web Services
 
Continuous Integration e Delivery per (r)innovare lo sviluppo software e la g...
Continuous Integration e Delivery per (r)innovare lo sviluppo software e la g...Continuous Integration e Delivery per (r)innovare lo sviluppo software e la g...
Continuous Integration e Delivery per (r)innovare lo sviluppo software e la g...
 
Migrate your Existing Express Apps to AWS Lambda and Amazon API Gateway
Migrate your Existing Express Apps to AWS Lambda and Amazon API GatewayMigrate your Existing Express Apps to AWS Lambda and Amazon API Gateway
Migrate your Existing Express Apps to AWS Lambda and Amazon API Gateway
 
Rails web api 开发
Rails web api 开发Rails web api 开发
Rails web api 开发
 
Aws overview part 2(compute services)
Aws overview   part 2(compute services)Aws overview   part 2(compute services)
Aws overview part 2(compute services)
 
Java servlet technology
Java servlet technologyJava servlet technology
Java servlet technology
 

Dernier

Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 

Dernier (20)

Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 

Consume wsa

  • 1. Session 6 Module 2 Calling a Web Service from an ASP.NET Web Page
  • 2. Tasks for this Module • How we’d ideally call a Web service from an ASP.NET Web page • Creating a Proxy class with wsdl.exe – Using the Proxy class – Examining the Proxy class – Examining wsdl.exe Time allotment for this module and questions: 75 minutes
  • 3. Calling a Web Service from an ASP.NET Web Page • Ideally the developer calling a Web service from an ASP.NET Web page should be able to work with the Web service using the same syntax as if she was working with a component local to the Web server. • Since calling a Web service involves marshalling the ingoing parameters properly and being able to marshal the return parameters properly, obviously performing such actions in an ASP.NET Web page would make the syntax differ wildly from using a local component, where such explicit marshalling was not needed.
  • 4. Enter the Proxy Class • In order to achieve the end goal of treating a Web service call just like a call to a local component, the .NET framework contains a command-line program called wsdl.exe (Web Service Description Language), which creates a proxy class for a specific Web service. • This proxy class serves as an intermediate between the ASP.NET Web page and the Web service. (The diagram on the next slide should help clarify this…)
  • 5. WEB SERVER #2 Web service WEB SERVER #1 SomePage.aspx an ASP.NET Web page PROXY CLASS STEP 3: The Web service unmarshals the incoming parameters, runs the method, and marshals the output parameters. These are sent back in an HTTP response. The Role of the Proxy Class STEP 1: The ASP.NET Web page SomePage.aspx instantiates an instance of the Proxy class: Dim objClass = New ProxyClassName And calls one of the Web service methods: objClass.MethodName(paramList) STEP 2: The proxy class marshals the parameter list and makes an HTTP request to the Web service sitting on Web Server #2 STEP 4: The proxy class unmarshals the return parameters and passes back the result to the ASP.NET Web page. Transaction complete!
  • 6. Creating a Proxy Class • Creating a Proxy class involves three steps: – Create the source code for the class, which depends upon the WSDL of the Web service. – Compile the class into a DLL – Copy the DLL to the bin directory • Once these three steps are complete we can use our Proxy class to access Web service methods as if they were methods of a local component! Visual Studio.NET can perform all of these tasks with the click of a button. We will examine how to do it via the command-line for those who don’t have VS.NET installed.
  • 7. Creating a Proxy Class (Continued…) • When creating a proxy class, you must specify the WSDL for the Web service. This XML-formatted file contains information on the incoming and outgoing parameters. See http://localhost/UCSDTeaching/Session6/SimpleWebService.asmx?WSDL • Create the proxy class by simply calling wsdl.exe with the full URL of the WSDL as the parameter: Wsdl http://localhost/UCSDTeaching/Session6/SimpleWebService.asmx?WSDL
  • 8. Creating a Proxy Class (Continued…) • Once we have the source code we need to compile this code into a DLL. • Finally, once we have the Proxy class compiled into a DLL, we need to move it to the bin directory, since that is the location where our DLLs need to reside to be picked up automatically by ASP.NET. Run cl.demo1.txt demo
  • 9. Using the Proxy Class • Once we have the Proxy class compiled and the DLL in the bin directory, we can use it through an ASP.NET Web page. Show CallSimpleWS.aspx Demo • Note how, when examining the syntax, it is impossible to tell if the instantiation of the ucsd.Math class is referring to a local or remote component. Mission accomplished!
  • 10. Examining the Proxy Class • Let’s take a moment and examine Math.cs, the source code for the Proxy class created by wsdl.exe Examine Math.cs • Note that the Proxy class is in C# - wsdl.exe provides a command-line switch to specify what language to use. • Note that a class is created with the same name as the Web service class (Math, in this example). Also, for each public Web method there is a public method in the Proxy class with the correct input and output parameters.
  • 11. Examining the Proxy Class (Continued…) • Note that in this Proxy class the Web service is being called using the SOAP request/response payloads. • All of the complex behavior in hidden in macros or through methods defined in base classes from which our custom Math class inherits from.
  • 12. Examining wsdl.exe • Wsdl.exe contains only one required parameter, a URL or path to the WSDL for the Web service. The following optional parameters can be specified: – /language:language – specifies what language the Proxy class should be created in (vb/cs/js). – /protocol:protocol – specifies the payload protocol to be used (SOAP, HttpGet, HttpPost) – /namespace:namespace – the namespace of the generated Proxy class. – /out:filename – the filename of the Proxy class.
  • 13. Module 2 in Conclusion • Ideally, we’d like to be able to call Web services from an ASP.NET Web page in an identical fashion to which we call local components. • Creating a Proxy class allows us to call a Web service’s methods as if the Web service resided locally. The Proxy class handles the actual HTTP request as well as the marshalling of the input and output parameters. • The command-line program wsdl.exe can create the source code of the Proxy class for us based upon a Web service’s WSDL. Once this class is compiled and placed in the bin directory, it can be used through an ASP.NET Web page.
  • 14. Questions??? Now would be a great time to ask questions! Don’t you think? So ask away! 