Tuesday, July 23, 2013

Java Web Service Tutorial (WSDL & XSD ) - Part 04


WSDL :


WSDL stands for Web Services Description Language

WSDL is an XML based protocol for information exchange in decentralized and distributed environments.

WSDL is the standard format for describing a web service.

WSDL is an interface provided by the webservice publisher to the clients .Using this interface client can understands what are they type of operation the webservice is offering.

WSDL is declard as a  part of UDDI  while registering the webservice in UDDI.

WSDL Elements:

Three major elements of WSDL that can be defined separately and they are:

a.Types - It contains all the datatypes specification what type of values methods accepts.

b.Operations - Define the Methods provided by the Webservice and it's input parameters and it's result.

c.Binding - Contains the end point URL of  the webservice .

Apart from these WSDL also have other elements.

Definition: This element must be the root element of all WSDL documents. It defines the name of the web service, declares multiple namespaces used throughout the remainder of the document, and contains all the service elements described here.

Data types(xsd): the data types - in the form of XML schemas(xsd) or possibly some other mechanism - to be used in the messages. This can define inside the WSDL or can refer from external location.

Message: an abstract definition of the data, in the form of a message presented either as an entire document or as arguments to be mapped to a method invocation.

Operation: the abstract definition of the operation for a message, such as naming a method, message queue, or business process, that will accept and process the message

Port type : an abstract set of operations mapped to one or more end points, defining the collection of operations for a binding; the collection of operations, because it is abstract, can be mapped to multiple transports through various bindings.

Binding: the concrete protocol and data formats for the operations and messages defined for a particular port type.

Port: a combination of a binding and a network address, providing the target address of the service communication.

Service: a collection of related end points encompassing the service definitions in the file; the services map the binding to the port and include any extensibility definitions.

In addition to these major elements, the WSDL specification also defines the following utility elements:

Documentation: element is used to provide human-readable documentation and can be included inside any other WSDL element.

Import: element is used to import other WSDL documents or XML Schemas.

