SlideShare a Scribd company logo
1 of 7
Download to read offline
Tutorial: Using PHP, SOAP and WSDL Technology to
access a public web service.

** Created by Snehal Monteiro for CIS 764 **

In this small tutorial we will access the Kansas Department of Revenue's web service
to get sales tax information for a particular area in Kansas. We just send the Zip Code
of a particular area in Kansas to the web service and it returns the sales tax for that
region.

Pre-requisites:

1)The server should support PHP. Since the server for the CIS Department supports
PHP scripts, this would not be a problem for us.

2)All our html and php documents will be saved in the public_html folder in the U
drive.

3)A text editor like notepad where we write html and php code.

Tutorial Steps:

There are 4 major steps involved:

1) Creating a simple HTML page , which has just one text box to enter the Zip Code.

2) Download the nusoap.php document and save it the public_html folder.

3)Create the getTax.php which will access the web service using WSDL(Web Service
Desription Language) file published by the Kansas Department of Revenue.

4)Run the web application.



1)Creating a simple HTML page , which has just one text box to
enter the Zip Code:
Copy paste or type the following code in a note-pad and save the file as getTax.html
in the public_html folder.
<html>
<head>
<title>Get Tax Details</title>
</head>
<body>
<b><font size="4">Enter Zip Code of a region in Kansas and hit submit to get
sales tax details for that particular region:</font></b>
<form name="form1" method="post" action="getTaxDetails.php">
<p>Enter Zip Code:
<input name="Zip" type="text" id="Zip" size="20">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
</html>



After opening the getTax.html page in the browser you can see the following web
page:
2)Download the nusoap.php document and save it the public_html
folder:
Here we access nusoap.php which is open-source and available freely. We reference
the nusoap.php document in our getTaxDetails.php.
1] Click on this link: http://dietrich.ganx4.com/nusoap/index.php

2] Navigate through the web-site. Click on the nusoap-0.7.3.zip file and download it.

3] Unzip the nusoap-0.7.3.zip file.

4]Then open the folder nusoap-0.7.3. Then open the lib folder. You will see many php
documents inside the lib folder.Copy the file named nusoap.php and paste it in the
public_html folder.
nusoap-0.7.3.-> lib-> nusoap.php



3)Create the getTax.php which will access the web service using
WSDL(Web Service Desription Language) file published by the
Kansas Department of Revenue:
Copy paste or type the following code in note-pad and save the file as
getTaxDetails.php in your public_html folder:

------------- Code starts here----------------

<?
# Query the Kansas Department of Revenue and Retrieve Tax Rates


# First, we need to bring in the library file. The require_once command will
make sure the functions are only added once into our script.
require_once('nusoap.php');

#Next step we will define where the WSDL is located and create an instance of
the soapclient class to access the web service.
$wsdl="http://services.taxwatch.biz/rates/kansas/sstp.wsdl";
$client=new soapclient($wsdl, 'wsdl');

$zip = $_POST['Zip'];
# We then send in two parameters through the SOAP client: the zipcode and date
$param=array(
'intZipCode' => $zip,
'dtPaymentDate' => '2007-10-19'
);

# Finally, the web service responds with the result of our query wrapped in a
SOAP message.
$result = $client->call('GetFIPSBy5ZipOnly', $param);

$FIPSRecordList = $result['FIPSRecordList'];
print_r($result);

$stateGeneralTaxRateIntrastate = $FIPSRecordList[0]['strGeneralTaxRateIntrastate'];
$countyGeneralTaxRateIntrastate =
$FIPSRecordList[1]['strGeneralTaxRateIntrastate'];
$cityGeneralTaxRateIntrastate = $FIPSRecordList[2]['strGeneralTaxRateIntrastate'];

$GeneralTaxRateIntrastate = $stateGeneralTaxRateIntrastate +
$countyGeneralTaxRateIntrastate + $cityGeneralTaxRateIntrastate;

echo "<p>Total General Tax Rate for Zip Code $zip = " . $GeneralTaxRateIntrastate .
'%</p>';

?>

------------------------- Code ends here---------------------------




4)Run the web application:
 Any files to be accessed by the web server must be publically readable, but none of your PHP
