- 浏览: 202606 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (175)
- JAVA BASIC (34)
- 资料 (2)
- WEB (4)
- Android (2)
- DBMS (2)
- 我的小东西 (4)
- IT生活 (6)
- portal (1)
- jsp (6)
- user experience (1)
- SSH (12)
- Flex (13)
- FLEX DEBUGER does not work (1)
- teacher (1)
- tools (2)
- maven (3)
- opensource (3)
- OUTLOOK (1)
- 经验之谈 (4)
- SQL (2)
- BOOK (1)
- jprofiler (1)
- hp veer 4g (2)
- axis2 (1)
- JAVASCRIPT (8)
- httpd (2)
- Webservice (3)
- JBOSS (9)
- JPA (2)
- JSF (1)
- XMLBean (1)
- J2EE6 (1)
- apache (1)
- HTML (1)
- review (1)
- Spring (7)
- hot cache (1)
- Websphere (1)
- 软件管理 (1)
- redis (1)
- Sitemesh (1)
- JDBC (1)
- http (2)
- linux (3)
- new-framework (2)
- Log4j (3)
- JMX (1)
- springmvc (2)
- Sprint Boot (1)
- NIO (2)
- mongodb (1)
- 一个监控系统引发的学习 (1)
- kafka消息只消费一次应该怎么做 (1)
- 一眼识别程序功力 (1)
最新评论
-
tcgdy0201:
挖!博主好棒!博主好腻害!
logback.xml immediate=false 到底缓存空间是多大 -
k1280000:
jasonlong10 写道 楼主别光写报错,有没什么解决方法 ...
SpringMVC 在 Jboss 下会报的 warn -
jasonlong10:
楼主别光写报错,有没什么解决方法啊?
SpringMVC 在 Jboss 下会报的 warn -
rtttyu23:
不错,没报错了...这些配置的文件真麻烦,不深入了解,配置的很 ...
Error creating bean with name '_messageBrokerDefaultHandlerMapping': Initializa -
thinkcq168:
这样还是不可以,还是报错,我也有同样的错误,求高手!
Error creating bean with name '_messageBrokerDefaultHandlerMapping': Initializa
Understanding WSDL (http://msdn.microsoft.com/en-us/library/ms996486.aspx)
Aaron Skonnard
Northface University
October 2003
Applies to:
Web Services
Web Services Description Language (WSDL) 1.1
WS-I Basic Profile Version 1.0
XML Messaging
XML Schema
Summary: See the importance of WSDL in the overall Web services architecture, as it describes the complete contract for application communication. Make Web services widely approachable by using WSDL definitions to generate code that knows precisely how to interact with the Web service described, and hides tedious details in sending and receiving SOAP messages over different protocols. (24 printed pages)
Contents
Overview
WSDL Basics
Types
Messages
Interfaces (portTypes)
Bindings
Services
WSDL Editors
Where Are We?
References
Appendix: WSDL
Overview
XML makes it possible for developers to expose valuable resources in a highly interoperable fashion, where a resource is any type of application or data store used within an organization. The XML Web services architecture defines a standard mechanism for making resources available via XML messaging. Being able to access a resource by simply transmitting XML messages over standard protocols like TCP, HTTP, or SMTP greatly lowers the bar for potential consumers. The term "Web service" (or simply "service") typically refers to the piece of code implementing the XML interface to a resource, which may otherwise be difficult to access (see Figure 1).
Figure 1: Resources and services
This architecture makes it possible for any consumer with XML support to integrate with Web service applications. However, in order to accomplish this, consumers must determine the precise XML interface along with other miscellaneous message details a priori. XML Schema can partially fill this need because it allows developers to describe the structure of XML messages. XML Schema alone, however, can't describe the additional details involved in communicating with a Web service.
A schema definition simply tells you what XML messages may be used but not how they relate to each other. For example, if there's an XML element named Add and another named AddResponse , it's likely they're related to each other but there's no way to indicate that in the schema. Hence, in addition to being aware of the messages, consumers must also be aware of the possible message exchanges supported by the Web service (e.g., if you send an Add message, you get an AddResponse message back).
A message exchange is also referred to as an operation. Operations are what consumers care about most since they're the focal point of interacting with the service (see Figure 2). Whenever I approach a new Web service, I first inspect its list of supported operations to get an overall feel for what it offers.
Figure 2: Messages and operations
It's common for developers to group related operations into interfaces. Consumers must be aware of these groupings since it impacts the way they write their code. This is especially important to developers working with Web services in object-oriented environments since the XML interfaces can map to programmatic interfaces (or abstract classes) in their language of choice.
Consumers must also know what communication protocol to use for sending messages to the service, along with the specific mechanics involved in using the given protocol such as the use of commands, headers, and error codes. A binding specifies the concrete details of what goes on the wire by outlining how to use an interface with a particular communication protocol. A binding also influences the way abstract messages are encoded on the wire by specifying the style of service (document vs. RPC) and the encoding mechanism (literal vs. encoded). Check out Understanding SOAP for more background on these concepts.
A service can support multiple bindings for a given interface, but each binding should be accessible at a unique address identified by a URI, also referred to as a Web service endpoint (see Figure 3).
Figure 3: Interfaces and bindings
Consumers must discover all of the details described above before they can interact with a Web service. The Web Services Description Language (WSDL) provides an XML grammar for describing these details. WSDL picks up where XML Schema left off by providing a way to group messages into operations and operations into interfaces. It also provides a way to define bindings for each interface and protocol combination along with the endpoint address for each one. A complete WSDL definition contains all of the information necessary to invoke a Web service. Developers that want to make it easy for others to access their services should make WSDL definitions available.
WSDL plays an important role in the overall Web services architecture since it describes the complete contract for application communication (similar to the role of IDL in the DCOM architecture). Although other techniques exist for describing Web services, the WS-I Basic Profile Version 1.0 mandates the use of WSDL and XML Schema (see Figure 4) for describing Web services. This helps ensure interoperability at the service description layer.
Figure 4: WS-I Basic Profile 1.0 technologies
Since WSDL is a machine-readable language (e.g., it's just an XML file), tools and infrastructure can be easily built around it. Today developers can use WSDL definitions to generate code that knows precisely how to interact with the Web service it describes. This type of code generation hides the tedious details involved in sending and receiving SOAP messages over different protocols and makes Web services approachable by the masses.
The Microsoft® .NET Framework comes with a command-line utility named wsdl.exe that generates classes from WSDL definitions. Wsdl.exe can generate one class for consuming the service and another for implementing the service. (Apache Axis comes with a similar utility named WSDL2Java that performs the same function for Java classes.) Classes generated from the same WSDL definition should be able to communicate with each other through the WSDL-provided interfaces, regardless of the programming languages in use (see Figure 5).
Figure 5: WSDL and code generation
WSDL 1.1 is considered the de-facto standard today because of it's industry-wide support. Most Web services toolkits support WSDL 1.1, but there have been some interoperability problems across the different implementations. Many developers believe that the extensive flexibility of WSDL (and the resulting complexity) is the fundamental source of these problems. The WS-I has helped resolve some of these issues by encouraging developers to use certain parts of the specification and discouraging them from using others.
The W3C is actively working on the next "official" version of WSDL, WSDL 1.2 , but it's currently only a Working Draft and not supported by the mainstream toolkits, if any. The remainder of this article discusses the details of a WSDL 1.1 definition and highlights some of the WS-I basic profile suggestions along the way.
WSDL Basics
A WSDL definition is an XML document with a root definition element from the http://schemas.xmlsoap.org/wsdl/ namespace. The entire WSDL schema is available at http://schemas.xmlsoap.org/wsdl/ for your reference. The definitions element may contain several other elements including types, message, portType, binding, and service, all of which come from the http://schemas.xmlsoap.org/wsdl/ namespace. The following illustrates the basic structure of a WSDL definition:
<!-- WSDL definition structure --> <definitions name="MathService" targetNamespace="http://example.org/math/" xmlns="http://schemas.xmlsoap.org/wsdl/" > <!-- abstract definitions --> <types> ... <message> ... <portType> ... <!-- concrete definitions --> <binding> ... <service> ... </definition>
Notice that you must specify a target namespace for your WSDL definition, just like you would for an XML Schema definition. Anything that you name in the WSDL definition (like a message, portType, binding, etc.) automatically becomes part of the WSDL definition's target namespace defined by the targetNamespace attribute. Hence, when you reference something by name in your WSDL file, you must remember to use a qualified name.
The first three elements (types , message , and portType ) are all abstract definitions of the Web service interface. These elements constitute the programmatic interface that you typically interface with in your code. The last two elements (binding and service ) describe the concrete details of how the abstract interface maps to messages on the wire. These details are typically handled by the underlying infrastructure, not by your application code. Table 1 provides brief definitions for each of these core WSDL elements and the remaining sections discuss them in more detail.
Table 1. WSDL Elements
Element Name | Description |
types | A container for abstract type definitions defined using XML Schema |
message | A definition of an abstract message that may consist of multiple parts, each part may be of a different type |
portType | An abstract set of operations supported by one or more endpoints (commonly known as an interface); operations are defined by an exchange of messages |
binding | A concrete protocol and data format specification for a particular portType |
service | A collection of related endpoints, where an endpoint is defined as a combination of a binding and an address (URI) |
Types
The WSDL types element is a container for XML Schema type definitions. The type definitions you place here are referenced from higher-level message definitions in order to define the structural details of the message. Officially, WSDL 1.1 allows the use of any type definition language, although it strongly encourages the use of XML Schema and treats it as its intrinsic type system. The WS-I enforces this by mandating the use of XML Schema in the Basic Profile 1.0.
The types element contains zero or more schema elements from the http://www.w3.org/2001/XMLSchema namespace. The basic structure of the types element (with namespaces omitted) is as follows (* means zero or more):
<definitions .... > <types> <xsd:schema .... />* </types> </definitions>
You can use any XML Schema construct within the schema element, such simple type definitions, complex type definitions, and element definitions. The following WSDL fragment contains an XML Schema definition that defines four elements of type MathInput (Add , Subtract , Multiply , and Divide ) and four elements of type MathOutput (AddResponse , SubtractResponse , MultiplyResponse , and DivideResponse ).
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:y="http://example.org/math/" xmlns:ns="http://example.org/math/types/" targetNamespace="http://example.org/math/" > <types> <xs:schema targetNamespace="http://example.org/math/types/" xmlns="http://example.org/math/types/" > <xs:complexType name="MathInput"> <xs:sequence> <xs:element name="x" type="xs:double"/> <xs:element name="y" type="xs:double"/> </xs:sequence> </xs:complexType> <xs:complexType name="MathOutput"> <xs:sequence> <xs:element name="result" type="xs:double"/> </xs:sequence> </xs:complexType> <xs:element name="Add" type="MathInput"/> <xs:element name="AddResponse" type="MathOutput"/> <xs:element name="Subtract" type="MathInput"/> <xs:element name="SubtractResponse" type="MathOutput"/> <xs:element name="Multiply" type="MathInput"/> <xs:element name="MultiplyResponse" type="MathOutput"/> <xs:element name="Divide" type="MathInput"/> <xs:element name="DivideResponse" type="MathOutput"/> </xs:schema> </types> ... </definitions>
If you're new to XML Schema and need to ramp up, check out Understanding XML Schema . Once you have your XML Schema types defined, the next step is to define the logical messages that will constitute your operations.
Messages
The WSDL message element defines an abstract message that can serve as the input or output of an operation. Messages consist of one or more part elements, where each part is associated with either an element (when using document style) or a type (when using RPC style). The basic structure of a message definition is as follows (* means zero or more and ? means optional):
<definitions .... > <message name="nmtoken"> * <part name="nmtoken" element="qname"? type="qname"?/> * </message> </definitions>
The messages and parts must be named making it possible to refer to them from elsewhere in the WSDL definition. If you're defining an RPC style service, the message parts represent the method's parameters. In this case, the name of the part becomes the name of an element in the concrete message and its structure is determined by the supplied type attribute. If you're defining a document style service, the parts simply refer to the XML elements that are placed within the body (referenced by the element attribute). The following example contains several message definitions that refer to elements by name:
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:y="http://example.org/math/" xmlns:ns="http://example.org/math/types/" targetNamespace="http://example.org/math/" > ... <message name="AddMessage"> <part name="parameter" element="ns:Add"/> </message> <message name="AddResponseMessage"> <part name="parameter" element="ns:AddResponse"/> </message> <message name="SubtractMessage"> <part name="parameter" element="ns:Subtract"/> </message> <message name="SubtractResponseMessage"> <part name="parameter" element="ns:SubtractResponse"/> </message> ... </definitions>
Although the message parts typically refer to XML types or elements, they can also refer to non-XML types. This allows WSDL to represent a wide range of messages that contain a mixture of data formats, as is the case with multi-part MIME.
Note The message and type definitions in WSDL are considered to be abstract definitions. This means you don't know how they'll appear in the concrete message format until you've applied a binding to them. For example, if you use one abstract message with two different bindings, it's possible that the two concrete messages will look different. Only with 'literal' bindings are the abstract definitions guaranteed to accurately describe the concrete message format. See the Bindings section for more details.
Interfaces (portTypes)
The WSDL portType element defines a group of operations, also known as an interface in most environments. Unfortunately, the term "portType" is quite confusing so you're better off using the term "interface" in conversation. WSDL 1.2 has already removed "portType" and replaced it with "interface" in the current draft of the language.
A portType element contains zero or more operation elements. The basic structure of a portType is as follows (* means zero or more):
<definitions .... > <portType name="nmtoken"> <operation name="nmtoken" .... /> * </portType> </definitions>
Each portType must be given a unique name making it possible to refer to it from elsewhere in the WSDL definition. Each operation element contains a combination of input and output elements, and when you have an output element you can also have a fault element. The order of these elements defines the message exchange pattern (MEP) supported by the given operation.
For example, an input element followed by an output element defines a request-response operation, while an output element followed by an input element defines a solicit-response operation. An operation that only contains an input element defines a one-way operation, while an operation that only contains an output element defines a notification operation. Table 2 describes the four MEP primitives defined by WSDL.
Table 2. Message Exchange Patterns
MEP | Description |
One-way | The endpoint receives a message. |
Request-response | The endpoint receives a message and sends a correlated message. |
Solicit-response | The endpoint sends a message and receives a correlated message. |
Notification | The endpoint sends a message. |
The input, output, and fault elements used in an operation must refer to a message definition by name. The following example defines a portType named MathInterface that consists of four math operations: Add , Subtract , Multiply , and Divide .
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:y="http://example.org/math/" xmlns:ns="http://example.org/math/types/" targetNamespace="http://example.org/math/" > ... <portType name="MathInterface"> <operation name="Add"> <input message="y:AddMessage"/> <output message="y:AddResponseMessage"/> </operation> <operation name="Subtract"> <input message="y:SubtractMessage"/> <output message="y:SubtractResponseMessage"/> </operation> <operation name="Multiply"> <input message="y:MultiplyMessage"/> <output message="y:MultiplyResponseMessage"/> </operation> <operation name="Divide"> <input message="y:DivideMessage"/> <output message="y:DivideResponseMessage"/> </operation> </portType> ... </definitions>
A portType is still considered an abstract definition because you don't know how its messages are represented on the wire until you apply a binding.
Bindings
The WSDL binding element describes the concrete details of using a particular portType with a given protocol. The binding element contains several extensibility elements as well as a WSDL operation element for each operation in the portType it's describing. The basic structure of a binding element is as follows (* means zero or more and ? means optional):
<wsdl:definitions .... > <wsdl:binding name="nmtoken" type="qname"> * <-- extensibility element providing binding details --> * <wsdl:operation name="nmtoken"> * <-- extensibility element for operation details --> * <wsdl:input name="nmtoken"? > ? <-- extensibility element for body details --> </wsdl:input> <wsdl:output name="nmtoken"? > ? <-- extensibility element for body details --> </wsdl:output> <wsdl:fault name="nmtoken"> * <-- extensibility element for body details --> </wsdl:fault> </wsdl:operation> </wsdl:binding> </wsdl:definitions>
A binding must be a given a unique name so you can refer to it from elsewhere in the WSDL definition. The binding must also specify which portType it's describing through the type attribute. For example, the following binding is called MathSoapHttpBinding and it describes the concrete details for the MathInterface portType:
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:y="http://example.org/math/" xmlns:ns="http://example.org/math/types/" targetNamespace="http://example.org/math/" > ... <binding name="MathSoapHttpBinding" type="y:MathInterface"> ... <-- extensibility element --> <operation name="Add"> ... <-- extensibility element --> <input> ... <-- extensibility element --> </input> <output> ... <-- extensibility element --> </output> </operation> ... </binding> ... </definitions>
The WSDL binding element is generic. It simply defines the framework for describing binding details. The actual binding details are provided using extensibility elements. This architecture allows WSDL to evolve over time since any element can be used in the predefined slots. The WSDL specification provides some binding elements for describing SOAP bindings, although they're in a different namespace. The following example illustrates a SOAP/HTTP binding for the MathInterface portType:
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:y="http://example.org/math/" xmlns:ns="http://example.org/math/types/" targetNamespace="http://example.org/math/" > ... <binding name="MathSoapHttpBinding" type="y:MathInterface"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="Add"> <soap:operation soapAction="http://example.org/math/#Add"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> ... </binding> ... </definitions>
The soap:binding element indicates that this is a SOAP 1.1 binding. It also indicates the default style of service (possible values include document or rpc ) along with the required transport protocol (HTTP in this case). The soap:operation element defines the SOAPAction HTTP header value for each operation. And the soap:body element defines how the message parts appear inside of the SOAP Body element (possible values include literal or encoded ). There are other binding-specific details that can be specified this way.
Using document style in SOAP indicates that the body will contain an XML document, and that the message parts specify the XML elements that will be placed there. Using rpc style in SOAP indicates that the body will contain an XML representation of a method call and that the message parts represent the parameters to the method.
The use attribute specifies the encoding that should be used to translate the abstract message parts into a concrete representation. In the case of 'encoded', the abstract definitions are translated into a concrete format by applying the SOAP encoding rules. In the case of 'literal', the abstract type definitions become the concrete definitions themselves (they're 'literal' definitions). In this case, you can simply inspect the XML Schema type definitions to determine the concrete message format. For example, the Add operation for the above document/literal binding looks like this on the wire:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" > <SOAP-ENV:Body> <m:Add xmlns:m="http://example.org/math/types/"> <x>3.14159265358979</x> <y>3.14159265358979</y> </m:Add> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
Notice that the SOAP Body simply contains an instance of the Add element defined in the schema—this is what makes document/literal so attractive. Now let's see what the message would look like using an rpc/encoded binding. The following WSDL fragment contains a revised rpc/encoded binding and the message definitions use type instead of element :
... <message name="AddMessage"> <part name="parameter" type="ns:MathInput"/> </message> <message name="AddResponseMessage"> <part name="parameter" type="ns:MathOutput"/> </message> ... <binding name="MathSoapHttpBinding" type="y:MathInterface"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="Add"> <soap:operation soapAction="http://example.org/math/#Add"/> <input> <soap:body use="encoded"/> </input> <output> <soap:body use="encoded"/> </output> </operation> ... </binding>
With these definitions in place, the Add operation looks much different as you can see here:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:m0="http://example.org/math/types/" > <SOAP-ENV:Body> <m:Add xmlns:m="http://example.org/math/"> <parameter xsi:type="m0:MathInput"> <x xsi:type="xsd:double">3.14159265358979</x> <y xsi:type="xsd:double">3.14159265358979</y> </parameter> </m:Add> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
Using literal definitions is much cleaner and easier for the tools to get right. Using the encoding rules has led to significant interoperability problems across toolkits. It also leads to weird situations like not being able to validate the wire-level message against the original schema definition (since it's abstract and not a true representation of the message). To help alleviate the confusion and facilitate better interoperability, the WS-I prohibits the use of encodings altogether, including the SOAP encoding, in the Basic Profile 1.0. This means that only literal definitions may be used if you care about Basic Profile 1.0 compliance. For more information on this topic, check out The Argument Against SOAP Encoding .
The most common combination of SOAP style/use attributes is document/literal (what I used in the first example above). It's the default in most toolkits today and the one that comes with the fewest interoperability issues. The second most common combination is rpc/encoded but now that the WS-I has banned the use of 'encoded', it's no longer a viable option. The only other combination that exists is rpc/literal . Check out RPC/Literal and Freedom of Choice for a discussion on rpc/literal and why document/literal is superior.
In addition to the SOAP binding, the WSDL specification defines two other bindings: one for HTTP GET & POST and another for MIME. Check out the examples in the specification for more details.
Services
The WSDL service element defines a collection of ports , or endpoints , that expose a particular binding. The basic structure of the service element is as follows:
<definitions .... > <service .... > * <port name="nmtoken" binding="qname"> * <-- extensibility element defines address details --> </port> </service> </definitions>
You must give each port a name and assign it a binding . Then, within the port element, you use an extensibility element to define the address details specific to the binding. For example, the following sample defines a service called MathService that exposes the MathSoapHttpBinding at the http://localhost/math/math.asmx URL:
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:y="http://example.org/math/" xmlns:ns="http://example.org/math/types/" targetNamespace="http://example.org/math/" > ... <service name="MathService"> <port name="MathEndpoint" binding="y:MathSoapHttpBinding"> <soap:address location="http://localhost/math/math.asmx"/> </port> </service> </definitions>
The service element completes the WSDL definition. You could now take this definition and easily generate code that implements the complete interface in your language of choice. I've provided the complete WSDL definition that we've been walking through in Appendix A .
WSDL Editors
I generated this WSDL file using XML Spy 5.0 (see Figure 6). There are several editors available today that nearly make authoring WSDL pleasant. You can check out some reviews from one of my previous articles in MSDN Magazine .
Figure 6. MathService WSDL definition generated using XML Spy 5.0
Where Are We?
WSDL builds on XML Schema by making it possible to fully describe Web services in terms of messages, operations, interfaces (portTypes), bindings, and service endpoints. WSDL definitions make it possible to generate code that implements the given interface, on either the client or the server, making Web services accessible to the masses. WSDL is capable of much more than what I've described here but if you truly care about interoperability, you should limit yourself to the WS-I Basic Profile 1.0 guidelines that we've covered here.
References
Essential XML Quick Reference: A Programmer's Reference to XML, XPath, XSLT, XML Schema, SOAP, and More by Aaron Skonnard and Martin Gudgin, DevelopMentor Books, Addison-Wesley Pub. Co., 2001
Web Services Description Language (WSDL) 1.1
Web Services Description Language (WSDL) Version 1.2 Part 1: Core Language
WS-I Basic Profile Version 1.0
Appendix: WSDL
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:y="http://example.org/math/" xmlns:ns="http://example.org/math/types/" targetNamespace="http://example.org/math/"> <types> <xs:schema targetNamespace="http://example.org/math/types/" xmlns="http://example.org/math/types/" elementFormDefault="unqualified" attributeFormDefault="unqualified"> <xs:complexType name="MathInput"> <xs:sequence> <xs:element name="x" type="xs:double"/> <xs:element name="y" type="xs:double"/> </xs:sequence> </xs:complexType> <xs:complexType name="MathOutput"> <xs:sequence> <xs:element name="result" type="xs:double"/> </xs:sequence> </xs:complexType> <xs:element name="Add" type="MathInput"/> <xs:element name="AddResponse" type="MathOutput"/> <xs:element name="Subtract" type="MathInput"/> <xs:element name="SubtractResponse" type="MathOutput"/> <xs:element name="Multiply" type="MathInput"/> <xs:element name="MultiplyResponse" type="MathOutput"/> <xs:element name="Divide" type="MathInput"/> <xs:element name="DivideResponse" type="MathOutput"/> </xs:schema> </types> <message name="AddMessage"> <part name="parameters" element="ns:Add"/> </message> <message name="AddResponseMessage"> <part name="parameters" element="ns:AddResponse"/> </message> <message name="SubtractMessage"> <part name="parameters" element="ns:Subtract"/> </message> <message name="SubtractResponseMessage"> <part name="parameters" element="ns:SubtractResponse"/> </message> <message name="MultiplyMessage"> <part name="parameters" element="ns:Multiply"/> </message> <message name="MultiplyResponseMessage"> <part name="parameters" element="ns:MultiplyResponse"/> </message> <message name="DivideMessage"> <part name="parameters" element="ns:Divide"/> </message> <message name="DivideResponseMessage"> <part name="parameters" element="ns:DivideResponse"/> </message> <portType name="MathInterface"> <operation name="Add"> <input message="y:AddMessage"/> <output message="y:AddResponseMessage"/> </operation> <operation name="Subtract"> <input message="y:SubtractMessage"/> <output message="y:SubtractResponseMessage"/> </operation> <operation name="Multiply"> <input message="y:MultiplyMessage"/> <output message="y:MultiplyResponseMessage"/> </operation> <operation name="Divide"> <input message="y:DivideMessage"/> <output message="y:DivideResponseMessage"/> </operation> </portType> <binding name="MathSoapHttpBinding" type="y:MathInterface"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="Add"> <soap:operation soapAction="http://example.org/math/#Add"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> <operation name="Subtract"> <soap:operation soapAction="http://example.org/math/#Subtract"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> <operation name="Multiply"> <soap:operation soapAction="http://example.org/math/#Multiply"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> <operation name="Divide"> <soap:operation soapAction="http://example.org/math/#Divide"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> </binding> <service name="MathService"> <port name="MathEndpoint" binding="y:MathSoapHttpBinding"> <soap:address location="http://localhost/math/math.asmx"/> </port> </service> </definitions>
相关推荐
WSDL4J是一个Java库,专门用于解析和操作Web服务描述语言(WSDL)文件。WSDL是一种XML格式,用于定义网络服务的接口,包括其输入、输出、操作和服务绑定等信息。理解WSDL4J的工作原理和使用方法对于开发和消费基于...
在本压缩包“wsdl.rar”中,包含了若干个WSDL文档,这对于学习和理解WebService的开发者来说是一份宝贵的学习资料。 **1. WSDL基本结构** WSDL文档由一系列元素组成,包括服务、消息、操作、绑定、端口类型和接口。...
在IT行业中,WSDL(Web Services Description Language)是一种XML格式的规范,用于描述Web服务及其接口。它定义了服务提供商和消费者之间的交互方式,包括消息格式、操作、地址和协议等。当我们面对“WSDL调用测试...
在IT行业中,Web服务是应用程序之间交互的一种标准方式,而WSDL(Web Services Description Language)则是用来定义这些服务接口的XML格式规范。本项目“WSDL.rar”提供了一个C#编写的WSDL解析器,旨在帮助开发者更...
Web服务描述语言(WSDL,Web Services Description Language)是一种XML格式,用于定义Web服务的接口,使得客户端和服务端能够理解如何交互。WSDL文件描述了服务的位置、服务使用的消息协议以及服务提供的操作。在...
JavaScript调用WSDL(Web Service Definition Language)是Web服务客户端编程的一个重要方面,尤其是在需要与SOAP(Simple Object Access Protocol)服务交互时。本示例主要介绍如何在JavaScript中使用不同的库和...
**简单WSDL实例详解** WSDL,全称为Web Services Description Language,是用于描述Web服务的一种XML格式。它定义了服务的接口,包括服务提供的操作、消息格式、通信协议以及服务的位置。WSDL文件是Web服务客户端和...
在.NET框架中,`wsdl.exe`工具是一个实用程序,可以帮助开发者从现有代码生成WSDL文档,这个过程被称为“代码到WSDL”的转换。本文将深入探讨`wsdl.exe`的工作原理和使用方法。 1. **什么是WSDL?** WSDL是基于XML...
WS-Discovery、WS-Profile、WS-Security等是ONVIF协议中的关键部分,其中WS-Device管理和WS-Video等服务使用WSDL(Web Services Description Language)文件来描述其接口和服务。 标题提及的“onvif所有 wsdl文件”...
Java2WSDL 和 WSDL2Java 操作指南 Java2WSDL 和 WSDL2Java 是两种常用的 Web 服务开发工具,分别用于将 Java 类转换为 WSDL 文件和将 WSDL 文件转换为 Java 代码。在本文中,我们将详细介绍 Java2WSDL 和 WSDL2Java...
对于Web Service接口,尤其是基于WSDL(Web Services Description Language)的服务,Postman同样提供了强大的支持。本文将详细阐述如何在Postman中配置并调用WSDL接口。 首先,我们需要理解WSDL。WSDL是一种XML...
6. **WSDL的结构与元素**:理解WSDL文件的结构至关重要,其中包括`<wsdl:types>`定义数据类型,`<wsdl:message>`定义通信消息,`<wsdl:portType>`定义服务接口,`<wsdl:binding>`定义通信方式,以及`<wsdl:service>`...
一个用wsdl4j.jar,ws-commons-java5-1.0.1.jar,XmlSchema-1.3.2.jar完全解析wsdl的例子, 本例子原本是xcalia studio中的一个模块,拿来和初次接触的人参考,因为我走了很多弯路,希望别人能少走。
在IT行业中,Web服务是应用程序之间进行通信的一种标准方法,而WSDL(Web Services Description Language)则是一种XML格式,用于定义Web服务的具体操作、消息结构、接口和绑定。本篇文章将详细探讨“wsdl生成java...
**WSDL2Java命令使用详解** 在Web服务开发中,WSDL(Web Service Description Language)是一种XML格式,用于定义服务接口、操作、消息结构等。它使得服务提供者和服务消费者可以进行互操作。Apache Axis是Java平台...
**WSDL解析工具详解** WSDL(Web Services Description Language)是一种XML格式,用于定义网络服务的接口,描述了服务的位置、消息格式以及如何调用这些服务。WSDL解析工具是开发人员用来理解和操作WSDL文件的重要...
WSDL(Web Services Description Language)是一种XML格式,用于定义网络服务的接口,描述了服务的位置、消息格式以及如何调用这些服务。对于iOS开发者来说,与Web服务交互时,通常需要将WSDL接口转换为Objective-C...
使用 WSDL 部署 Web 服务:Web 服务和 WSDL 简介 第一部分:Web 服务和 WSDL 简介 WSDL(Web 服务描述语言)是一种用于描述 Web 服务的语言,它提供了一种格式来描述 Web 服务,包括服务的接口、操作、消息、数据...
在IT行业中,尤其是在Web服务开发领域,WSDL(Web Service Description Language)是一种XML格式的规范,用于定义网络服务的接口。Java作为一种广泛使用的编程语言,提供了处理WSDL文档的能力,帮助开发者获取服务中...