Home arrow Web Services arrow Page 3 - Web Services for K-12 Education Systems
WEB SERVICES

Web Services for K-12 Education Systems


Web Services (WS) are now a reality for many enterprises and have moved beyond the hype stage. Many enterprises have built Web Services pilot projects, proving that WS can reduce integration and development cost substantially and enhance customer and supplier integration. This article will walk you through the Web Service development process using PHP, MySQL, VB, NuSOAP or XML-RPC. Before going further, you can download and install the client (the example, discussed in this article) from here and start playing with it for a better understanding the topics of this article.

Author Info:
By: Ahm Asaduzzaman
Rating: 5 stars5 stars5 stars5 stars5 stars / 18
February 18, 2004
TABLE OF CONTENTS:
  1. · Web Services for K-12 Education Systems
  2. · Requirement Analysis
  3. · Walkthrough Example
  4. · Conclusion

print this article
SEARCH DEVARTICLES

Web Services for K-12 Education Systems - Walkthrough Example
(Page 3 of 4 )

I. Start a VB project with Visual Studio, from project->Reference check Microsoft SOAP Type Library V3.0. Create a SOAP class Listing 1. We will use this class to create SOAP messages.


Private Sub GetDataOnConnect()    
‘ On connect display 
list of activities to choose 
Dim k 
As String
Dim soap 
As SOAPSender
Set soap 
= New SOAPSender
soap
.BeginBodyPart "fnWebService"http://az.homeunix.com/as/k12.php   
‘function name
soap.BeginElement " ActivityTitle ", ""
soap.WriteText ActivityTitle.text
soap.EndElement
soap.EndBodyPart
soap.SoapAction = " http://az.homeunix.com/as/k12.php " 
‘ Web Service end point
soap.ServiceUrl = " http://az.homeunix.com/as/k12.php "
soap.Send
DisplayData k
End Sub
 
Private Sub DisplayData(ByVal response As String)
On Error 
GoTo L1
Dim mTemp 
As String
Dim doc 
As MSXML2.DOMDocument
Set doc 
= New MSXML2.DOMDocument
If doc
.loadXML(responseThen
‘ Parse the response text   
mTemp 
doc.selectSingleNode("//noname").text
WebBrowser1
.Visible True
End If
Else
MsgBox 
"Failed to load the response text: " vbCrLf response
End If
Exit Sub
L1
:
MsgBox 
"Content for this activity title not available now, please check back later.",   vbInformation"Empty Activity"
End Sub    

II. Above code will parse SOAP envelope and display list of available (or subscribed) activities as soon as it connects to Web Service.
Server:


<?php
require_once
('nusoap.php');
$s 
= new soap_server;
$s
->register('fnWebService');
function fnWebService 
($name){
 
$link
=mysql_connect('localhost','root','') or die (mysql_error());
mysql_select_db
('db_webservice') or die (mysql_error());
$arrGrSub
=explode('/'$name); 
$s
=$arrGrSub[1];
$g
=$arrGrSub[0];
$query
="SELECT * FROM astabquestionentry ORDER BY qeLessonName";
 
if 
($name!=''){
$query
="SELECT * FROM astabquestionentry where qeLessonName='".$name."' LIMIT 1";
$result
=mysql_query($query) or die (mysql_error());
while 
($row mysql_fetch_array($resultMYSQL_ASSOC)) {
$k
='[ws:] http://localhost/ws.php?ln='.$row["qeLessonName"].'&r=NO&attempt='.$row["qeAttempt"].'&tq='.$row["qeTotalNumberOfQuestion"].'&ActType='.$row["qeActivity"].
'&strip=localhost&dbuser=root&dbpassword=
&mydatabase=db_webservice'
;
//ws.php  script is responsible to display items with description. This feature is not discussed in the article.
 
mysql_free_result($result);
mysql_close
($link);
return $k
;
}
}
$result
=mysql_query($query) or die (mysql_error());
while 
($row mysql_fetch_array($resultMYSQL_ASSOC)) {
$k
=$k.$row["qeLessonName"].'nr'.' Description:'.strtolower(ucwords($row["qeObjective"] .'    '.$row["qeSubSkill"])).' nr';
}
mysql_free_result
($result);
mysql_close
($link);
return $k
;
}
$s
->service($HTTP_RAW_POST_DATA);





blog comments powered by Disqus
WEB SERVICES ARTICLES

- Dealing with Loose Coupling in a Service-Ori...
- Loose Coupling in a Service-Oriented Archite...
- Safety, Idempotence, and the Resource-Orient...
- The Resource-Oriented Architecture in Action
- Features of the Resource-Oriented Architectu...
- The Resource-Oriented Architecture
- Getting Started with Flex
- Automated Billing and Faxing for the Web
- An Introduction to Web Services
- The Foundations of Web Services: From Novice...
- Web Services Reengineering: Finishing Touches
- Fault Handling with Web Services
- Flow and Web Services
- Process Lifecycles and Web Services
- Business Processes and Web Services

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials