ASP Code
  Home arrow ASP Code arrow Basic Understanding of WSDL documents And ...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
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? 
ASP CODE

Basic Understanding of WSDL documents And How to Use a WSDL File to Access a SOAP Service
By: aspfree
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 4
    2002-03-17

    Table of Contents:

    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


    Basic Understanding of WSDL documentsAndHow to Use a WSDL File to Access a SOAP Service&nbs ...How to Use a WSDL File to Access a SOAP Service  

     What is WSDL?

     Web Service Description Language (WSDL).  These files are used to describe in great detail each web service and what operations it knows how to perform.  A WSDL file consists of several main sections:

    - Services

     The service element(s) of a WSDL file defines a collection of ports, and points to a particular binding for each port.

     - Ports

     Ports are methods that can be used to access the service. 

    - Bindings

     Each binding element of a WSDL file points to a corresponding port type and describes the data format and protocol for each (including a sneak peak at the operations).

     - PortTypes

     Each portType element of a WSDL file describes the operations that the service can implement.  Each operation description defines the input and output message that it uses.

    - Messages

     The message elements of a WSDL file contain information about particular messages passed to and from a web service.  There are exactly one input and one output message for every operation.

     

     

     

                       à

    Operation 1

    I/O messages

     

    Port 1à

    Binding à

    PortType 1 à

    Operation 2

    I/O messages

     

     

     

                       à

    Operation 3

    I/O messages

     

     

     

     

     

     

    Service

    Port 2

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     So each service (more than one can be defined in a WSDL file) can define one or more ports. Ports basically define how the service can be accessed.  The three most common ports at this point are SOAP, HTTP Get, and HTTP Post.  In this document, I am going to concentrate on the SOAP port.  Each port points to a binding, each binding points to a portType, and each portType defines the operations it can perform.  These operations can be anything from addition to supplying a stock quote.  Each of these operations then defines its input and output messages.

     So each piece of the file contains valuable information that will tell you how to use the service that it describes.

     Let’s take a look at an example service borrowed from www.xmethods.net.  Xmethods lists a domain name checker service that will determine if a particular domain name is available.  The WSDL for this particular service is located at http://services.xmethods.net/soap/urn:xmethods-DomainChecker.wsdl.

     First, let’s examine the <service> element:

    <service name="net.xmethods.services.domainchecker.DomainCheckerService">
    <documentation>net.xmethods.services.domainchecker.DomainChecker web service</documentation> 
    <port name="net.xmethods.services.domainchecker.DomainCheckerPort" binding="tns:net.xmethods.services.domainchecker.DomainCheckerBinding"> 
    <soap:address location="http://64.39.29.211:9090/soap" />
    </port> 
    </service>

     This service, named net.xmethods.services.domainchecker.DomainCheckerService contains one port definition (as well as a name) that points to a binding called (for short) DomainCheckerBinding.  The port definition also contains a soap:address location, which will be the end point URL we’ll use to access the service.  Make a note of this endpoint URL.

     Next, we can check out the binding that this service points us to.

    <binding name ="net.xmethods.services.domainchecker.DomainCheckerBinding" type ="tns:net.xmethods.services.domainchecker.DomainCheckerPortType">
    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> 
    <operation name="checkDomain"> 
    <soap:operation soapAction="urn:xmethods-DomainChecker#checkDomain" /> 
    <input>
    <soap:body use="encoded" namespace="urn:xmethods-DomainChecker" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> 
    </input> 
    <output> 
    <soap:body use="encoded" namespace="urn:xmethods-DomainChecker" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
    </output>
    </operation>
    </binding> 

    This binding defines one operation named checkDomain, which of course has an input and output message.  An important piece here is the method URI of each operation.  Notice the namespace="urn:xmethods-DomainChecker" .  This is the method URI for the operation checkDomain.  The binding includes a binding style, encoding style and transport protocol definition, and also a portType.  Let’s take a look at this portType.

    <portType name ="net.xmethods.services.domainchecker.DomainCheckerPortType"> 
    <operation name="checkDomain" parameterOrder="symbol"> 
    <input message="tns:checkDomainRequest1" /> 
    <output message="tns:checkDomainResponse1" /> 
    </operation>
    </portType

    This portType (just like the binding) describes the operations and the operation input/output messages.  However, here rather than describing what encoding styles and transport methods to use, we see how to find the actual definitions of these messages. 

    <input message="tns:checkDomainRequest1" />

    This input message is called checkDomainRequest1.  Now we can go to the <message> element that corresponds with this message name and see exactly what it is.

    <message name="checkDomainRequest1"> 
    <part name="symbol" type="xsd:string" />
    </message>

    Here we can see that the Request message contains 1 part named symbol which is a string.  Each message can include more than one part or parameter.

    Now through examining the WSDL file we have gathered some important pieces of information about this web service:

    - End point URL

    - Method URI

    - The Operation that we want to perform, or Method name.

    - Input parameters (messages)

    So we are ready to use this information to form our SOAP request to access the service.  I am going to form this request with the IP*Works! SOAP component.  For those of you who are not familiar with this particular component you can download a fully functional free trial version at /n software. 

    This component is made to be extremely easy to use.  All I have to do from here on is fill in the blanks with the information I have gathered:

        SOAP1.URL = http://64.39.29.211:9090/soap   â€˜The Endpoint URL
        SOAP1.MethodURI = "urn:xmethods-DomainChecker" â€˜The Method URI
        SOAP1.Method = "checkDomain"  ‘The Method Name
        SOAP1.AddParam "symbol", Microsoft.com  ‘The input message

    Here I’ll use Microsoft.com as my symbol to perform the domain check on.  Now I simply send the request:

        SOAP1.SendRequest

     And retrieve the value from the SOAP1.ReturnValue property.

        Response.write Domain: + SOAP1.ReturnValue

     Here, the output I receive is:

     Domain: unavailable

     Now I can incorporate this service into my ASP application, .Net app, VB app, Delphi app, Java app, or whatever.

    More Information

    For information about the author, please contact lancer@nsoftware.com.

    For more information about IP*Works! or the SOAPcomponent, please visit /n software.

    Copyright © 2002, Lance Robinson - All Rights Reserved.  For publishing permissions, contact lancer@nsoftware.com.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More ASP Code Articles
    More By aspfree

     

    IBM® developerWorks developerWorks - FREE Tools!


    NEW! Calling all CC Power Users – and those that would like to be!

    Join this Rational Talks to You teleconference, featuring Paul Boustany and Mark Krasovich, to speak to the experts about becoming a Rational ClearCase power user. Get a chance to ask your questions and learn tips and tricks for using Rational ClearCase in Agile development
    FREE! Go There Now!


    NEW! Best Practices in Integrated Requirements Management

    Poor Requirements Management capabilities in an Enterprise have been linked to excessive project failures, escalating IT costs, and failure to deliver competitive advantage into the marketplace. Join Brianna M Smith from IBM Rational and learn about how successful organizations align IT and Business stakeholders through collaborative processes and tools for effective requirements management, and how an integrated approach across the IT lifecycle can provide unparalleled visibility and traceability to ensure that project teams are delivering on the business vision by "doing the right things" and "doing things right."
    FREE! Go There Now!


    NEW! Discovering the value of WebSphere Process Server

    WebSphere Process Server delivers a unique integration framework that simplifies existing IT resources. Often, as IT assets grow to support business demand, so too does their complexity and manageability. In this webcast, we’ll discuss how WebSphere Process Server helps deliver an SOA infrastructure that provides a common model to orchestrate, mediate, connect, map, and execute the underlying IT functions. Discover how WebSphere Process Server simplifies integration of business processes by leveraging existing IT assets as reusable services without the complexities of traditional integration methodologies.
    FREE! Go There Now!


    NEW! Don't wait! Try the Rational Application Developer (RAD) v7.5 open beta code today

    Download the Rational Application Developer (RAD) v7.5 open beta code and start developing applications for the JEE5 standard which features EJB3.0, JPA, JSF 1.2, JSP 2.1 and Servlet 2.5 standards. When you use this beta you will see how you can increase developer productivity for already existing applications with improved support for refactoring, as well as adding new features to existing applications. In addition, the beta provides tooling for JD Edwards, Oracle, SAP, Siebel and PeopleSoft to improve the developer productivity with these enterprise systems.
    FREE! Go There Now!


    NEW! Hacking 101

    Join us for this web seminar to learn how you can defend your web applications from attack. Learn about the 3 most common web application attacks, including how they occur and what can be done to prevent them. We’ll also discuss manual versus automated approaches for scanning and identifying web application vulnerabilities and how IBM Rational AppScan, an automated vulnerability scanner, can help you automate more of what you are doing manually today.
    FREE! Go There Now!


    NEW! Harnessing the power of SQL and Java for high performance data access

    Join this webcast to see how IBM Data Studio Developer and pureQuery can take the pain out of Java data access. uApplications developed using both Java and SQL have become a common requirement. Database connectivity using Java Database Connectivity (JDBC) to create an application is a multi-step tedious process, and tooling that covers both SQL and Java has been unavailable, until now. IBM Data Studio introduces the pureQuery platform: a high-performance, Java data access platform focused on simplifying the tasks of developing, managing, and optimizing database applications and services.
    FREE! Go There Now!


    NEW! Rational Build Forge Express eKit

    Rational Build Forge Express Edition is an automation framework that packages the latest enterprise-grade technologies into a reliable, flexible and robust configuration designed and priced specifically for small to midsize businesses. The new Rational Build Forge Express eKit provides you with valuable resources – including a case study, podcast, demo, and articles – to help you increase staff productivity, compress development cycles and deliver better software, fast.
    FREE! Go There Now!


    NEW! Rational Talks to You: Scott Ambler on being agile in a global development environment

    Join this Rational Talks to You teleconference on December 6 at 1:00 pm ET to participate in an agile application development discussion and get your questions answered on using IBM Rational Method Composer in a distributed environment.Get your questions answered!
    FREE! Go There Now!


    NEW! Trial download: IBM Rational Method Composer V7.2

    Get a free trial download of the latest version of IBM Rational Method Composer V7.2 which helps you deliver customized yet consistent process guidance to your project teams and IT organization, and includes the latest version of IBM Rational Unified Process (RUP), which has provided process guidance to teams since 1996.
    FREE! Go There Now!


    NEW! Whitepaper: Delivering SOA solutions: service lifecycle management

    The unprecedented scope of a service-oriented architecture (SOA) initiative brings to the forefront a number of management and governance issues that were sidestepped in the past. The key to a successful SOA implementation is managing and governing activities throughout the entire SOA delivery lifecycle by ensuring that services conform to the needs of all of the business’s stakeholders. Learn how service lifecycle management allows the business to ensure that the process by which services are defined, created, tested, deployed, optimized and retired is manageable, repeatable and auditable.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    ASP CODE ARTICLES

    - ASP Forms
    - ASP: The Beginning
    - Getting Remote Files With ASP Continued
    - Inbox and Outbox Manipulation in ASP
    - Relational DropDownList Using VB.NET
    - Ad Tracking URL Hits
    - Use ViewState to display one record per page...
    - Send Email using ASP.NET formatted in HTML
    - ASP File Explorer
    - ASP/XML Interview questions by Srivatsan Sri...
    - Various methods of setting Date values to a ...
    - Conditional DataGrid Item and using checkbox...
    - Fill .NET Listbox with SQL DataReader
    - Filling Dropdown box using Code-Behinds in C#
    - FLAMES code sample written in .NET What is F...





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