Ex:

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<s:element name="FahrenheitToCelsius">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Fahrenheit" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="FahrenheitToCelsiusResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="FahrenheitToCelsiusResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="CelsiusToFahrenheit">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Celsius" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="CelsiusToFahrenheitResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="CelsiusToFahrenheitResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="string" nillable="true" type="s:string" />
</s:schema>
</wsdl:types>
<wsdl:message name="FahrenheitToCelsiusSoapIn">
<wsdl:part name="parameters" element="tns:FahrenheitToCelsius" />
</wsdl:message>
<wsdl:message name="FahrenheitToCelsiusSoapOut">
<wsdl:part name="parameters" element="tns:FahrenheitToCelsiusResponse" />
</wsdl:message>
<wsdl:message name="CelsiusToFahrenheitSoapIn">
<wsdl:part name="parameters" element="tns:CelsiusToFahrenheit" />
</wsdl:message>
<wsdl:message name="CelsiusToFahrenheitSoapOut">
<wsdl:part name="parameters" element="tns:CelsiusToFahrenheitResponse" />
</wsdl:message>
<wsdl:message name="FahrenheitToCelsiusHttpPostIn">
<wsdl:part name="Fahrenheit" type="s:string" />
</wsdl:message>
<wsdl:message name="FahrenheitToCelsiusHttpPostOut">
<wsdl:part name="Body" element="tns:string" />
</wsdl:message>
<wsdl:message name="CelsiusToFahrenheitHttpPostIn">
<wsdl:part name="Celsius" type="s:string" />
</wsdl:message>
<wsdl:message name="CelsiusToFahrenheitHttpPostOut">
<wsdl:part name="Body" element="tns:string" />
</wsdl:message>
<wsdl:portType name="TempConvertSoap">
<wsdl:operation name="FahrenheitToCelsius">
<wsdl:input message="tns:FahrenheitToCelsiusSoapIn" />
<wsdl:output message="tns:FahrenheitToCelsiusSoapOut" />
</wsdl:operation>
<wsdl:operation name="CelsiusToFahrenheit">
<wsdl:input message="tns:CelsiusToFahrenheitSoapIn" />
<wsdl:output message="tns:CelsiusToFahrenheitSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:portType name="TempConvertHttpPost">
<wsdl:operation name="FahrenheitToCelsius">
<wsdl:input message="tns:FahrenheitToCelsiusHttpPostIn" />
<wsdl:output message="tns:FahrenheitToCelsiusHttpPostOut" />
</wsdl:operation>
<wsdl:operation name="CelsiusToFahrenheit">
<wsdl:input message="tns:CelsiusToFahrenheitHttpPostIn" />
<wsdl:output message="tns:CelsiusToFahrenheitHttpPostOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="TempConvertSoap" type="tns:TempConvertSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="FahrenheitToCelsius">
<soap:operation soapAction="http://tempuri.org/FahrenheitToCelsius" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="CelsiusToFahrenheit">
<soap:operation soapAction="http://tempuri.org/CelsiusToFahrenheit" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="TempConvertSoap12" type="tns:TempConvertSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="FahrenheitToCelsius">
<soap12:operation soapAction="http://tempuri.org/FahrenheitToCelsius" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="CelsiusToFahrenheit">
<soap12:operation soapAction="http://tempuri.org/CelsiusToFahrenheit" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="TempConvertHttpPost" type="tns:TempConvertHttpPost">
<http:binding verb="POST" />
<wsdl:operation name="FahrenheitToCelsius">
<http:operation location="/FahrenheitToCelsius" />
<wsdl:input>
<mime:content type="application/x-www-form-urlencoded" />
</wsdl:input>
<wsdl:output>
<mime:mimeXml part="Body" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="CelsiusToFahrenheit">
<http:operation location="/CelsiusToFahrenheit" />
<wsdl:input>
<mime:content type="application/x-www-form-urlencoded" />
</wsdl:input>
<wsdl:output>
<mime:mimeXml part="Body" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="TempConvert">
<wsdl:port name="TempConvertSoap" binding="tns:TempConvertSoap">
<soap:address location="http://www.w3schools.com/webservices/tempconvert.asmx" />
</wsdl:port>
<wsdl:port name="TempConvertSoap12" binding="tns:TempConvertSoap12">
<soap12:address location="http://www.w3schools.com/webservices/tempconvert.asmx" />
</wsdl:port>
<wsdl:port name="TempConvertHttpPost" binding="tns:TempConvertHttpPost">
<http:address location="http://www.w3schools.com/webservices/tempconvert.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

The following wsdl is obtained from the webservice TempConvert of w3schools.com
URL : http://www.w3schools.com/webservices/tempconvert.asmx?WSDL
Now,examine this WSDL closely.

wsdl definition- This contains lot of name space we don't need to care about this,these are all can be added/generated by tools. Generally a WSDL is generated by Tools.But we need to understand it content which help us to write the client code.

wsdl types : This contains the in-built xsd(Xml Schema Definition)for the types methods accept.We will discuss about XSD in detail in next part.

wsdl message : This contains the message name which can refer at various place for mention the types of input and output parameters for webservice methods.

wsdl operation : It contains the Methods provided by the webservice.

wsdl input/output : It contains the Methods inputs and output parameter name and it's type.Normally in big WSDL it being refer in external xsd's.

Other elements we actually no need to worry.Since once we obtained the WSDL ,next thing we have to do is generate java classes from it .It can done by tools.Once we obtained the java classes we can write the client code easily and  make a request to the webservice.

In the next part we will in detail about xsd, because it is important to understand what type of data a method accept. Please provide your comments.


 << Prev                                         Index                            Next >>


                     -------------------------------------------------------------------------------




Technology Blogs
blogs