files (nor the directory containing them) may be group or publically writable. Following are the
commands you can use for setting the permissions in linux:

chmod 644 public_html/getTaxDetails.php
chmod 644 public_html/nusoap.php
Now type the getTax.html URL in your browser.You will see the following page:




Then enter any Zip Code from Kansas in the text box:
Then you hit submit.You should get the following output: The highlighted part
shows the Sales Tax as 6.3 % for Zip Code 66502
In this Tutorial we learnt that accessing and using a web-service is very easy.

Key Concepts:
1) Web services allow you to share data across many platforms and hardware
configurations. For example, you can create a Java web service and someone else can
consume it using a .NET client without having to learn one line of Java code.

2) WSDL stands for Web Services Description Language, an XML file which
describes the interface of a web service. We used the WSDL file published by the
Kansas Department of Revenue. We observe the parameters in this WSDL and write
our php script accordingly.

3) SOAP is designed as an XML wrapper for web services requests and
responses.NuSOAP is a powerful API developed for the PHP platform.The required
libraries are contained in a file called nusoap.php.

4) In our tutorial we used SOAP (nusoap.php) to access a web-service, which is
described as a WSDL published by the Kansas Department of Revenue.

5) Description of the Kansas Department of Revenue web service can be found out at
the following link
https://www.taxwatch.biz/cgi-win/Kansas/TxWStateSite.exe/Lookups

More Related Content

What's hot

What's hot (18)

HTTP
HTTPHTTP
HTTP
 
CNIT 124: Ch 5: Information Gathering
CNIT 124: Ch 5: Information GatheringCNIT 124: Ch 5: Information Gathering
CNIT 124: Ch 5: Information Gathering
 
Mail servers, Mail servers services in bangalore.
Mail servers, Mail servers services in bangalore.Mail servers, Mail servers services in bangalore.
Mail servers, Mail servers services in bangalore.
 
What's up with HTTP?
What's up with HTTP?What's up with HTTP?
What's up with HTTP?
 
HTTP & HTML & Web
HTTP & HTML & WebHTTP & HTML & Web
HTTP & HTML & Web
 
Apache Server Tutorial
Apache Server TutorialApache Server Tutorial
Apache Server Tutorial
 
Http methods
Http methodsHttp methods
Http methods
 
HTTP - The Protocol of Our Lives
HTTP - The Protocol of Our LivesHTTP - The Protocol of Our Lives
HTTP - The Protocol of Our Lives
 
Integration between Filebeat and logstash
Integration between Filebeat and logstash Integration between Filebeat and logstash
Integration between Filebeat and logstash
 
Lesson 19 upload your page
Lesson 19 upload your pageLesson 19 upload your page
Lesson 19 upload your page
 
Mule esb db_1
Mule esb db_1Mule esb db_1
Mule esb db_1
 
Introduction to Rest Protocol
Introduction to Rest ProtocolIntroduction to Rest Protocol
Introduction to Rest Protocol
 
Frequently Used Terms Related to cPanel
Frequently Used Terms Related to cPanelFrequently Used Terms Related to cPanel
Frequently Used Terms Related to cPanel
 
Mule esb db_2
Mule esb db_2Mule esb db_2
Mule esb db_2
 
Foxtrot C2: A Journey of Payload Delivery
Foxtrot C2: A Journey of Payload DeliveryFoxtrot C2: A Journey of Payload Delivery
Foxtrot C2: A Journey of Payload Delivery
 
Get and post methods
Get and post methodsGet and post methods
Get and post methods
 
Web Server Administration
Web Server AdministrationWeb Server Administration
Web Server Administration
 
World Wide Web
World Wide WebWorld Wide Web
World Wide Web
 

Viewers also liked

Viewers also liked (7)

indesign_cs3_scripting_tutorial
indesign_cs3_scripting_tutorialindesign_cs3_scripting_tutorial
indesign_cs3_scripting_tutorial
 
Tutorial5
Tutorial5Tutorial5
Tutorial5
 
VGEGIS%20Training%20Tutorial
VGEGIS%20Training%20TutorialVGEGIS%20Training%20Tutorial
VGEGIS%20Training%20Tutorial
 
