SlideShare ist ein Scribd-Unternehmen logo
1 von 41
Downloaden Sie, um offline zu lesen
Web Service Overview
Function
              Function คือ โปรแกรมย่อยชนิดหนึง ซึงอาจจะมีการรับค่ามาจาก
              โปรแกรมหลักทีเรี ยกใช้ Function นันๆ จากนันจะมีการประมวลผลคําสังใน
                                                (        (
              Function พร้ อมกับจะมีการคืนค่ากลับไปทีโปรแกรมหลักทีเรี ยกใช้ งาน
              Function นันๆ
                         (                           Main Program 1
                                                     …
Function                                          Call function cal(2)
Function cal (number As Integer)                     importing result.
Dim result As Integer                             write result.
result = number ** 2                              …
return result                                    Main Program 2
End Function                                     …
                                                 Call function cal(4)
                                                    importing result.
                                                 write result.
                                                 …
Web Application
   1.Static




2.Dynamic
               3.Web
               Service
Web Application ยุคที& 1 : Static Web Page


http://www.prapoj.com/current.html
                                HTTP request


                                 HTTP response

       Web Browser                               Web Server



                                                 Web Pages
Web Application ยุคที& 2 : Dynamic Web Page
                                      .asp,.jsp,.php,.pl…

http://www.prapoj.com/index.asp
                                  HTTP request
                                                                        SQL Statement

                                   HTTP response
                                                      Web Server
   Web Browser
                                                                                Data




                                                            Web Pages        Database
Web Application ยุคที& 3 : Web Service Technology
                                      .asp,.php,.pl,jsp
                                             …                                          st                Web Service
http://www.prapoj.com/index.aspx                                         er HTT P reque
                                                                 S OAP ov
                                                                                                  Web Server
                                   HTTP request                        SOA
                                                                             P ov
                                   HTTP response                                 er H
                                                                                      T   TP
                                                          Web Server                         re   que
   Web Browser                                                                                       st

                                                                                                           Web Service

                                                                                                   Web Server
Distributed Computing
Programming World!



  Microsoft   Java
   World      World
Distributed Computing

        VB                        Java
                    C#
                                                Java
ASP                      Java




             .dll                        EJB


 .NET                      Java                    Java
             C++                         Java
Web Service

        VB                                Java
                           C#
                                                               Java
ASP                              Java

                                            Web Service
             Web Service
                     WSDL                               WSDL
              .dll                           EJB


 .NET                              Java                           Java
             C++                                 Java
What is Web Service?
Web Service?
Application หรื อโปรแกรม(หรื อ Function)ซึงทําหน้ าทีอย่างใด
อย่างหนึงในลักษณะให้ บริการ(Service) โดยจะถูกเรี ยกใช้ งานจาก
Application หรื อโปรแกรมอืนๆผ่านทาง Web (Web Server โดย
อาศัย SOAP Protocol) การให้ บริ การของ Web Service นัน จะมี (
เอกสารทีอธิบายคุณสมบัตของบริ การกํากับไว้ (WSDL) และมีการ
                           ิ
นําเสนอให้ สาธารณชนรับทราบ(UDDI) ผู้ใช้ บริ การจึงสามารถทีจะ
ค้ นหาบริ การของ Web Service ต่างๆได้ โดยไม่จําเป็ นต้ องรู้ทีอยู่
จริ งของ Application หรื อโปรแกรมทีให้ บริการ Web Service นันๆ  (
Web Service Definition
Web services are the fundamental building blocks in the move to distributed
computing on the Internet
Open standards and the focus on communication and collaboration among
people and applications have created an environment where XML Web
Service are becoming the platform for application Integration
Applications are constructed using multiple XML Web Services from various
sources that work together regardless of where they reside or how they
were implemented
One of the primary advantages of the XML Web Services architecture is
that it allows programs written in different languages on different platforms
to communicate with each other in a standards-based way
Web Service Concept
“Web Services are self-contained, self-describing modular applications that
can be published, discovered and invoked across the Web”

                      2




      WSDL




       3                    4    SOAP Request

                                                                                    1
                                                                             WSDL       Web Service
                                                SOAP Response

                                                                Web Server              Component


                                                            5
ขันตอนในการพัฒนา Web Service
   :
สร้ าง Web Service โดยการพัฒนาแบบ Manual หรื อใช้ เครืองมือ
(Tool) ในการ Generate เราจะได้ เอกสาร WSDL บรรยาย
คุณลักษณะของ Web Service นันๆ  (
ทําการ Publish ในส่วนของ Web Service ไปที UDDI เพือให้
บุคคลทัวไปสามารถค้ นหา Web Service ทีเราพัฒนาขึ (นมาได้
ขันตอนในการเรี ยกใช้ Web Service
   :
ค้ นหาบริ การ Web Service ผ่าน UDDI ซึงทําให้ เราได้ ข้อมูล
เกียวกับประเภทบริ การ ทีตังของบริการ และเอกสาร WSDL
                             (
บรรยายคุณลักษณะของบริการนันๆ      (
ติดต่อขอใช้ บริ การ Web Service โดยใช้ SOAP Protocol (SOAP
Request)ด้ วยการเขียนโปรแกรมขึ (นมาเรี ยกใช้ Method ของ Web
Service นันๆโดยอาศัยข้ อมูลทีอยูในเอกสาร WSDL
              (                     ่
ผู้ให้ บริ การส่งผลลัพธ์กลับมาในรูปของ XML(SOAP Response)
Standards Behind Web services
 Simple Object Access Protocol (SOAP) is based on XML and
 Hypertext Transport Protocol. It provides a way for applications —
 including those running on different operating systems — to
 communicate and work together through remote procedure calls
 implemented via HTTP
 Universal Description, Discovery and Integration (UDDI) describes
 how to publish and discover information about Web services
 applications. It is a Web-based directory where someone can search
 for particular Web services and what they do
Standards Behind Web services
 Web Services Description Language (WSDL), based on XML,
 describes the kinds of software applications, or services, available
 on a particular network. Once someone develops a Web service,
 they can publish its description and link in a special UDDI repository.
 When someone wants to use the service, they request the WSDL file
 so they can determine its location, function calls and how to get to
 them. They use that information to construct a SOAP request to a
 server
 eXtensible Markup Language is a streamlined version of Standard
 Generalized Markup Language, developed by the International
 Organization for Standardization to define the structures of different
 types of electronic documents. XML can be used to store any kind of
 structured language and encapsulate data so it can be shared
 between otherwise incompatible computer systems
Web Service Components
Web Service = WSDL + UDDI + SOAP

                                UDDI
                        UDDI Business Registry

               h
         S earc




                                        Publish
              Consume                              Web
                                                  Service
                                                     WSDL
              SOAP
WSDL
Web Service Description Language เป็ นภาษาทีใช้ อธิบาย
คุณลักษณะของ Web Service และวิธีในการติดต่อกับ Web Service
โดยใช้ ไวยากรณ์ของภาษา XML
WSDL
WSDL can be used to describe several primary qualities of a Web Service
message:                   1

   The address Location of WSDL
   The Web Service name 2
   The Operation(Function/Method) name     3

   The Input/Output parameters
                           4

   The type of data being sent between client and server during a Web Service
   message exchange
                      5
WSDL
WSDL is used to describe
Web Services, client and users of
Web Services will use the service
descriptions in WSDL to create client
proxies that access the service of
the provider
The provider defines the operations,
the binding, and the endpoints all in
the WSDL document
WSDL
WSDL stands for Web Services
Description Language.
WSDL is a document written in XML.
The document describes a Web
service. It specifies the location of
the service and the operations (or
methods) the service exposes.
WSDL
The main structure of a WSDL document looks like this:
WSDL Ports
     The <portType> element is the most important WSDL
     element.
     It describes a web service, the operations that can be
     performed, and the messages that are involved.
     The <portType> element can be compared to a function
     library (or a module, or a class) in a traditional programming
     language.

              WSDL Messages
The <message> element defines the data elements of an
operation.
Each message can consist of one or more parts. The parts can be
compared to the parameters of a function call in a traditional
programming language.
portType and message Example
WSDL Types
The <types> element defines the data type that are used by the
web service.
For maximum platform neutrality, WSDL uses XML Schema
syntax to define data types.
UDDI
Universal Description, Discovery and Integration
   http://www.ibm.com/services/uddi/testregistry/find
   http://uddi.microsoft.com/search.aspx
   http://uddi.sap.com
   http://www.xmethods.net/
   http://www.webservicex.net
UDDI Example : XMETHODS
www.webservicex.net
SOAP
Simple Object Access Protocol เป็ น Protocol ทีใช้ ในการเข้ าถึง Object
หรื อ Component อย่างง่ายๆ
SOAP เป็ น Protocol ทีอาศัยไวยากรณ์ของภาษา XML
SOAP
SOAP supports distributed computing
with XML by providing an effective
mechanism for exchanging messages
and accessing remote objects via
XML
SOAP Message Example
SOAP Request




SOAP Response
Creating Web Service using Tool
  VB component
  using SOAP toolkit 3.0 to Generate Web Service
  Call Web Service from any client (Programs)
     Perl
     Java
Creating COM Component using VB
        VB component MyAddProj.vbp
Public Function Add(ByVal Num1 as Integer,ByVal Num2 as Integer) As Integer
 Add = Num1 + Num2
End Function


        Generate component -> MyAdd.dll

           Register
          component
Generate Web Service from COM Component

Using SOAP Toolkit From Microsoft
   Download at http://msdn.microsoft.com


MyAdd.dll ->
   plus2num.wsdl(WSDL file)
SOAP Toolkit 3.0 WSDL Generator
WSDL File (MyAddWS.wsdl)
       http://161.200.70.44/MyAddWS.wsdl
<?xml version='1.0' encoding='UTF-8' ?>
...
                                                  Input Parameter
  <message name='MyAdd.Add'>
    <part name='Num1' type='xsd:short'/>
    <part name='Num2' type='xsd:short'/>
  </message>                                   Output Parameter
  <message name='MyAdd.AddResponse'>
    <part name='Result' type='xsd:short'/>
  </message>
...                         Operation name
<operation name='Add' >
...                             Web Service name
<service name=‘MyAddWS' >
...                                                      Web Service location
<soap:address location='http://161.200.70.44/myaddws.asp' />
Perl Client
#!c:perlbinperl.exe
use SOAP::Lite;
use CGI;
$obj = new CGI;
$a = $obj->param(number1);
$b = $obj->param(number2);
print "Content-type:text/htmlnn";
$strWSDL = "http://161.200.70.44/myaddws.asp";

print "Result from SOAP Server:</h4>";
print "Answer --> ";

print SOAP::Lite
          -> service($strWSDL)
          -> Add($a,$b);
Java Client
import java.io.*;
import java.util.*;
import java.net.*;
import org.w3c.dom.*;
import org.apache.soap.util.xml.*;
import org.apache.soap.*;
import org.apache.soap.encoding.*;
import org.apache.soap.encoding.soapenc.*;
import org.apache.soap.rpc.*;
import org.apache.soap.transport.http.SOAPHTTPConnection;
public class testSoapResponse
{
  public static void main(String[] args) throws Exception
  {
    URL url = new URL ("http://161.200.70.44/myaddws.asp");
    SOAPMappingRegistry smr = new SOAPMappingRegistry ();
    StringDeserializer sd = new StringDeserializer ();
    smr.mapTypes (Constants.NS_URI_SOAP_ENC,
                     new QName ("", "Result"), null, null, sd);
Java Client (Continue)
call.setTargetObjectURI ("http://tempuri.org/message/");
call.setMethodName("Add");
call.setEncodingStyleURI ("http://schemas.xmlsoap.org/soap/encoding/");
Vector params = new Vector();
params.addElement(new Parameter("Num1", Double.class,num1, null));
params.addElement(new Parameter("Num2", Double.class,num2, null));
call.setParams(params);
Response resp = null;
   try
   {
     resp = call.invoke (url, "http://161.200.70.44/MyAddWS.wsdl");
   }
…

Parameter ret = resp.getReturnValue();
Object value = ret.getValue();
System.out.println("nn Result from SOAP Server : nn");
System.out.println ("Answer --> " + value);
…

Weitere ähnliche Inhalte

Ähnlich wie Web service overview

SOA Using GlassFishESB and NetBeans [in Thai]
SOA Using GlassFishESB and NetBeans [in Thai]SOA Using GlassFishESB and NetBeans [in Thai]
SOA Using GlassFishESB and NetBeans [in Thai]Thanachart Numnonda
 
Web Based Application Development with Open Source
Web Based Application Development with Open SourceWeb Based Application Development with Open Source
Web Based Application Development with Open SourceRachabodin Suwannakanthi
 
Java bootcamp jax-ws
Java bootcamp  jax-wsJava bootcamp  jax-ws
Java bootcamp jax-wsjavabootcamp
 
็Hand-on Exercise: Java Web Services using Eclipse + Tomcat & NetBeans + Glas...
็Hand-on Exercise: Java Web Services using Eclipse + Tomcat & NetBeans + Glas...็Hand-on Exercise: Java Web Services using Eclipse + Tomcat & NetBeans + Glas...
็Hand-on Exercise: Java Web Services using Eclipse + Tomcat & NetBeans + Glas...IMC Institute
 
การพัฒนาเอกสารออนไลน์ขั้นสูง Lect 04
การพัฒนาเอกสารออนไลน์ขั้นสูง Lect 04การพัฒนาเอกสารออนไลน์ขั้นสูง Lect 04
การพัฒนาเอกสารออนไลน์ขั้นสูง Lect 04Jenchoke Tachagomain
 
Java Web Services and SOA Exercises [in Thai]
Java Web Services and SOA Exercises [in Thai]Java Web Services and SOA Exercises [in Thai]
Java Web Services and SOA Exercises [in Thai]IMC Institute
 

Ähnlich wie Web service overview (14)

Web Development
Web DevelopmentWeb Development
Web Development
 
SOA Using GlassFishESB and NetBeans [in Thai]
SOA Using GlassFishESB and NetBeans [in Thai]SOA Using GlassFishESB and NetBeans [in Thai]
SOA Using GlassFishESB and NetBeans [in Thai]
 
Web Based Application Development with Open Source
Web Based Application Development with Open SourceWeb Based Application Development with Open Source
Web Based Application Development with Open Source
 
Java bootcamp jax-ws
Java bootcamp  jax-wsJava bootcamp  jax-ws
Java bootcamp jax-ws
 
PHP&Dreamweaver 1-4
PHP&Dreamweaver 1-4PHP&Dreamweaver 1-4
PHP&Dreamweaver 1-4
 
็Hand-on Exercise: Java Web Services using Eclipse + Tomcat & NetBeans + Glas...
็Hand-on Exercise: Java Web Services using Eclipse + Tomcat & NetBeans + Glas...็Hand-on Exercise: Java Web Services using Eclipse + Tomcat & NetBeans + Glas...
็Hand-on Exercise: Java Web Services using Eclipse + Tomcat & NetBeans + Glas...
 
The Future of JavaScript
The Future of JavaScriptThe Future of JavaScript
The Future of JavaScript
 
การพัฒนาเอกสารออนไลน์ขั้นสูง Lect 04
การพัฒนาเอกสารออนไลน์ขั้นสูง Lect 04การพัฒนาเอกสารออนไลน์ขั้นสูง Lect 04
การพัฒนาเอกสารออนไลน์ขั้นสูง Lect 04
 
ภาษา Jsp
ภาษา Jspภาษา Jsp
ภาษา Jsp
 
Web 2.0 mashup
Web 2.0 mashupWeb 2.0 mashup
Web 2.0 mashup
 
13510160
1351016013510160
13510160
 
Kafka for developer
Kafka for developerKafka for developer
Kafka for developer
 
Web application with PHP
Web application with PHPWeb application with PHP
Web application with PHP
 
Java Web Services and SOA Exercises [in Thai]
Java Web Services and SOA Exercises [in Thai]Java Web Services and SOA Exercises [in Thai]
Java Web Services and SOA Exercises [in Thai]
 

Mehr von Saran Yuwanna

How to Utilize LINE@ for Food Business #2
How to Utilize LINE@ for Food Business #2How to Utilize LINE@ for Food Business #2
How to Utilize LINE@ for Food Business #2Saran Yuwanna
 
รวยสบายสไตล์ Line@
รวยสบายสไตล์ Line@รวยสบายสไตล์ Line@
รวยสบายสไตล์ Line@Saran Yuwanna
 
การแปลง Facebook profile เป็น page
การแปลง Facebook profile เป็น pageการแปลง Facebook profile เป็น page
การแปลง Facebook profile เป็น pageSaran Yuwanna
 
Mobile apps for work @nuisaran
Mobile apps for work @nuisaranMobile apps for work @nuisaran
Mobile apps for work @nuisaranSaran Yuwanna
 
เทคนิคขายของออนไลน์ให้ปัง ให้รวย : lnwshop
เทคนิคขายของออนไลน์ให้ปัง ให้รวย : lnwshopเทคนิคขายของออนไลน์ให้ปัง ให้รวย : lnwshop
เทคนิคขายของออนไลน์ให้ปัง ให้รวย : lnwshopSaran Yuwanna
 
การทิ้งขยะของเมืองคาวาโกเอะ
การทิ้งขยะของเมืองคาวาโกเอะการทิ้งขยะของเมืองคาวาโกเอะ
การทิ้งขยะของเมืองคาวาโกเอะSaran Yuwanna
 
Mobile apps for secretary @nuisaran
Mobile apps for secretary @nuisaranMobile apps for secretary @nuisaran
Mobile apps for secretary @nuisaranSaran Yuwanna
 
การสร้าง Line@ และการใช้งาน
การสร้าง Line@ และการใช้งานการสร้าง Line@ และการใช้งาน
การสร้าง Line@ และการใช้งานSaran Yuwanna
 
การใช้งาน Twitter และโปรแกรมตัดต่อวีดีโอ
การใช้งาน Twitter และโปรแกรมตัดต่อวีดีโอการใช้งาน Twitter และโปรแกรมตัดต่อวีดีโอ
การใช้งาน Twitter และโปรแกรมตัดต่อวีดีโอSaran Yuwanna
 
กำหนดการจัดงานมหกรรมเปิดตัวโครงการ “สินค้าชุมชนขับเคลื่อนเศรษฐกิจฐานราก”
กำหนดการจัดงานมหกรรมเปิดตัวโครงการ “สินค้าชุมชนขับเคลื่อนเศรษฐกิจฐานราก”กำหนดการจัดงานมหกรรมเปิดตัวโครงการ “สินค้าชุมชนขับเคลื่อนเศรษฐกิจฐานราก”
กำหนดการจัดงานมหกรรมเปิดตัวโครงการ “สินค้าชุมชนขับเคลื่อนเศรษฐกิจฐานราก”Saran Yuwanna
 
กำหนดการสัมมนาห้องย่อย Village E-Commerce มหกรรมสินค้าชุมชนขับเคลื่อนเศรษฐกิจ...
กำหนดการสัมมนาห้องย่อย Village E-Commerce มหกรรมสินค้าชุมชนขับเคลื่อนเศรษฐกิจ...กำหนดการสัมมนาห้องย่อย Village E-Commerce มหกรรมสินค้าชุมชนขับเคลื่อนเศรษฐกิจ...
กำหนดการสัมมนาห้องย่อย Village E-Commerce มหกรรมสินค้าชุมชนขับเคลื่อนเศรษฐกิจ...Saran Yuwanna
 
ใบสมัคร ประเภท 1.1 ประเภทศูนย์การเรียนรู้ ICT ชุมชนหรือศูนย์ดิจิทัลชุมชนดีเด่น
ใบสมัคร ประเภท 1.1 ประเภทศูนย์การเรียนรู้ ICT ชุมชนหรือศูนย์ดิจิทัลชุมชนดีเด่นใบสมัคร ประเภท 1.1 ประเภทศูนย์การเรียนรู้ ICT ชุมชนหรือศูนย์ดิจิทัลชุมชนดีเด่น
ใบสมัคร ประเภท 1.1 ประเภทศูนย์การเรียนรู้ ICT ชุมชนหรือศูนย์ดิจิทัลชุมชนดีเด่นSaran Yuwanna
 
ใบสมัคร ประเภท 1.2 ประเภทวิทยากรศูนย์การเรียนรู้ ICT ชุมชนหรือศูนย์ดิจิทัลชุม...
ใบสมัคร ประเภท 1.2 ประเภทวิทยากรศูนย์การเรียนรู้ ICT ชุมชนหรือศูนย์ดิจิทัลชุม...ใบสมัคร ประเภท 1.2 ประเภทวิทยากรศูนย์การเรียนรู้ ICT ชุมชนหรือศูนย์ดิจิทัลชุม...
ใบสมัคร ประเภท 1.2 ประเภทวิทยากรศูนย์การเรียนรู้ ICT ชุมชนหรือศูนย์ดิจิทัลชุม...Saran Yuwanna
 
ใบสมัคร ประเภท 1.3 ประเภทผู้ประกอบการร้านค้าออนไลน์ดีเด่น
ใบสมัคร ประเภท 1.3 ประเภทผู้ประกอบการร้านค้าออนไลน์ดีเด่นใบสมัคร ประเภท 1.3 ประเภทผู้ประกอบการร้านค้าออนไลน์ดีเด่น
ใบสมัคร ประเภท 1.3 ประเภทผู้ประกอบการร้านค้าออนไลน์ดีเด่นSaran Yuwanna
 
การประกวดศูนย์การเรียนรู้ ICT ชุมชนหรือศูนย์ดิจิทัลชุมชนดีเด่น และบุคคลดีเด่น...
การประกวดศูนย์การเรียนรู้ ICT ชุมชนหรือศูนย์ดิจิทัลชุมชนดีเด่น และบุคคลดีเด่น...การประกวดศูนย์การเรียนรู้ ICT ชุมชนหรือศูนย์ดิจิทัลชุมชนดีเด่น และบุคคลดีเด่น...
การประกวดศูนย์การเรียนรู้ ICT ชุมชนหรือศูนย์ดิจิทัลชุมชนดีเด่น และบุคคลดีเด่น...Saran Yuwanna
 
40 ครูช่างศิลปหัตถกรรม ประจำปี 2557
40 ครูช่างศิลปหัตถกรรม ประจำปี 255740 ครูช่างศิลปหัตถกรรม ประจำปี 2557
40 ครูช่างศิลปหัตถกรรม ประจำปี 2557Saran Yuwanna
 
หวัดเจ็บคอหายได้ ไม่ต้องใช้ยาปฏิชีวนะ
หวัดเจ็บคอหายได้ ไม่ต้องใช้ยาปฏิชีวนะหวัดเจ็บคอหายได้ ไม่ต้องใช้ยาปฏิชีวนะ
หวัดเจ็บคอหายได้ ไม่ต้องใช้ยาปฏิชีวนะSaran Yuwanna
 
Ecommerce โอกาสทองของคนยุคใหม่
Ecommerce โอกาสทองของคนยุคใหม่Ecommerce โอกาสทองของคนยุคใหม่
Ecommerce โอกาสทองของคนยุคใหม่Saran Yuwanna
 
Social media for pr กรมส่งเสริมการเกษตร
Social media for pr กรมส่งเสริมการเกษตร Social media for pr กรมส่งเสริมการเกษตร
Social media for pr กรมส่งเสริมการเกษตร Saran Yuwanna
 
Social media for pr สปสช
Social media for pr สปสชSocial media for pr สปสช
Social media for pr สปสชSaran Yuwanna
 

Mehr von Saran Yuwanna (20)

How to Utilize LINE@ for Food Business #2
How to Utilize LINE@ for Food Business #2How to Utilize LINE@ for Food Business #2
How to Utilize LINE@ for Food Business #2
 
รวยสบายสไตล์ Line@
รวยสบายสไตล์ Line@รวยสบายสไตล์ Line@
รวยสบายสไตล์ Line@
 
การแปลง Facebook profile เป็น page
การแปลง Facebook profile เป็น pageการแปลง Facebook profile เป็น page
การแปลง Facebook profile เป็น page
 
Mobile apps for work @nuisaran
Mobile apps for work @nuisaranMobile apps for work @nuisaran
Mobile apps for work @nuisaran
 
เทคนิคขายของออนไลน์ให้ปัง ให้รวย : lnwshop
เทคนิคขายของออนไลน์ให้ปัง ให้รวย : lnwshopเทคนิคขายของออนไลน์ให้ปัง ให้รวย : lnwshop
เทคนิคขายของออนไลน์ให้ปัง ให้รวย : lnwshop
 
การทิ้งขยะของเมืองคาวาโกเอะ
การทิ้งขยะของเมืองคาวาโกเอะการทิ้งขยะของเมืองคาวาโกเอะ
การทิ้งขยะของเมืองคาวาโกเอะ
 
Mobile apps for secretary @nuisaran
Mobile apps for secretary @nuisaranMobile apps for secretary @nuisaran
Mobile apps for secretary @nuisaran
 
การสร้าง Line@ และการใช้งาน
การสร้าง Line@ และการใช้งานการสร้าง Line@ และการใช้งาน
การสร้าง Line@ และการใช้งาน
 
การใช้งาน Twitter และโปรแกรมตัดต่อวีดีโอ
การใช้งาน Twitter และโปรแกรมตัดต่อวีดีโอการใช้งาน Twitter และโปรแกรมตัดต่อวีดีโอ
การใช้งาน Twitter และโปรแกรมตัดต่อวีดีโอ
 
กำหนดการจัดงานมหกรรมเปิดตัวโครงการ “สินค้าชุมชนขับเคลื่อนเศรษฐกิจฐานราก”
กำหนดการจัดงานมหกรรมเปิดตัวโครงการ “สินค้าชุมชนขับเคลื่อนเศรษฐกิจฐานราก”กำหนดการจัดงานมหกรรมเปิดตัวโครงการ “สินค้าชุมชนขับเคลื่อนเศรษฐกิจฐานราก”
กำหนดการจัดงานมหกรรมเปิดตัวโครงการ “สินค้าชุมชนขับเคลื่อนเศรษฐกิจฐานราก”
 
กำหนดการสัมมนาห้องย่อย Village E-Commerce มหกรรมสินค้าชุมชนขับเคลื่อนเศรษฐกิจ...
กำหนดการสัมมนาห้องย่อย Village E-Commerce มหกรรมสินค้าชุมชนขับเคลื่อนเศรษฐกิจ...กำหนดการสัมมนาห้องย่อย Village E-Commerce มหกรรมสินค้าชุมชนขับเคลื่อนเศรษฐกิจ...
กำหนดการสัมมนาห้องย่อย Village E-Commerce มหกรรมสินค้าชุมชนขับเคลื่อนเศรษฐกิจ...
 
ใบสมัคร ประเภท 1.1 ประเภทศูนย์การเรียนรู้ ICT ชุมชนหรือศูนย์ดิจิทัลชุมชนดีเด่น
ใบสมัคร ประเภท 1.1 ประเภทศูนย์การเรียนรู้ ICT ชุมชนหรือศูนย์ดิจิทัลชุมชนดีเด่นใบสมัคร ประเภท 1.1 ประเภทศูนย์การเรียนรู้ ICT ชุมชนหรือศูนย์ดิจิทัลชุมชนดีเด่น
ใบสมัคร ประเภท 1.1 ประเภทศูนย์การเรียนรู้ ICT ชุมชนหรือศูนย์ดิจิทัลชุมชนดีเด่น
 
ใบสมัคร ประเภท 1.2 ประเภทวิทยากรศูนย์การเรียนรู้ ICT ชุมชนหรือศูนย์ดิจิทัลชุม...
ใบสมัคร ประเภท 1.2 ประเภทวิทยากรศูนย์การเรียนรู้ ICT ชุมชนหรือศูนย์ดิจิทัลชุม...ใบสมัคร ประเภท 1.2 ประเภทวิทยากรศูนย์การเรียนรู้ ICT ชุมชนหรือศูนย์ดิจิทัลชุม...
ใบสมัคร ประเภท 1.2 ประเภทวิทยากรศูนย์การเรียนรู้ ICT ชุมชนหรือศูนย์ดิจิทัลชุม...
 
ใบสมัคร ประเภท 1.3 ประเภทผู้ประกอบการร้านค้าออนไลน์ดีเด่น
ใบสมัคร ประเภท 1.3 ประเภทผู้ประกอบการร้านค้าออนไลน์ดีเด่นใบสมัคร ประเภท 1.3 ประเภทผู้ประกอบการร้านค้าออนไลน์ดีเด่น
ใบสมัคร ประเภท 1.3 ประเภทผู้ประกอบการร้านค้าออนไลน์ดีเด่น
 
การประกวดศูนย์การเรียนรู้ ICT ชุมชนหรือศูนย์ดิจิทัลชุมชนดีเด่น และบุคคลดีเด่น...
การประกวดศูนย์การเรียนรู้ ICT ชุมชนหรือศูนย์ดิจิทัลชุมชนดีเด่น และบุคคลดีเด่น...การประกวดศูนย์การเรียนรู้ ICT ชุมชนหรือศูนย์ดิจิทัลชุมชนดีเด่น และบุคคลดีเด่น...
การประกวดศูนย์การเรียนรู้ ICT ชุมชนหรือศูนย์ดิจิทัลชุมชนดีเด่น และบุคคลดีเด่น...
 
40 ครูช่างศิลปหัตถกรรม ประจำปี 2557
40 ครูช่างศิลปหัตถกรรม ประจำปี 255740 ครูช่างศิลปหัตถกรรม ประจำปี 2557
40 ครูช่างศิลปหัตถกรรม ประจำปี 2557
 
หวัดเจ็บคอหายได้ ไม่ต้องใช้ยาปฏิชีวนะ
หวัดเจ็บคอหายได้ ไม่ต้องใช้ยาปฏิชีวนะหวัดเจ็บคอหายได้ ไม่ต้องใช้ยาปฏิชีวนะ
หวัดเจ็บคอหายได้ ไม่ต้องใช้ยาปฏิชีวนะ
 
Ecommerce โอกาสทองของคนยุคใหม่
Ecommerce โอกาสทองของคนยุคใหม่Ecommerce โอกาสทองของคนยุคใหม่
Ecommerce โอกาสทองของคนยุคใหม่
 
Social media for pr กรมส่งเสริมการเกษตร
Social media for pr กรมส่งเสริมการเกษตร Social media for pr กรมส่งเสริมการเกษตร
Social media for pr กรมส่งเสริมการเกษตร
 
Social media for pr สปสช
Social media for pr สปสชSocial media for pr สปสช
Social media for pr สปสช
 

Web service overview

  • 2. Function Function คือ โปรแกรมย่อยชนิดหนึง ซึงอาจจะมีการรับค่ามาจาก โปรแกรมหลักทีเรี ยกใช้ Function นันๆ จากนันจะมีการประมวลผลคําสังใน ( ( Function พร้ อมกับจะมีการคืนค่ากลับไปทีโปรแกรมหลักทีเรี ยกใช้ งาน Function นันๆ ( Main Program 1 … Function Call function cal(2) Function cal (number As Integer) importing result. Dim result As Integer write result. result = number ** 2 … return result Main Program 2 End Function … Call function cal(4) importing result. write result. …
  • 3. Web Application 1.Static 2.Dynamic 3.Web Service
  • 4. Web Application ยุคที& 1 : Static Web Page http://www.prapoj.com/current.html HTTP request HTTP response Web Browser Web Server Web Pages
  • 5. Web Application ยุคที& 2 : Dynamic Web Page .asp,.jsp,.php,.pl… http://www.prapoj.com/index.asp HTTP request SQL Statement HTTP response Web Server Web Browser Data Web Pages Database
  • 6. Web Application ยุคที& 3 : Web Service Technology .asp,.php,.pl,jsp … st Web Service http://www.prapoj.com/index.aspx er HTT P reque S OAP ov Web Server HTTP request SOA P ov HTTP response er H T TP Web Server re que Web Browser st Web Service Web Server
  • 8. Programming World! Microsoft Java World World
  • 9. Distributed Computing VB Java C# Java ASP Java .dll EJB .NET Java Java C++ Java
  • 10. Web Service VB Java C# Java ASP Java Web Service Web Service WSDL WSDL .dll EJB .NET Java Java C++ Java
  • 11. What is Web Service?
  • 12. Web Service? Application หรื อโปรแกรม(หรื อ Function)ซึงทําหน้ าทีอย่างใด อย่างหนึงในลักษณะให้ บริการ(Service) โดยจะถูกเรี ยกใช้ งานจาก Application หรื อโปรแกรมอืนๆผ่านทาง Web (Web Server โดย อาศัย SOAP Protocol) การให้ บริ การของ Web Service นัน จะมี ( เอกสารทีอธิบายคุณสมบัตของบริ การกํากับไว้ (WSDL) และมีการ ิ นําเสนอให้ สาธารณชนรับทราบ(UDDI) ผู้ใช้ บริ การจึงสามารถทีจะ ค้ นหาบริ การของ Web Service ต่างๆได้ โดยไม่จําเป็ นต้ องรู้ทีอยู่ จริ งของ Application หรื อโปรแกรมทีให้ บริการ Web Service นันๆ (
  • 13. Web Service Definition Web services are the fundamental building blocks in the move to distributed computing on the Internet Open standards and the focus on communication and collaboration among people and applications have created an environment where XML Web Service are becoming the platform for application Integration Applications are constructed using multiple XML Web Services from various sources that work together regardless of where they reside or how they were implemented One of the primary advantages of the XML Web Services architecture is that it allows programs written in different languages on different platforms to communicate with each other in a standards-based way
  • 14. Web Service Concept “Web Services are self-contained, self-describing modular applications that can be published, discovered and invoked across the Web” 2 WSDL 3 4 SOAP Request 1 WSDL Web Service SOAP Response Web Server Component 5
  • 15. ขันตอนในการพัฒนา Web Service : สร้ าง Web Service โดยการพัฒนาแบบ Manual หรื อใช้ เครืองมือ (Tool) ในการ Generate เราจะได้ เอกสาร WSDL บรรยาย คุณลักษณะของ Web Service นันๆ ( ทําการ Publish ในส่วนของ Web Service ไปที UDDI เพือให้ บุคคลทัวไปสามารถค้ นหา Web Service ทีเราพัฒนาขึ (นมาได้
  • 16. ขันตอนในการเรี ยกใช้ Web Service : ค้ นหาบริ การ Web Service ผ่าน UDDI ซึงทําให้ เราได้ ข้อมูล เกียวกับประเภทบริ การ ทีตังของบริการ และเอกสาร WSDL ( บรรยายคุณลักษณะของบริการนันๆ ( ติดต่อขอใช้ บริ การ Web Service โดยใช้ SOAP Protocol (SOAP Request)ด้ วยการเขียนโปรแกรมขึ (นมาเรี ยกใช้ Method ของ Web Service นันๆโดยอาศัยข้ อมูลทีอยูในเอกสาร WSDL ( ่ ผู้ให้ บริ การส่งผลลัพธ์กลับมาในรูปของ XML(SOAP Response)
  • 17. Standards Behind Web services Simple Object Access Protocol (SOAP) is based on XML and Hypertext Transport Protocol. It provides a way for applications — including those running on different operating systems — to communicate and work together through remote procedure calls implemented via HTTP Universal Description, Discovery and Integration (UDDI) describes how to publish and discover information about Web services applications. It is a Web-based directory where someone can search for particular Web services and what they do
  • 18. Standards Behind Web services Web Services Description Language (WSDL), based on XML, describes the kinds of software applications, or services, available on a particular network. Once someone develops a Web service, they can publish its description and link in a special UDDI repository. When someone wants to use the service, they request the WSDL file so they can determine its location, function calls and how to get to them. They use that information to construct a SOAP request to a server eXtensible Markup Language is a streamlined version of Standard Generalized Markup Language, developed by the International Organization for Standardization to define the structures of different types of electronic documents. XML can be used to store any kind of structured language and encapsulate data so it can be shared between otherwise incompatible computer systems
  • 19. Web Service Components Web Service = WSDL + UDDI + SOAP UDDI UDDI Business Registry h S earc Publish Consume Web Service WSDL SOAP
  • 20. WSDL Web Service Description Language เป็ นภาษาทีใช้ อธิบาย คุณลักษณะของ Web Service และวิธีในการติดต่อกับ Web Service โดยใช้ ไวยากรณ์ของภาษา XML
  • 21. WSDL WSDL can be used to describe several primary qualities of a Web Service message: 1 The address Location of WSDL The Web Service name 2 The Operation(Function/Method) name 3 The Input/Output parameters 4 The type of data being sent between client and server during a Web Service message exchange 5
  • 22. WSDL WSDL is used to describe Web Services, client and users of Web Services will use the service descriptions in WSDL to create client proxies that access the service of the provider The provider defines the operations, the binding, and the endpoints all in the WSDL document
  • 23. WSDL WSDL stands for Web Services Description Language. WSDL is a document written in XML. The document describes a Web service. It specifies the location of the service and the operations (or methods) the service exposes.
  • 24. WSDL The main structure of a WSDL document looks like this:
  • 25. WSDL Ports The <portType> element is the most important WSDL element. It describes a web service, the operations that can be performed, and the messages that are involved. The <portType> element can be compared to a function library (or a module, or a class) in a traditional programming language. WSDL Messages The <message> element defines the data elements of an operation. Each message can consist of one or more parts. The parts can be compared to the parameters of a function call in a traditional programming language.
  • 27. WSDL Types The <types> element defines the data type that are used by the web service. For maximum platform neutrality, WSDL uses XML Schema syntax to define data types.
  • 28. UDDI Universal Description, Discovery and Integration http://www.ibm.com/services/uddi/testregistry/find http://uddi.microsoft.com/search.aspx http://uddi.sap.com http://www.xmethods.net/ http://www.webservicex.net
  • 29. UDDI Example : XMETHODS
  • 31. SOAP Simple Object Access Protocol เป็ น Protocol ทีใช้ ในการเข้ าถึง Object หรื อ Component อย่างง่ายๆ SOAP เป็ น Protocol ทีอาศัยไวยากรณ์ของภาษา XML
  • 32. SOAP SOAP supports distributed computing with XML by providing an effective mechanism for exchanging messages and accessing remote objects via XML
  • 33. SOAP Message Example SOAP Request SOAP Response
  • 34. Creating Web Service using Tool VB component using SOAP toolkit 3.0 to Generate Web Service Call Web Service from any client (Programs) Perl Java
  • 35. Creating COM Component using VB VB component MyAddProj.vbp Public Function Add(ByVal Num1 as Integer,ByVal Num2 as Integer) As Integer Add = Num1 + Num2 End Function Generate component -> MyAdd.dll Register component
  • 36. Generate Web Service from COM Component Using SOAP Toolkit From Microsoft Download at http://msdn.microsoft.com MyAdd.dll -> plus2num.wsdl(WSDL file)
  • 37. SOAP Toolkit 3.0 WSDL Generator
  • 38. WSDL File (MyAddWS.wsdl) http://161.200.70.44/MyAddWS.wsdl <?xml version='1.0' encoding='UTF-8' ?> ... Input Parameter <message name='MyAdd.Add'> <part name='Num1' type='xsd:short'/> <part name='Num2' type='xsd:short'/> </message> Output Parameter <message name='MyAdd.AddResponse'> <part name='Result' type='xsd:short'/> </message> ... Operation name <operation name='Add' > ... Web Service name <service name=‘MyAddWS' > ... Web Service location <soap:address location='http://161.200.70.44/myaddws.asp' />
  • 39. Perl Client #!c:perlbinperl.exe use SOAP::Lite; use CGI; $obj = new CGI; $a = $obj->param(number1); $b = $obj->param(number2); print "Content-type:text/htmlnn"; $strWSDL = "http://161.200.70.44/myaddws.asp"; print "Result from SOAP Server:</h4>"; print "Answer --> "; print SOAP::Lite -> service($strWSDL) -> Add($a,$b);
  • 40. Java Client import java.io.*; import java.util.*; import java.net.*; import org.w3c.dom.*; import org.apache.soap.util.xml.*; import org.apache.soap.*; import org.apache.soap.encoding.*; import org.apache.soap.encoding.soapenc.*; import org.apache.soap.rpc.*; import org.apache.soap.transport.http.SOAPHTTPConnection; public class testSoapResponse { public static void main(String[] args) throws Exception { URL url = new URL ("http://161.200.70.44/myaddws.asp"); SOAPMappingRegistry smr = new SOAPMappingRegistry (); StringDeserializer sd = new StringDeserializer (); smr.mapTypes (Constants.NS_URI_SOAP_ENC, new QName ("", "Result"), null, null, sd);
  • 41. Java Client (Continue) call.setTargetObjectURI ("http://tempuri.org/message/"); call.setMethodName("Add"); call.setEncodingStyleURI ("http://schemas.xmlsoap.org/soap/encoding/"); Vector params = new Vector(); params.addElement(new Parameter("Num1", Double.class,num1, null)); params.addElement(new Parameter("Num2", Double.class,num2, null)); call.setParams(params); Response resp = null; try { resp = call.invoke (url, "http://161.200.70.44/MyAddWS.wsdl"); } … Parameter ret = resp.getReturnValue(); Object value = ret.getValue(); System.out.println("nn Result from SOAP Server : nn"); System.out.println ("Answer --> " + value); …