Look at a WSDL first,
<?xml version="1.0"encoding="UTF-8"Standalone="No"? ><wsdl:definitions xmlns:tns="http://ws.lk.com"Xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"Xmlns:soap12="Http://www.w3.org/2003/05/soap-envelope"xmlns:xsd="Http://www.w3.org/2001/XMLSchema"xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/"XMLNS:SOAPENC12="http://www.w3.org/2003/05/soap-encoding"xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"Targetnamespace="http://ws.lk.com"> <wsdl:types> <xsd:schema xmlns:xsd="Http://www.w3.org/2001/XMLSchema"attributeFormDefault="qualified"elementformdefault="qualified"targetnamespace="http://ws.lk.com"> <xsd:element name="Example"> <xsd:complexType> <xsd:sequence> <xsd:element maxoccurs="1"minoccurs="1"Name="In0"nillable="true"Type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="Exampleresponse"> <xsd:complexType> <xsd:sequence> <xsd:element maxoccurs="1"minoccurs="1"Name=" out"nillable="true"Type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> </wsdl:types> <wsdl:message name="examplerequest"> <wsdl:part name="Parameters"Element="Tns:example"></wsdl:part> </wsdl:message> <wsdl:message name="Exampleresponse"> <wsdl:part name="Parameters"Element="Tns:exampleresponse"></wsdl:part> </wsdl:message> <wsdl:porttype name="Hellowssssporttype"> <wsdl:operation name="Example"> <wsdl:input name="examplerequest"Message="tns:examplerequest"></wsdl:input> <wsdl:output name="Exampleresponse"Message="Tns:exampleresponse"></wsdl:output> </wsdl:operation> </wsdl:portType> <wsdl:binding name="hellowsssshttpbinding"Type="Tns:hellowssssporttype"> <wsdlsoap:binding style="Document"Transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="Example"> <wsdlsoap:operation soapaction=""/> <wsdl:input name="examplerequest"> <wsdlsoap:body use="literal"/> </wsdl:input> <wsdl:output name="Exampleresponse"> <wsdlsoap:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="hellowssss"> <wsdl:port name="Hellowsssshttpport"binding="tns:hellowsssshttpbinding"> <wsdlsoap:address location="http://localhost:8080/HelloWS/services/HelloWSsss"/> </wsdl:port> </wsdl:service></wsdl:definitions>
Java code is generated first through MyEclipse's New Web Service Wizard, which can generate interfaces, implement classes, and then access http://localhost:8080/HelloWS/services/HelloWSsss?wsdl To get.
If opened through MyEclipse's MyEclipse WSDL editor, you get:
Like this picture, see a lot of times, every time is not understand ... Depressed. However, if you look at the corresponding. wsdl a little bit, it turns out that it's not that scary.
The basic structure is:
Wsdl:service have wsdl:port child elements, Wsdl:port have child elements wsdlsoap:address provide a URL for external access. Wsdl:port is also bound by the binding attribute to a wsdl:binding .
< Span class= "Webkit-html-attribute" >wsdl:binding has the type attribute specified Wsdl:porttype , Wsdl:porttype contains child elements wsdl:operation ,wsdl:operation The Name property specifies the method that it provides externally.
< Span class= "Webkit-html-attribute" >< Span class= "Webkit-html-attribute" > Child elements Wsdl:input , Wsdl:output The parameters and return values of the partial corresponding method. Wsdl:input , Wsdl:output The message property specifies Wsdl:message , child element Wsdl:part " specifies the
The xsd:element that is contained in Wsdl:types , the type attribute of the xsd:element child element Specifies the specific data type.
Such a description is confusing, but I am not very good at drawing to analyze it. Let's do it first.
Law:
If generated by the New Web Service Wizard, the default element property names are very regular:
Assume that the WS name is
Hellowssss, then--binding= "tns:hellowsssshttpbinding" type= "tns: Hellowssssporttype "-Wsdl:operation name=" example "
Two-way:
-Wsdl:input examplerequest", element= "tns:example"
Wsdl:output name= "exampleresponse ", element=" tns:exampleresponse "
__ So, notice that the input parameter message named Examplerequest, to the element tag, the name back to the example, of course, this insignificant, very small details ...
Xsd:element , Wsdl:message , Wsdl:porttype : wsdl:operation , input, output two wsdl:m Essage, two x xsd:element
No, anyway, I'm not afraid of WSDL at all!!
See such a picture, also do not have to worry about not understand! In fact, it's very simple, but the WSDL format makes a very simple WS description complex, and of course, it may be the norm to be able to handle complex problems and gradually refine them.