WSDL rules and examples (1)

Source: Internet
Author: User

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>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.