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 Access Kansas Sales Tax Rates via PHP SOAP

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 Access Kansas Sales Tax Rates via PHP SOAP (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

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Recently uploaded (20)

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

Access Kansas Sales Tax Rates via PHP SOAP

  • 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