This presentation is a primer on WSDL. It s part of our series to help prepare you for creating BPEL projects. We recommend you review this before taking an ActiveVOS course or before you use ActiveVOS Designer. Before you view this presentation, you should complete the Schema Primer, available from Active Endpoints. Copyright 2004-2010 Active Endpoints, Inc. 1
In this presentation we will cover: WSDL basics The structure of a WSDL file The contents of a WSDL file And then we will finish with a brief review of the presentation material Copyright 2004-2010 Active Endpoints, Inc. 2
This primer is not intended to be a complete class on WSDL It is intended to be a quick review before taking an ActiveVOS training class or using the ActiveVOS Designer tool. As a prerequisite, we recommend you have at least this level of knowledge before taking a class from Active Endpoints. Before completing this primer, you can review the Schema Primer, which is also available from Active Endpoints. Copyright 2004-2010 Active Endpoints, Inc. 3
Web Services Description Language files are xml-based and describe how a web service works, how it can be accessed and how it can be invoked. The WSDL forms a complete contract for communication between our process and our partner services. Copyright 2004-2010 Active Endpoints, Inc. 4
WSDL uses the XML and Schema standards and typically uses the SOAP standard for communication. WSDL defines the Interface for a Web Service And BPEL fits on top of WSDL and extends its definitions and functionality. Copyright 2004-2010 Active Endpoints, Inc. 5
WSDL files must be both Well-Formed and Valid, and can contain some or all of the components that you see listed here Definitions, declarations and imports Types, Messages and PortTypes and Bindings and Services. Copyright 2004-2010 Active Endpoints, Inc. 6
If a WSDL file is being used by a BPEL process, it has all of the standard WSDL contents, and can also contain EXTENSIONS that support the BPEL language. BPEL Extensions are covered in the Active Endpoints Training classes. Copyright 2004-2010 Active Endpoints, Inc. 7
After the definitions section, a WSDL file can be conceptually divided into two sections, the Abstract and the Concrete: The Abstract Definitions section has the data, messaging and interface type definitions, which includes the Standard Schema Types and any others that are imported from your other Schemas. These Data Types are used to form Messages, which are the communication structures that move data back and forth, to and from Operations. Next are the PortType definitions, including the Operations that define the port s functionality and its input, output and fault messages. These abstractions, taken together, define the Web Service's design. The Concrete Implementations section includes the Bindings and Services. A PortType s access and usage details are defined in a Binding. This includes the transport mechanism and the payload format. The Bindings are combined with one or more Endpoint References i.e., URLs - to form a Service. These concretes, taken together, define the way to access the Web Service at runtime. In addition, there are BPEL Extensions to a WSDL file Including Properties and Property Aliases, which are both optional And Partner Link Types, which are required. These are all covered in the ActiveVOS Fundamentals class. To summarize, BPEL is concerned with Abstract definitions during design and with the Concrete implementations at the time of execution. Copyright 2004-2010 Active Endpoints, Inc. 8
Now that we have talked about the basics, lets look at a WSDL document in detail This is the optional XML declaration section. It has the WSDL language version ( 1.0 ) and the character set ( UTF-8 ) used by the file. Copyright 2004-2010 Active Endpoints, Inc. 9
This attribute designates the name of the WSDL definition: Customer. This Name attribute is optional. Copyright 2004-2010 Active Endpoints, Inc. 10
This section defines the WSDL s namespaces, which come from XML technology. In this declarations section there are actually four namespaces defined. Look closely and you'll see that the targetnamespace and the tns namespace are actually the same. Namespaces are a way of defining variables and types within a partition, so that if more than one variable or element uses the same name they will not conflict. You will notice that many namespaces are URLs. Because URLs must be unique - like namespaces - they can be a convenient choice to define a namespace. Note, however, that a namespace does not have to be a URL. Copyright 2004-2010 Active Endpoints, Inc. 11
Some of the namespaces declared here have prefixes, which can be used to point to their namespaces. For example, the prefix cust represents the namespace http://schemas.activeendpoints.com/sample/customer/2006/04/customer.xsd. As you can see in this example, namespaces can be very long and awkward to use, and a prefix solves this problem. A prefix is just a shorthand way of referring to the namespace. Copyright 2004-2010 Active Endpoints, Inc. 12
In this example, there are two Types defined for handling travel information. Note that both types are named Reservation. But, also notice that they are in two different namespaces and they contain different structures and different data. So, how do we know which one is being used? Because each namespace has a different prefix. We use the prefix to make explicit which of the two definitions are being used. Copyright 2004-2010 Active Endpoints, Inc. 13
Existing Types can be defined in a separate schema file and imported, or new Types can be declared right in the WSDL file. Go to the ActiveVOS Schema Primer for more information on schemas and type definitions. Copyright 2004-2010 Active Endpoints, Inc. 14
Import is used to bring in a schema or WSDL you want to use from a file that is in a different namespace. Here we are importing a schema file in the first example. The imported file s Types can then be used by the enclosing file. That s why the syntax looks the way it does, i.e., that the schema is being brought directly into the TYPES section of the enclosing WSDL file. Copyright 2004-2010 Active Endpoints, Inc. 15
You might also want to import another WSDL file into an existing WSDL file, as is shown in this example. When you do this, you are simply extending the enclosing WSDL file with the import s contents. Copyright 2004-2010 Active Endpoints, Inc. 16
Messages are the data that is sent to and from a Web Service. Messages must be declared and named in your WSDL before they can be used by an operation, which will be done later on in our file. Messages can have no parts, one part or they can have many parts. One way to use a Message that has no parts is where it is sent to kick off a BPEL process, for example. Copyright 2004-2010 Active Endpoints, Inc. 17
Once messages are declared, they can be used to communicate with an operation, as we see here. There are two messages defined: SendOrderConfirmationRequest and SendOrderConfirmationResponse. These two messages are then used as the input and output messages for an operation called SendOrderConfirmation. Note that synchronous i.e., two-way operations - can optionally have a fault message too, which would be declared right after the output message. Copyright 2004-2010 Active Endpoints, Inc. 18
We can define more than one operation in a single WSDL file. This is a second operation called AcceptPartialOrderShipment, and it has a single input message. This defines an asynchronous operation, which is the fire-and-forget model. Once we have defined one or more operations, they can then be used as part of a port type. Copyright 2004-2010 Active Endpoints, Inc. 19
Here is a porttype called CustomerPortType that uses the two operations we examined earlier, SendOrderConfirmation and AcceptPartialOrderShipment. Note that, as we saw, the operation s communication is defined by its messages input, output and fault. Now, those operations become part of the porttype s definition. It should be pointed out that the porttype is a purely abstract construct. It is sometimes referred to as an Interface because it tells us how to define a Web Service s API, and tells our process partners how to use it. Copyright 2004-2010 Active Endpoints, Inc. 20
Now that we have used schema-defined types in our messages, and our messages are being used by one or more operations, and our operations have been added to a porttype, we have to define how this porttype can be used. The Binding defines how the message is packaged (e.g., SOAP) and the protocol that will be used with it (e.g., HTTP). It says here is how the porttype s messages are formatted and here is the protocol you use to send and receive them. Copyright 2004-2010 Active Endpoints, Inc. 21
Now we ve defined how the porttype can be accessed through the binding. Next, we define and name our Service. Here the service is called CustomerService. The service associates the porttype and its binding(s) with one or more URLs where it can be accessed. Each of the locations where a service can be accessed is called an endpoint, which is stored in the location attribute. Copyright 2004-2010 Active Endpoints, Inc. 22
Now that we ve seen how WSDLs work, let s review our material. Messages are made up of simple or complex types, that are defined in schemas or in the WSDL itself. Copyright 2004-2010 Active Endpoints, Inc. 23
One or more messages are used to communicate with an Operation its input, output and optionally one or more faults. Copyright 2004-2010 Active Endpoints, Inc. 24
One or more operations are then used by a PortType. A porttype defines the interface to our service and contains the operations that our partners will call. When we put a porttype in our WSDL file, it tells our partners how they can interact with our Web Service. Copyright 2004-2010 Active Endpoints, Inc. 25
A binding specifies concrete message format and transmission protocol details for a porttype. EXAMPLE: For Binding #1 SOAP is the message format and HTTP is the transport protocol. Note: A single web service may have one or more bindings, which allows it to be accessed in more than one manner. Copyright 2004-2010 Active Endpoints, Inc. 26
Finally, a WSDL Service specifies a single interface that the service will support (i.e., a porttype and and its bindings) and a list of endpoint locations (i.e., URLs) where that service can be accessed. So Endpoint + Binding = Service Each endpoint must have a single porttype, but can have one or more bindings so you can access it using different protocols and formats. A single service can have more than one URL, meaning that it is available in more than one place. Copyright 2004-2010 Active Endpoints, Inc. 27
Once our service is deployed to the server, a partner service can invoke it at the URL specified. It must use the correct protocol (e.g., HTTP) to communicate with our service, and it must send and receive messages using the proper format (e.g., SOAP), to call the various operations that define our service s interface. Copyright 2004-2010 Active Endpoints, Inc. 28
Now that you have completed this Primer, check the Active Endpoints for other materials to help you create BPEL projects. As a reminder, Primers are available in PDF format from Active Endpoints. To find out more about WSDL or other BPEL-related topics, go to the Active Endpoints website at this address. Copyright 2004-2010 Active Endpoints, Inc. 29