HTML
  Home arrow HTML arrow Page 2 - Wanna Chat with a Web Service?
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
HTML

Wanna Chat with a Web Service?
By: Ahm Asaduzzaman
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 13
    2003-04-26

    Table of Contents:
  • Wanna Chat with a Web Service?
  • The Article
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Wanna Chat with a Web Service? - The Article


    (Page 2 of 3 )

    RPC-Style Web Services

    Remote Procedure Call (RPC)-Style Web services are synchronous because the clients invoke the Web Service by sending parameters and waits for the method to return values before continuing. RPC-style Web Services are tightly coupled because the sending parameters and return values are as described in WSDL (Web Service Description Language) file, an XML format for describing Web Services. In RPC-style Web Services, the calling parameters and the return values are wrapped inside the SOAP Body.

    The difference with SOAP and XML-RPC is that it uses standard, general-purpose transports; such as HTTP; together with a text-based method call description in XML. RPC made over Web-based protocols and are no different from those made over other protocols, such as IIOP, DCOM, or JRMP. However, HTTP (and SMTP) has general right of access through most firewalls, which makes it easier to integrate applications across organizational boundaries and it is payload agnostic.

    Example RPC-Style Web Service

    To explain this part of the article, I have chosen a Web service from Xmethods, called “Eliza-chat with a Web Service”.  Let’s try to implement a client in Visual Basic 6.0 to consume the service. The codes should be written in a way, so, if anyone has elementary knowledge in VB, can re-write a few lines of codes to consume other RPC-Style Web services.

    Now little about Eliza, “she” is a mock Rogerian psychotherapist. It prompts you user input, and uses a special transformation algorithm to change user input into a follow-up question. Which makes certain kinds of natural language conversation between man and computer. It was introduces in 1966 in ACM 9 by Joseph Weizenbaum. If you are interested in computational linguistics, MIT press is a good starting point.

    At first, look into the RPC profile for this service (Pic. 1), that’s all information you need to write the client.

    Pic. Eliza 1.

    The vital part of VB code for SOAP envelops to construct request string with input parameters and output string with output parameters is as follows.  The detail coding/description you can find in the support file with this article.

    Option Explicit
    Dim bFlag As Boolean
    Private Sub DisplayData(ByVal response As String)
        Dim doc As MSXML2.DOMDocument
        Set doc = New MSXML2.DOMDocument
        'MsgBox response
        If doc.loadXML(response) Then
            lblCurrentTemp.Caption = doc.selectSingleNode("//Eliza").text
        Else
            MsgBox "Failed to load the response text: " & vbCrLf & response
        End If
        bFlag = True
    End Sub
    Private Sub txtZip_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        Dim soap As SOAPSender
        Set soap = New SOAPSender
        bFlag = False
        Screen.MousePointer = vbHourglass
        soap.BeginBodyPart "chat", "http://www.net-aholic.de/cgi-bin/eliza/chat.wsdl"
        soap.BeginElement "Say", ""
        soap.WriteText txtZip.text
        soap.EndElement
        soap.EndBodyPart
        soap.SoapAction = "http://www.net-aholic.de/cgi-bin/eliza/chat.wsdl"
        soap.ServiceUrl = "http://www.net-aholic.de/cgi-bin/eliza/chat.wsdl"
        soap.Send
        ' to analyze request envelop, uncomment following line
        'MsgBox soap.GetRequestString
        'MsgBox soap.GetResponseString
        DisplayData soap.GetResponseString
        Screen.MousePointer = vbDefault
    txtZip.text = ""
    End If
    End Sub

    Pic. Eliza 2.

    Document-Style Web Services

    It is beyond dispute that the ability to invoke a cross-platform RPC using XML is extremely useful and compelling for using Web Services, if it constrained only to RPC mechanism, the reach of the technology will be limited. Developers have a choice of using either RPC or document-style messaging. Here is a good article by McCarthy on document-style Web Services. Document-style Web Services are loosely coupled and asynchronous. The client sends the parameter to the Web Service as XML document, instead of discrete set of parameter values to the Web Service. The input XML document can also be described in WSDL.

    Unlike RPC-style Web Service, Document-style Web Service does not follow call/response semantics.  The Web Service receives entire document, processes it and may or may not return a response message. The SOAP Body of a document style carries one or more XML documents, within its body. The protocol places no constraint on how that document needs to be structured, which is totally handled at the application level.

    Here is an example: if you send an email to: google@capeclear.com and in the subject line type your query string, you will get the query response from the Google Web service over the email. Same way we can get the different language translation services.  Document-Style Web Services has begun to emerge as an important but very different approach. Document-Style Web Services prove to be the best solution for wide range of usage scenarios in B2B. The Xmethods site is hosting a demo Web service that is built using document style.

    More HTML Articles
    More By Ahm Asaduzzaman


     

    HTML ARTICLES

    - Comparing Browser Response to Active Client ...
    - Testing Browser Response to Active Client Pa...
    - Active Client Pages: Completing the Code for...
    - ACP and Browsers: Setting up an Example
    - How Browsers Respond to Active Client Pages
    - Completing a Tree with Active Client Pages
    - HTML Form Verification and ACP
    - Building an ACP Tree
    - Completing an ACP 3D HTML Table Image Gallery
    - Building an ACP 3D HTML Table Image Gallery
    - A Multiple Page Image Gallery with Active Cl...
    - Building an Image Gallery with Active Client...
    - Concluding a Menu for All Browsers
    - A Vertical Menu for All Browsers
    - Downloading Long HTML Pages with ACP







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek