Learning WSDL

Furthering on the initial article I wrote about Learning SOAP, I progressed on to describing the message and interactions in a WSDL.  This is a summary of my learnings on WSDL.
WSDL in its entirety consists of an abstract part and a concrete part. This flexibility along with the ability to import external schemas and other wsdls make them thoroughly componentizable.
The following is a WSDL skeleton-
The following snippet shows the abstract piece of the message.
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                  xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                  xmlns:schema="http://bala.com/calcmsg"                <--------------- THIS IS WHAT I DEFINE
                  xmlns:tns="http://bala.com/calcmsg"
                   <--------------- THIS IS WHAT I DEFINE        
                  targetNamespace="http://bala.com/calcmsg"
             <--------------- THIS IS WHAT I DEFINE
>
   <wsdl:types>
      <xs:schema ......
   </wsdl:types>
   <wsdl:message name="..">
      <wsdl:part name="body" element="...."/>
   </wsdl:message>
   <wsdl:portType name="..">
    <wsdl:operation name="..">
        <wsdl:input message="..."/>
        <wsdl:output message="...."/>
    </wsdl:operation>
   </wsdl:portType>   

The types define the schema to be used by the messages. One could use <wsdl:import> or better yet use <xsd:import> within <wsdl:types>. Once the types are defind we then use that to build the messages. This is the actual wire format within SOAP envelope. Once the message is defind we set the abstract portType or interfaces. This defines the operation and th associated messages based on the message exchange pattern - in/out; out/in; in only; out only etc. The following shows the concrete section of the wsdl.

   <wsdl:binding name="CalcBinding" type="tns:CalcPortType">
      <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>  <---- THIS IS A SOAP/HTTP binding
      <wsdl:operation name="Add">
    <wsdlsoap:operation soapAction="http://bala.com/calc#Add"/>
    <wsdl:input>
        <wsdlsoap:body use="literal"/>
    </wsdl:input>
    <wsdl:output>
        <wsdlsoap:body use="literal"/>
    </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="CalcService">
      <wsdl:port name="CalcPort" binding="tns:CalcBinding">
         <wsdlsoap:address location="http://localhost:8080/axis2/services/CalcService"/>
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>

The binding maps back to what is defined in the portType section. This is where the infamous RPC/Encoded vs. Doc/Literal debate rears itself. Again the implication is that these are implementaion specific and comes into play in the concrete section. The service section is the physical EPR (end point reference).
As you can see each of the following element references the previous element in the document using the targetnamespace.
A word on namespaces
The targetnamespace creates the namespace for the document its on. It could be referenced in the definitions using a QNAME such that it can be prefixed on elements further down in the document.
                  xmlns:tns="http://bala.com/calcmsg"                 
                  targetNamespace="http://bala.com/calcmsg"


The default namespace is the one referenced without any QNAME for xmlns. All un-prefixed elements belong to this namespace. This can however be overridden further down in the document.
                  xmlns="http://bala.com/calcmsg"                 

To scope elements in a document you can reference them using the prefix defined by the QNAME..
                  xmlns:blah="http://bala.com/calcmsg"                 
                  .....
                    <blah:MyEntry....





When I compiled and ran this here is what I got-
C:\home\raj\VersionAxis>ant run
Buildfile: build.xml

run:
     [java] log4j:WARN No appenders could be found for logger (org.apache.axiom.
om.impl.builder.StAXOMBuilder).
     [java] log4j:WARN Please initialize the log4j system properly.
     [java] <ns:getVersionResponse xmlns:ns="http://axisversion.sample/xsd"><ret
urn>Hello I am Axis2 version service , My version is 1.0 May 05, 2006 (12:30:54
IST)</return></ns:getVersionResponse>
     [java] <ns:getVersionResponse xmlns:ns="http://axisversion.sample/xsd"><ret
urn>Hello I am Axis2 version service , My version is 1.0 May 05, 2006 (12:30:54
IST)</return></ns:getVersionResponse>

BUILD SUCCESSFUL
Total time: 2 seconds


U-IBM-8B44D616B41\raj
Last modified: Thu Aug 3 09:50:34 CDT 2006