41 comments:

  1. Waiting for Next...

    ReplyDelete
  2. Excellent and Easy to learn the Web Services in quicker manner

    ReplyDelete
  3. Excellent work. Also write some article on Web Services in Spring. This java web service tutorial series contains much information than other tutorials on some other web sites. Thanks for sharing such an excellent article.

    ReplyDelete
  4. Greate post. Keep posting such kind of information on your site.

    Im really impressed by it.
    Hi there, You've performed an excellent job. I will certainly digg it and personally recommend to my friends.
    I'm confident they will be benefited from this website.

    Here is my blog post ... Dr Dre Headphones

    ReplyDelete
  5. Hi there, I discovered your site by way of Google at the same time as looking for a related subject, your website got here
    up, it looks great. I've bookmarked it in my google
    bookmarks.
    Hi there, just become aware of your weblog thru Google, and found that it is really informative.
    I am gonna watch out for brussels. I will appreciate in case you proceed
    this in future. Many people shall be benefited out
    of your writing. Cheers!

    My page - Dr Dre Headphones

    ReplyDelete
  6. Hello! Would you mind if I share your blog with my
    myspace group? There's a lot of people that I think would really enjoy your content.
    Please let me know. Cheers

    Here is my site :: Beats Headphones

    ReplyDelete
  7. You actually make it seem so easy with your presentation but I find this topic to be actually something
    that I think I would never understand. It seems too complicated and very broad for me.
    I'm looking forward for your next post, I will try to get the hang of it!



    Look at my webpage - dr dre beats headphones

    ReplyDelete
  8. I really like your blog.. very nice colors & theme.

    Did you create this website yourself or did you hire someone to do it for you?
    Plz answer back as I'm looking to design my own blog and would like to know where u got this from.
    many thanks

    my webpage; Beats Headphones

    ReplyDelete
  9. You're so interesting! I don't think I have read anything like this before.
    So great to discover someone with genuine thoughts on this subject matter.

    Seriously.. thank you for starting this up. This web
    site is one thing that's needed on the web, someone with a little originality!


    Here is my site: Christian Louboutin Boots (cokeheadz.de)

    ReplyDelete
  10. Thanks a lot for sharing this with all of us you
    really understand what you are talking about! Bookmarked.

    Please also consult with my web site =). We can have a hyperlink alternate arrangement among us

    My blog post New Balance Online; micrec.it,

    ReplyDelete
  11. Fastidious answer back in return of this matter with firm arguments and describing the whole thing about that.


    Visit my blog - New Balance Online

    ReplyDelete
  12. Hey very nice blog!

    Here is my blog post; New Balance Online

    ReplyDelete
  13. Hurrah! Finally I got a blog from where I can in fact obtain helpful facts concerning my study and knowledge.



    my webpage :: Louis Vuitton Online

    ReplyDelete
  14. Hmm is anyone else having problems with the pictures on this
    blog loading? I'm trying to determine if its a problem on my end or
    if it's the blog. Any responses would be greatly appreciated.


    Also visit my web page :: Louis Vuitton Australia

    ReplyDelete
  15. Hurrah! Finally I got a weblog from where I be able to in fact get
    helpful facts regarding my study and knowledge.

    Also visit my web-site :: Dr Dre Beats Tour

    ReplyDelete
  16. It's actually a nice and helpful piece of information. I am glad that you just shared this helpful info with us.
    Please stay us up to date like this. Thanks for sharing.

    Here is my blog Louis Vuitton Discount

    ReplyDelete
  17. I know this website provides quality dependent articles or reviews and additional
    data, is there any other web page which gives these data in quality?



    Also visit my website Replica Louis Vuitton

    ReplyDelete
  18. Awesome issues here. I'm very happy to look your post.
    Thanks a lot and I am having a look ahead to contact you.
    Will you kindly drop me a mail?

    Also visit my site ... Christian Louboutin Outlet

    ReplyDelete
  19. I have read so many posts regarding the blogger lovers except this post
    is really a good piece of writing, keep it up.

    Review my page; Louis Vuitton Online

    ReplyDelete
  20. Hi terrific website! Does running a blog such as this take a large
    amount of work? I've virtually no understanding of computer programming however I was
    hoping to start my own blog in the near future. Anyway, if you
    have any recommendations or tips for new blog owners please share.
    I know this is off subject but I just needed to ask. Appreciate
    it!

    my web blog; Dr Dre Beats USA

    ReplyDelete
  21. Heya i am for the primary time here. I found this board and I
    find It truly useful & it helped me out a lot. I hope to give one
    thing back and aid others like you aided me.

    Here is my web-site: Christian Louboutin Pumps

    ReplyDelete
  22. Everything is very open with a precise clarification of the issues.
    It was truly informative. Your site is extremely helpful.
    Thanks for sharing!

    Feel free to surf to my website :: Christian Louboutin Boots

    ReplyDelete
  23. Yes! Finally someone writes about team.

    Here is my site; Cheap Christian Louboutin

    ReplyDelete
  24. Hey there would you mind sharing which blog platform you're using?

    I'm looking to start my own blog in the near future but I'm having a hard time selecting between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your design and style seems different then most blogs and I'm looking for something completely unique.
    P.S Sorry for being off-topic but I had to ask!

    Look into my web-site ... Replica Christian Louboutin

    ReplyDelete
  25. Wonderful post! We are linking to this particularly
    great article on our site. Keep up the good writing.


    My weblog Christian Louboutin Australia

    ReplyDelete
  26. Hi there to every body, it's my first go to see of this
    blog; this web site consists of amazing and genuinely excellent stuff designed for readers.


    Visit my web-site; Christian Louboutin Heels

    ReplyDelete
  27. I love your blog.. very nice colors & theme.

    Did you make this website yourself or did you hire someone to do it for you?
    Plz respond as I'm looking to design my own blog and would like to find out where u got this from.
    appreciate it

    Here is my webpage - Replica Christian Louboutin

    ReplyDelete
  28. Whats up this is somewhat of off topic but I was wanting
    to know if blogs use WYSIWYG editors or if you have to manually code
    with HTML. I'm starting a blog soon but have
    no coding experience so I wanted to get advice from someone with experience.
    Any help would be greatly appreciated!

    my web site: Christian Louboutin Sydney

    ReplyDelete
  29. Good post but I was wanting to know if you could write a litte more on this
    subject? I'd be very grateful if you could elaborate a little bit further.
    Kudos!

    my blog post Louis Vuitton Handbags

    ReplyDelete
  30. Thanks for sharing your info. I really appreciate your efforts and
    I will be waiting for your further post thanks once
    again.

    Feel free to surf to my web site ... Dr Dre Beats Pro

    ReplyDelete
  31. Howdy great website! Does running a blog similar to this require a massive amount work?
    I have very little expertise in programming
    but I had been hoping to start my own blog soon. Anyhow, if you have any recommendations or techniques for new
    blog owners please share. I know this is off subject but I just wanted to ask.
    Thanks a lot!

    my web page: Cheap New Balance

    ReplyDelete
  32. wonderful issues altogether, you simply received a new reader.

    What might you suggest about your put up that
    you made some days ago? Any certain?

    My web site: New Balance Sale

    ReplyDelete
  33. Thanks on your marvelous posting! I actually enjoyed reading it, you will be a great author.I will make sure to bookmark your blog and may
    come back from now on. I want to encourage you to definitely continue your great writing,
    have a nice afternoon!

    Take a look at my site :: Replica New Balance

    ReplyDelete
  34. Thanks very interesting blog!

    My web site - Christian Louboutin Pumps

    ReplyDelete
  35. Keep this going please, great job!

    My page New Balance 574

    ReplyDelete
  36. Outstanding story there. What occurred after? Take care!


    Here is my weblog - Christian Louboutin Sale

    ReplyDelete
  37. Thanks for sharing such a great information,
    Read more msgclub.net
    Whatsappbusiness,verifiedwhatsapp,whatsappapi

    ReplyDelete