file17749
file17749file17749
file17749
 
Icicles
IciclesIcicles
Icicles
 
e6
e6e6
e6
 
Lab_2_2009
Lab_2_2009Lab_2_2009
Lab_2_2009
 

Similar to Monteiro_WS

How to upload Laravel Project on Shared Hosting With CPanel.pdf
How to upload Laravel Project on Shared Hosting With CPanel.pdfHow to upload Laravel Project on Shared Hosting With CPanel.pdf
How to upload Laravel Project on Shared Hosting With CPanel.pdfHost It Smart
 
PHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniterPHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniterKHALID C
 
Chapter 1
Chapter 1Chapter 1
Chapter 1Uma Sam
 
Windows Hosting Documentation
Windows Hosting DocumentationWindows Hosting Documentation
Windows Hosting Documentationwebhostingguy
 
Anthony McKeown Drupal Presentation
Anthony McKeown Drupal PresentationAnthony McKeown Drupal Presentation
Anthony McKeown Drupal PresentationTony McKeown
 
Website & Internet + Performance testing
Website & Internet + Performance testingWebsite & Internet + Performance testing
Website & Internet + Performance testingRoman Ananev
 
Implementing Your Full Stack App with MongoDB Stitch (Tutorial)
Implementing Your Full Stack App with MongoDB Stitch (Tutorial)Implementing Your Full Stack App with MongoDB Stitch (Tutorial)
Implementing Your Full Stack App with MongoDB Stitch (Tutorial)MongoDB
 
SH 2 - SES 1 - Stitch_Workshop_TLV.pptx
SH 2 - SES 1 - Stitch_Workshop_TLV.pptxSH 2 - SES 1 - Stitch_Workshop_TLV.pptx
SH 2 - SES 1 - Stitch_Workshop_TLV.pptxMongoDB
 
Mazda siv - web services
Mazda   siv - web servicesMazda   siv - web services
Mazda siv - web servicesOlivier Lépine
 
shobhit training report (3) (4).pdf report
shobhit training report (3) (4).pdf reportshobhit training report (3) (4).pdf report
shobhit training report (3) (4).pdf reportpoojaranga2911
 
Introduction To Drupal
Introduction To DrupalIntroduction To Drupal
Introduction To DrupalLauren Roth
 
Devry gsp 215 week 7 i lab networking and a tiny web server new
Devry gsp 215 week 7 i lab networking and a tiny web server newDevry gsp 215 week 7 i lab networking and a tiny web server new
Devry gsp 215 week 7 i lab networking and a tiny web server newwilliamethan912
 
New Flash Builder 4 WSDL and HTTP Connectors
New Flash Builder 4 WSDL and HTTP ConnectorsNew Flash Builder 4 WSDL and HTTP Connectors
New Flash Builder 4 WSDL and HTTP Connectorsrtretola
 

Similar to Monteiro_WS (20)

How to upload Laravel Project on Shared Hosting With CPanel.pdf
How to upload Laravel Project on Shared Hosting With CPanel.pdfHow to upload Laravel Project on Shared Hosting With CPanel.pdf
How to upload Laravel Project on Shared Hosting With CPanel.pdf
 
unit1 part 1 sem4 php.docx
unit1 part 1 sem4 php.docxunit1 part 1 sem4 php.docx
unit1 part 1 sem4 php.docx
 
PHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniterPHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniter
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
Web hosting Free Hosting
Web hosting Free HostingWeb hosting Free Hosting
Web hosting Free Hosting
 
Web hosting get start online
Web hosting get start onlineWeb hosting get start online
Web hosting get start online
 
Windows Hosting Documentation
Windows Hosting DocumentationWindows Hosting Documentation
Windows Hosting Documentation
 
Anthony McKeown Drupal Presentation
Anthony McKeown Drupal PresentationAnthony McKeown Drupal Presentation
Anthony McKeown Drupal Presentation
 
Its3 Drupal
Its3 DrupalIts3 Drupal
Its3 Drupal
 
