Skip to content

Instantly share code, notes, and snippets.

@nifrasismail
Created May 13, 2016 06:42
Show Gist options
  • Save nifrasismail/883aae9a1b9f1edbfd010c60d2fb292b to your computer and use it in GitHub Desktop.
Save nifrasismail/883aae9a1b9f1edbfd010c60d2fb292b to your computer and use it in GitHub Desktop.
<!-- It is the place to define and give a name for web service
It is the only one root of the wsdl
The default namesapce is wsdl name sapce others are define when they are need
-->
<definitions name="HelloService"
targetNamespace="http://www.examples.com/wsdl/HelloService.wsdl"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.examples.com/wsdl/HelloService.wsdl"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!-- The messge element describe the exchange data between web service provider and the consumer
A web service have two message elements.
1. input : Describe the parameter for the web service
2. output : Describer the return type for the web service.
-->
<message name="SayHelloRequest">
<!-- Each message have zero or more <part> parameters for the web service
Each <part> is for one parameter of the message
Here this use type as Xml Schema defined type, WSDL not strictly typed
-->
<part name="firstName" type="xsd:string"/>
</message>
<message name="SayHelloResponse">
<part name="greeting" type="xsd:string"/>
</message>
<!--
<portType> can combine one request and one response message into a single request/response operation
-->
<portType name="Hello_PortType">
<operation name="sayHello">
<input message="tns:SayHelloRequest"/>
<output message="tns:SayHelloResponse"/>
</operation>
</portType>
<!-- <binding> element giving a detail about how the port type operation is transmitted over the wire.
The bindings can be made available via multiple transports including HTTP GET, HTTP POST, or SOAP.
The biniding should provide concrete information on which protocol is used.
Here we are using SOAP
can specify multiple binding for single Port type
-->
<binding name="Hello_Binding" type="tns:Hello_PortType">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="sayHello">
<soap:operation soapAction="sayHello"/>
<input>
<soap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:examples:helloservice"
use="encoded"/>
</input>
<output>
<soap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:examples:helloservice"
use="encoded"/>
</output>
</operation>
</binding>
<service name="Hello_Service">
<documentation>WSDL File for HelloService</documentation>
<port binding="tns:Hello_Binding" name="Hello_Port">
<soap:address
location="http://www.wso2.com/SayHello/">
</port>
</service>
</definitions>
<!--
1. One-way : The service only receive a message - The Operation only have single input element.
<wsdl:definitions >
<wsdl:portType >
<wsdl:operation name="nmtoken">
<wsdl:input name="nmtoken"? message="qname"/>
</wsdl:operation>
</wsdl:portType >
</wsdl:definitions>
2. Request Response : The service receive a message and send a response - The Operation have one single input and output element
<wsdl:definitions >
<wsdl:portType >
<wsdl:operation name="nmtoken" parameterOrder="nmtokens">
<wsdl:input name="nmtoken"? message="qname"/>
<wsdl:output name="nmtoken"? message="qname"/>
<wsdl:fault name="nmtoken" message="qname"/>
</wsdl:operation>
</wsdl:portType >
</wsdl:definitions>
3. Solicit- Response : The service sends and recevice a response - like above but additionally for enacaptualate error
additional fault element also specified.
<wsdl:definitions >
<wsdl:portType >
<wsdl:operation name="nmtoken" parameterOrder="nmtokens">
<wsdl:output name="nmtoken"? message="qname"/>
<wsdl:input name="nmtoken"? message="qname"/>
<wsdl:fault name="nmtoken" message="qname"/>
</wsdl:operation>
</wsdl:portType >
</wsdl:definitions>
4. Notification : The service sends a message - Only have out put elements.
<wsdl:definitions >
<wsdl:portType >
<wsdl:operation name="nmtoken">
<wsdl:output name="nmtoken"? message="qname"/>
</wsdl:operation>
</wsdl:portType >
</wsdl:definitions>
-->
-->-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment