First, let's look at a simple Java code. We use it as the WSDL service implementation code:
Public class test
{
Public String echo (string U ){
Return "hello" + U;
}
}
Then let's look at the WSDL exported using it:
<? XML version = "1.0" encoding = "UTF-8"?>
<WSDL: Definitions targetnamespace = "http://businessEngine.hongsoft.com" xmlns = "http://schemas.xmlsoap.org/wsdl/" xmlns: apachesoap = "http://xml.apache.org/xml-soap" xmlns: impl = "http://businessEngine.hongsoft.com-impl" xmlns: INTF = "http://businessEngine.hongsoft.com" xmlns: soapenc = "http://schemas.xmlsoap.org/soap/encoding/" xmlns: WSDL = "http://schemas.xmlsoap.org/wsdl/" xmlns: wsdlsoap = "http://schemas.xmlsoap.org/wsdl/soap/" xmlns: XSD = "http://www.w3.org/2001/XMLSchema">
<WSDL: types/> // we do not have a custom type
<WSDL: Message name = "echoresponse"> // The returned message.
<WSDL: part name = "echoreturn" type = "XSD: string"/>
</WSDL: Message>
<WSDL: Message name = "echorequest"> // Request Message
<WSDL: part name = "U" type = "XSD: string"/>
</WSDL: Message>
<WSDL: porttype name = "test"> // A porttype can look at a class
<WSDL: Operation name = "Echo" parameterorder = "U"> // an operation is a method.
<WSDL: input message = "INTF: echorequest" name = "echorequest"/>
<WSDL: Output Message = "INTF: echoresponse" name = "echoresponse"/>
</WSDL: Operation>
</WSDL: porttype>
<WSDL: Binding name = "testsoapbinding" type = "INTF: Test">
// Specify the message encapsulation method below
<Wsdlsoap: Binding style = "RPC" Transport = "http://schemas.xmlsoap.org/soap/http"/>
// The WSDL description is bound to the specific implementation. The soap method is used here.
<WSDL: Operation name = "Echo">
<Wsdlsoap: Operation soapaction = ""/>
<WSDL: input name = "echorequest">
<Wsdlsoap: Body encodingstyle = "http://schemas.xmlsoap.org/soap/encoding/" namespace = "http://businessEngine.hongsoft.com" use = "encoded"/>
</WSDL: input>
<WSDL: Output name = "echoresponse">
<Wsdlsoap: Body encodingstyle = "http://schemas.xmlsoap.org/soap/encoding/" namespace = "http://businessEngine.hongsoft.com" use = "encoded"/>
</WSDL: output>
</WSDL: Operation>
</WSDL: Binding>
// Associate the published service with the soap binding
<WSDL: Service name = "testservice">
<WSDL: Port binding = "INTF: testsoapbinding" name = "test">
<Wsdlsoap: address location = "http: // localhost: 8080/hongsoft/services/test"/>
</WSDL: Port>
</WSDL: Service>
</WSDL: Definitions>