Website & Internet + Performance testing
Website & Internet + Performance testingWebsite & Internet + Performance testing
Website & Internet + Performance testing
 
Implementing Your Full Stack App with MongoDB Stitch (Tutorial)
Implementing Your Full Stack App with MongoDB Stitch (Tutorial)Implementing Your Full Stack App with MongoDB Stitch (Tutorial)
Implementing Your Full Stack App with MongoDB Stitch (Tutorial)
 
SH 2 - SES 1 - Stitch_Workshop_TLV.pptx
SH 2 - SES 1 - Stitch_Workshop_TLV.pptxSH 2 - SES 1 - Stitch_Workshop_TLV.pptx
SH 2 - SES 1 - Stitch_Workshop_TLV.pptx
 
Learn ASP
Learn ASPLearn ASP
Learn ASP
 
Mazda siv - web services
Mazda   siv - web servicesMazda   siv - web services
Mazda siv - web services
 
Its3 Drupal
Its3 DrupalIts3 Drupal
Its3 Drupal
 
shobhit training report (3) (4).pdf report
shobhit training report (3) (4).pdf reportshobhit training report (3) (4).pdf report
shobhit training report (3) (4).pdf report
 
Tech talk php_cms
Tech talk php_cmsTech talk php_cms
Tech talk php_cms
 
Introduction To Drupal
Introduction To DrupalIntroduction To Drupal
Introduction To Drupal
 
Devry gsp 215 week 7 i lab networking and a tiny web server new
Devry gsp 215 week 7 i lab networking and a tiny web server newDevry gsp 215 week 7 i lab networking and a tiny web server new
Devry gsp 215 week 7 i lab networking and a tiny web server new
 
New Flash Builder 4 WSDL and HTTP Connectors
New Flash Builder 4 WSDL and HTTP ConnectorsNew Flash Builder 4 WSDL and HTTP Connectors
New Flash Builder 4 WSDL and HTTP Connectors
 

More from tutorialsruby

&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>tutorialsruby
 
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>tutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0tutorialsruby
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269tutorialsruby
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269tutorialsruby
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008tutorialsruby
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008tutorialsruby
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheetstutorialsruby
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheetstutorialsruby
 

More from tutorialsruby (20)

&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
 
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0
 
xhtml_basics
xhtml_basicsxhtml_basics
xhtml_basics
 
xhtml_basics
xhtml_basicsxhtml_basics
xhtml_basics
 
xhtml-documentation
xhtml-documentationxhtml-documentation
xhtml-documentation
 
xhtml-documentation
xhtml-documentationxhtml-documentation
xhtml-documentation
 
CSS
CSSCSS
CSS
 
CSS
CSSCSS
CSS
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
 
HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
 
HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
 

Recently uploaded

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
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
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
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
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
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 

Recently uploaded (20)

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
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
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 

Monteiro_WS

  • 1. Tutorial: Using PHP, SOAP and WSDL Technology to access a public web service. ** Created by Snehal Monteiro for CIS 764 ** In this small tutorial we will access the Kansas Department of Revenue's web service to get sales tax information for a particular area in Kansas. We just send the Zip Code of a particular area in Kansas to the web service and it returns the sales tax for that region. Pre-requisites: 1)The server should support PHP. Since the server for the CIS Department supports PHP scripts, this would not be a problem for us. 2)All our html and php documents will be saved in the public_html folder in the U drive. 3)A text editor like notepad where we write html and php code. Tutorial Steps: There are 4 major steps involved: 1) Creating a simple HTML page , which has just one text box to enter the Zip Code. 2) Download the nusoap.php document and save it the public_html folder. 3)Create the getTax.php which will access the web service using WSDL(Web Service Desription Language) file published by the Kansas Department of Revenue. 4)Run the web application. 1)Creating a simple HTML page , which has just one text box to enter the Zip Code: Copy paste or type the following code in a note-pad and save the file as getTax.html in the public_html folder.
  • 2. <html> <head> <title>Get Tax Details</title> </head> <body> <b><font size="4">Enter Zip Code of a region in Kansas and hit submit to get sales tax details for that particular region:</font></b> <form name="form1" method="post" action="getTaxDetails.php"> <p>Enter Zip Code: <input name="Zip" type="text" id="Zip" size="20"> </p> <p> <input type="submit" name="Submit" value="Submit"> </p> </form> </html> After opening the getTax.html page in the browser you can see the following web page:
  • 3. 2)Download the nusoap.php document and save it the public_html folder: Here we access nusoap.php which is open-source and available freely. We reference the nusoap.php document in our getTaxDetails.php. 1] Click on this link: http://dietrich.ganx4.com/nusoap/index.php 2] Navigate through the web-site. Click on the nusoap-0.7.3.zip file and download it. 3] Unzip the nusoap-0.7.3.zip file. 4]Then open the folder nusoap-0.7.3. Then open the lib folder. You will see many php documents inside the lib folder.Copy the file named nusoap.php and paste it in the public_html folder. nusoap-0.7.3.-> lib-> nusoap.php 3)Create the getTax.php which will access the web service using WSDL(Web Service Desription Language) file published by the Kansas Department of Revenue: Copy paste or type the following code in note-pad and save the file as getTaxDetails.php in your public_html folder: ------------- Code starts here---------------- <? # Query the Kansas Department of Revenue and Retrieve Tax Rates # First, we need to bring in the library file. The require_once command will make sure the functions are only added once into our script. require_once('nusoap.php'); #Next step we will define where the WSDL is located and create an instance of the soapclient class to access the web service. $wsdl="http://services.taxwatch.biz/rates/kansas/sstp.wsdl"; $client=new soapclient($wsdl, 'wsdl'); $zip = $_POST['Zip'];
  • 4. # We then send in two parameters through the SOAP client: the zipcode and date $param=array( 'intZipCode' => $zip, 'dtPaymentDate' => '2007-10-19' ); # Finally, the web service responds with the result of our query wrapped in a SOAP message. $result = $client->call('GetFIPSBy5ZipOnly', $param); $FIPSRecordList = $result['FIPSRecordList']; print_r($result); $stateGeneralTaxRateIntrastate = $FIPSRecordList[0]['strGeneralTaxRateIntrastate']; $countyGeneralTaxRateIntrastate = $FIPSRecordList[1]['strGeneralTaxRateIntrastate']; $cityGeneralTaxRateIntrastate = $FIPSRecordList[2]['strGeneralTaxRateIntrastate']; $GeneralTaxRateIntrastate = $stateGeneralTaxRateIntrastate + $countyGeneralTaxRateIntrastate + $cityGeneralTaxRateIntrastate; echo "<p>Total General Tax Rate for Zip Code $zip = " . $GeneralTaxRateIntrastate . '%</p>'; ?> ------------------------- Code ends here--------------------------- 4)Run the web application: Any files to be accessed by the web server must be publically readable, but none of your PHP files (nor the directory containing them) may be group or publically writable. Following are the commands you can use for setting the permissions in linux: chmod 644 public_html/getTaxDetails.php chmod 644 public_html/nusoap.php
  • 5. Now type the getTax.html URL in your browser.You will see the following page: Then enter any Zip Code from Kansas in the text box:
  • 6. Then you hit submit.You should get the following output: The highlighted part shows the Sales Tax as 6.3 % for Zip Code 66502
  • 7. In this Tutorial we learnt that accessing and using a web-service is very easy. Key Concepts: 1) Web services allow you to share data across many platforms and hardware configurations. For example, you can create a Java web service and someone else can consume it using a .NET client without having to learn one line of Java code. 2) WSDL stands for Web Services Description Language, an XML file which describes the interface of a web service. We used the WSDL file published by the Kansas Department of Revenue. We observe the parameters in this WSDL and write our php script accordingly. 3) SOAP is designed as an XML wrapper for web services requests and responses.NuSOAP is a powerful API developed for the PHP platform.The required libraries are contained in a file called nusoap.php. 4) In our tutorial we used SOAP (nusoap.php) to access a web-service, which is described as a WSDL published by the Kansas Department of Revenue. 5) Description of the Kansas Department of Revenue web service can be found out at the following link https://www.taxwatch.biz/cgi-win/Kansas/TxWStateSite.exe/Lookups