bea.com | products | dev2dev | support | askBEA
 Download Docs   Site Map   Glossary 
Search

Programming WebLogic Web Services

 Previous Next Contents View as PDF  

WebLogic Web Service Deployment Descriptor Elements

The web-services.xml deployment descriptor file contains information that describes one or more WebLogic Web Services. This information includes details about the backend components that implement the operations of a Web Service, the non-built-in data types used as parameters and return values, the SOAP message handlers that intercept SOAP messages, and so on. As is true for all deployment descriptors, web-services.xml is an XML file.

The following sections describe the web-services.xml file using different formats:

 


Graphical Representation

The following graphic describes the web-services.xml element hierarchy.


 


 

 


Element Reference

The following sectins, arranged alphabetically, describe each element in the web-services.xml file.

See Sample web-services.xml Files for sample Web Services deployment descriptor files for a variety of different types of WebLogic Web Services.

components

Defines the backend components that implement the Web Service.

A WebLogic Web Service can be implemented using one or more of the following components:

This element has no attributes.

ejb-link

Identifies which EJB in an EJB JAR file is used to implement the stateless session EJB backend component.

Attribute

Description

Datatype

Required?

path

Name of the EJB in the form of:

jar-name#ejb-name

jar-name refers to the name of the JAR file, contained within the Web Service EAR file, that contains the stateless session EJB. The name should include pathnames relative to the top level of the EAR file.

ejb-name refers to the name of the stateless session EJB, corresponding to the <ejb-name> element in the ejb-jar.xml deployment descriptor file in the EJB JAR file.

Example: myapp.jar#StockQuoteBean

String

Yes

encryptionKey

Specifies the name and password of a key and certificate pair used when encrypting elements of the SOAP message. Specify the name using the <name> subelement; specify the password with the <password> subelement.

Note: Create the key and certificate pair in the WebLogic Server keystore with the Administration Console. For details, see Storing Private Keys, Digital Certificates, and Trusted CAs.

This element does not have any attributes.

fault

Specifies the SOAP fault that should be thrown if there is an error invoking this operation.

This element is not required.

Attribute

Description

Datatype

Required?

name

Name of the fault.

String

Yes

class-name

Fully qualified Java class that implements the SOAP fault.

String

Yes

handler

Describes a SOAP message handler in a handler chain. A single handler chain can consist of one or more handlers.

If the Java class that implements the handler expects initialization parameters, specify them using the optional <init-params> child element of the <handler> element.

Attribute

Description

Datatype

Required?

class-name

Fully qualified Java class that implements the SOAP message handler.

String

Yes

handler-chain

Lists the SOAP message handlers that make up a particular handler chain. A single WebLogic Web Service can define zero or more handler chains.

The order in which the handlers (defined by the <handler> child element) are listed is important. By default, the handleRequest() methods of the handlers execute in the order that they are listed as child elements of the <handler-chain> element. The handleResponse() methods of the handlers execute in the reverse order that they are listed.

Attribute

Description

Datatype

Required?

name

Name of this handler chain.

String

Yes

handler-chains

Contains a list of <handler-chain> elements that describe the SOAP message handler chains used in the Web Service described by this web-services.xml file. A single WebLogic Web Service can define zero or more handler chains.

This element does not have any attributes.

init-param

Specifies a name-value pair that represents one of the initialization parameters of a handler.

Attribute

Description

Datatype

Required?

name

Name of the parameter.

String

Yes

value

Value of the parameter.

String

Yes

init-params

Contains the list of initialization parameters that are passed to the Java class that implements a handler.

This element does not have any attributes.

java-class

Describes the Java class component that implements one or more operations of a Web Service.

Attribute

Description

Datatype

Required

name

Name of this component.

String

Yes

class-name

Fully qualified name of the Java class that implements this component.

String

Yes

jms-receive-queue

Specifies that one of the operations in the Web Service is mapped to a JMS queue. Use this element to describe a Web Service operation that receives data from a JMS queue.

Typically, a message producer puts a message on the specified JMS queue, and a client invoking this Web Service operation polls and receives the message.

Attribute

Description

Datatype

Required?

name

Name of this component.

String

Yes

connection-factory

JNDI name of the JMS Connection factory that WebLogic Server uses to create a JMS Connection object.

String

Yes

provider-url

URL used to connect to a non-WebLogic Server JMS implementation.

String

No

initial-context-factory

Context factory for a non-WebLogic Server JMS implementation.

String

No

jms-receive-topic

Specifies that one of the operations in the Web Service is mapped to a JMS topic. Use this element to describe a Web Service operation that receives data from a JMS topic.

Typically, a message producer puts a message on the specified JMS topic, and a client invoking this Web Service component polls and receives the message.

Attribute

Description

Datatype

Required?

name

Name of this component.

String

Yes

connection-factory

JNDI name of the JMS Connection factory that WebLogic Server uses to create a JMS Connection object.

String

Yes

provider-url

URL used to connect to a non-WebLogic Server JMS implementation.

String

No

initial-context-factory

Context factory for a non-WebLogic Server JMS implementation.

String

No

jms-send-destination

Specifies that one of the operations in the Web Service is mapped to a JMS destination (either a queue or a topic). Use this element to describe a Web Service operation that sends data to a JMS destination.

Typically, a message consumer (such as a message-driven bean) consumes the message after it is sent to the JMS destination.

Attribute

Description

Datatype

Required?

name

Name of this component.

String

Yes

connection-factory

JNDI name of the JMS Connection factory that WebLogic Server uses to create a JMS Connection object.

String

Yes

provider-url

URL used to connect to a non-WebLogic Server JMS implementation.

String

No

initial-context-factory

Context factory for a non-WebLogic Server JMS implementation.

String

No

jndi-name

Specifies a reference to an object bound into a JNDI tree. The reference can be to a stateless session EJB or to a JMS destination.

Attribute

Description

Datatype

Required?

path

Path name to the object from the JNDI context root.

String

Yes

name

Depending on the parent element, the <name> element specifies:

This element does not have any attributes.

operation

Configures a single operation of a Web Service. Depending on the value and combination of attributes for this element, you can configure the following types of operations:

Use the <params> child element to explicitly specify the parameters and return values of the operation.

Attribute

Description

Datatype

Required?

name

Name of the operation that will be used in the generated WSDL.

If you do not specify this attribute, the name of the operation defaults to either the name of the method or the name of the SOAP message handler chain.

String

No

component

Name of the component that implements this operation.

The value of this attribute corresponds to the name attribute of the appropriate <component> element.

String

No

method

Name of the method of the EJB or Java class that implements the operation if you specify with the component attribute that the operation is implemented with a stateless session EJB or Java class.

You can specify all the methods with the asterisk (*) character.

If your EJB or Java class does not overload the method, you need only specify the name of the method, such as:

method="sell"

If, however, the EJB or Java class overloads the method, then specify the full signature, such as:

method="sell(int)"

String

No

handler-chain

Name of the SOAP message handler chain that implements the operation.

The value of this attribute corresponds to the name attribute of the appropriate <handler-chain> element.

String

No

invocation-style

Specifies whether the operation both receives a SOAP request and sends a SOAP response, or whether the operation only receives a SOAP request but does not send back a SOAP response.

This attribute accepts only two values: request-response (default value) or one-way.

Note: If the backend component that implements this operation is a method of a stateless session EJB or Java class and you set this attribute to one-way, the method must return void

String

No

portTypeName

Port type in the WSDL file to which this operation belongs. You can include this operation in multiple port types by specifying a comma-separated list of port types. When the WSDL for this Web Service is generated, a separate <portType> element is created for each specified port type.

The default value is the value of the portType attribute of the <web-service> element.

String

No

operations

The <operations> element groups together the explicitly declared operations of this Web Service.

This element does not have any attributes.

param

The <param> element specifies a single parameter of an operation.

You must list the parameters in the same order in which they are defined in the method that implements the operation. The number of <param> elements must match the number of parameters of the method.

Attribute

Description

Datatype

Required?

name

Name of the input parameter that will be used in the generated WSDL.

If you do not specify this attribute, the parameter names are based on the data type of the parameter, such as intvalue1, intvalue2, traderesult, and so on.

String

No.

location

Part of the request SOAP message (either the header, the body, or the attachment) that contains the value of the input parameter.

Valid values for this attribute are Body, Header, or attachment. The default value is Body.

If you specify Body, the value of the parameter is extracted from the SOAP Body, according to regular SOAP rules for RPC operation invocation. If you specify Header, the value is extracted from a SOAP Header element whose name is the value of the type attribute.

If you specify attachment, the value of the parameter is extracted from the SOAP Attachment rather than the SOAP envelope. As specified by the JAX-RPC specification, only the following Java data types can be extracted from the SOAP Attachment:

  • java.awt.Image

  • java.lang.String

  • javax.mail.internet.MimeMultiport

  • javax.xml.transform.Source

  • javax.activation.DataHandler

String

No.

style

Style of the input parameter, either a standard input parameter, an out parameter used as a return value, or an in-out parameter for both inputting and outputting values.

Valid values for this attribute are in, out, and in-out.

If you specify a parameter as out or in-out, the Java class of the parameter in the backend component's method must implement the javax.xml.rpc.holders.Holder interface.

String

Yes.

type

XML Schema data type of the parameter.

NMTOKEN

Yes.

class-name

Java class name of the Java representation of the data type of the parameter.

If you do not specify this attribute, WebLogic Server introspects the backend component that implements the operation for the Java class of the parameter.

You are required to specify this attribute only if you want the mapping between the XML and Java representations of the parameter to be different than the default. For example, xsd:int maps to the Java primitive int type by default, so use this attribute to map it to java.lang.Integer instead.

NMTOKEN

Maybe. See the description of the attribute.


params

The <params> element groups together the explicitly declared parameters and return values of an operation.

You do not have to explicitly list the parameters or return values of an operation. If an <operation> element does not have a <params> child element, WebLogic Server introspects the backend component that implements the operation to determine its parameters and return values. When generating the WSDL file of the Web Service, WebLogic Server uses the names of the corresponding method's parameters and return value.

You explicitly list an operation's parameters and return values when you want:

Use the <param> child element to specify the parameters of the operation.

Use the <return-param> child element to specify the return value of the operation.

The <params> element does not have any attributes.

password

Depending on the parent element, the <password> element specifies:

This element does not have any attributes.

reliable-delivery

The <reliable-delivery> element specifies that the operation can be invoked asynchronously using reliable messaging. This means that the application that invokes the Web Service has a guaranteed that the SOAP message was delivered to the Web Service operation, or it receives an explicit exception saying that the delivery did not happen.

You can specify only one <reliable-delivery> element for a given operation.

Attribute

Description

Datatype

Required?

duplicate-elimination

Specifies whether the WebLogic Web Service should ignore duplicate invokes from the same client application.

If this attribute is set to True, the Web Service persists the message IDs from client applications that invoke the Web Service so that it can eliminate any duplicate invokes. If this values is set to False, the Web Service does not keep track of duplicate invokes, which means that if a client retries an invoke, both invokes could return values.

Valid values for this attribute are True and False. The default value is True.

Boolean

No.

persist-duration

The default minimum number of seconds that the Web Service should persist the history of a reliable SOAP message (received from the sender that invoked the Web Service) in its storage.

The Web Service, after recovering from a WebLogic Server crash, does not dispatch persisted messages that have expired.

The default value of this attribute is 60,000.

Integer

No.

return-param

The <return-param> element specifies the return value of the Web Service operation.

You can specify only one <return-param> element for a given operation.

Attribute

Description

Datatype

Required?

name

Name of the return parameter that will be used in the generated WSDL file.

If you do not specify this attribute, the return parameter is called result.

String

No.

location

Part of the response SOAP message (either the header or the body) that contains the value of the return parameter.

Valid values for this attribute are Body or Header. The default value is Body.

If you specify Body, the value of the return parameter will be added to the SOAP Body. If you specify Header, the value will added as a SOAP Header element whose name is the value of the type attribute.

String

No.

type

XML Schema data type of the return parameter.

NMTOKEN

Yes.

class-name

Java class name of the Java representation of the data type of the return parameter.

If you do not specify this attribute, WebLogic Server introspects the backend component that implements the operation for the Java class of the return parameter.

You are required to specify this attribute if:

  • The backend component that implements the operation is either <jms-receive-queue> or <jms-receive-topic>.

  • The mapping between the XML and Java representations of the return parameter is ambiguous, such as mapping xsd:int to either the int Java primitive type or java.lang.Integer.

NMTOKEN

Maybe. See the description of the attribute.

security

Element that contains all the security configuration information about a particular Web Service. This information includes:

Attribute

Description

Datatype

Required?

Name

The name of this security element.

String

Yes.

signatureKey

Specifies the name and password of a key and certificate pair used when digitally signing elements of the SOAP message. Specify the name using the <name> subelement; specify the password with the <password> subelement.

Note: Create the key and certificate pair in the WebLogic Server keystore with the Administration Console. For details, see Storing Private Keys, Digital Certificates, and Trusted CAs.

This element does not have any attributes.

spec:BinarySecurityTokenSpec

Specifies the (binary) non-XML-based security tokens included in the SOAP messages.

Note: You must include the following namespace declaration with this element:

xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext"

and the value of each attribute of this element should be qualified with the wsse namespace.

Attribute

Description

Datatype

Required?

ValueType

Specifies the value type and space of the encoded binary data.

Only one valid value: wsse:X509v3 (for X.509 certificates)

String

Yes

EncodingType

Specifies the encoding format of the binary data.

Only one valid value: wsse:Base64Binary

String

Yes

spec:ElementIdentifier

Identifies a particular element in the SOAP message (either the header or the body) that you want to digitally sign or encrypt. You uniquely identify an element in the SOAP message by its local name and its namespace.

Specify this element as the child of either <spec:SignatureSpec> or <spec:EncryptionSpec>.

Attribute

Description

Datatype

Required?

LocalPart

The local name of the element. Do not specify the namespace with this attribute.

String

Yes.

Namespace

The namespace in which the element is defined.

String

Yes.

Restriction

Specifies whether to restrict the identification of the element to the SOAP header or body.

Valid values are header or body. If this attribute is not specified, the entire SOAP message is searched when identifying the element.

Note: If you specify a value for this optional attribute, only the top-level elements in the relevant SOAP message part (header or body) are searched. If you do not specify this attribute, then all elements, no matter how deeply nested, are searched.

String

No.

spec:EncryptionSpec

Specifies the elements in the SOAP message that are encrypted and how they are encrypted.

You can specify that the entire SOAP body be encrypted by setting the attribute EncryptBody="True". You can also use the <spec:ElementIdentifier> child element to specify particular elements of the SOAP message that are to be encrypted.

Warning: Do not specify both EncryptBody="True" and one or more elements with the <spec:ElementIdentifier> child element, but rather, use just one way to specify the elements of the SOAP message that should be encrypted.

Use the EncryptionMethod attribute to specify how to encrypt the SOAP message elements.

Attribute

Description

Data type

Required?

EncryptionMethod

Specifies the algorithm used to encrypt the specified elements of the SOAP message.

Valid values are:

http://www.w3.org/2001/04/xmlenc#tripledes-cbc
http://www.w3.org/2001/04/xmlenc#kw-tripledes



EncryptBody

Specifies whether to encrypt the entire SOAP body.

Note: Do not specify both EncryptBody="True" and one or more elements with the <spec:ElementIdentifier> child element, but rather, use just one way to specify the elements of the SOAP message that should be encrypted.

Valid values are True and False.

String

Yes.

spec:SecuritySpec

Specifies the set of security-related information associated with this Web Service.

The information in this element can include:

The information in the <spec:SecuritySpec> element appears in the generated WSDL of the Web Service so that client applications that invoke the Web Service know how to create the SOAP request to comply with all the security specifications.

WebLogic Server also uses the information in this element to verify that a SOAP request to invoke a particular Web Service contains all the necessary security information in the header. For example, if the <spec:SecuritySpec> element requires that a portion of the SOAP message be digitally signed, then WebLogic Server knows to check for this when it receives the SOAP request. WebLogic Server then uses the same information to create the security information in the SOAP response message.

Note: You must include the following namespace declaration with this element:

xmlns:spec="http://www.openuri.org/2002/11/wsse/spec"

and all child elements of the <spec:SecuritySpec> element must be qualified with the spec namespace.

Attribute

Description

Datatype

Required?

Name

Name of this security specification.

String

Yes.

spec:SignatureSpec

Specifies the elements in the SOAP message that are digitally signed and how they are signed.

Digital signatures are a way to determine whether a message was altered in transit and to verify that a message was really sent by the possessor of a particular security token.

You can specify that the entire SOAP body be digitally signed by setting the attribute SignBody="True". Use the <spec:ElementIdentifier> child element to specify additional particular elements of the SOAP message that are to be signed.

Use the CanonicalizationMethod and SignatureMethod attributes to specify how to digitally sign the SOAP message elements.

Attribute

Description

Data type

Required?

CanonicalizationMethod

Specifies the algorithm used to canonicalize the SOAP message elements being signed.

Only one valid value:

http://www.w3.org/2001/10/xml-exc-cl4n#

String

Yes.

SignatureMethod

Specifies the cryptographic algorithm used to compute the signature.

Note: Be sure that you specify an algorithm that is compatible with the certificates you are using in your enterprise.

Valid values are:

http://www.w3.org/2000/09/xmldsig#rsa-sha1
http://www.w3.org/2000/09/xmldsig#dsa-sha1

String

Yes.

SignBody

Specifies whether to digitally sign the entire SOAP body, in addition to the any specific elements identified with the optional <spec:ElementIdentifier> child elements.

Valid values are True and False.

String

Yes.

spec:UsernameTokenSpec

Specifies that the SOAP messages used to invoke and respond to this Web Service must include a username and password.

WebLogic Server validates the username and password in a client's SOAP request message against the server's authentication provider.

Note: Define users for WebLogic Server with the Administration Console. For details, see Defining Users.

WebLogic Server uses the information in the <user> child element of the <security> element when creating the security information in a SOAP response message.

Note: You must include the following namespace declaration with this element:

xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext"

and the value of each attribute of this element should be qualified with the wsse namespace.

Attribute

Description

Datatype

Required?

PasswordType

Specifies how to include the password in the SOAP message.

Only valid value is wsse:PasswordText (actual password for the username.)

String

Yes.

stateless-ejb

Describes the stateless session EJB component that implements one or more operations of a Web Service.

Attribute

Description

Datatype

Required?

name

Name of the stateless EJB component.

Note: The name is internal to the web-services.xml file; it does not refer to the name of the EJB in the ejb-jar.xml file.

String

Yes.

type-mapping

The <type-mapping> element contains the list of mappings between the XML data types defined in the <types> element and their Java representations.

For each data type in the <types> element, there is a corresponding <type-mapping-entry> element that lists the Java class that implements the data type, how to serialize and deserialize the data, and so on.

This element has no attributes.

type-mapping-entry

Describes the mapping between a single XML data type in the <types> element and its Java representation.

Attribute

Description

Datatype

Required?

class-name

Fully qualified name of the Java class that maps to its corresponding XML data type.

String

Yes.

element

Name of the XML data type that maps to the Java data type. Specify only if the XML Schema definition of the data type uses the <element> element.

NMTOKEN

One, but not both, of either element or type is required.

type

Name of the XML data type that maps to the Java data type. Specify only if the XML Schema definition of the data type uses the <type> element.

NMTOKEN

One, but not both, of either element or type is required.

serializer

Fully qualified name of the Java class that converts the data from Java to XML.

String

Only required if the data type is not one of the built-in data dates supported by the WebLogic Web Services runtime, listed in Using Built-In Data Types.

deserializer

Fully qualified name of the Java class that converts the data from XML to Java.

String

Only required if the data type is not one of the built-in data dates supported by the WebLogic Web Services runtime, listed in Using Built-In Data Types.

types

Describes, using XML Schema notation, the non-built-in data types used as parameters or return types of the Web Service operations.

For details on using XML Schema to describe the XML representation of a non-built-in data type, see http://www.w3.org/TR/xmlschema-0/.

The following example shows an XML Schema declaration of a data type called TradeResult that contains two elements: stockSymbol, a string data type, and numberTraded, an integer.

<types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:stns="java:examples.webservices"
attributeFormDefault="qualified"
elementFormDefault="qualified"
targetNamespace="java:examples.webservices">
<xsd:complexType name="TradeResult">
<xsd:sequence>
<xsd:element maxOccurs="1"
name="stockSymbol"
type="xsd:string" minOccurs="1">
</xsd:element>
<xsd:element maxOccurs="1"
name="numberTraded"
type="xsd:int"
minOccurs="1">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</types>

user

Specifies the username and password to be used in the SOAP response message.

This element has two child elements:

This element has no attributes.

web-service

Defines a single Web Service.

The Web Service is defined by the following:

Attribute

Description

Datatype

Required?

name

Name of the Web Service.

String

Yes.

targetNamespace

Namespace of this Web Service.

String

Yes.

uri

URI of the Web Service, used subsequently in the URL that invokes the Web Service.

Note: Be sure to specify the leading "/", such as /TraderService.

String

Yes.

protocol

Protocol over which the service is invoked.

Valid values are http or https. Default is http.

String

No.

style

Specifies whether the Web Service has RPC-oriented or document-oriented operations.

RPC-oriented WebLogic Web Service operations use SOAP encoding. Document-oriented WebLogic Web Service operations use literal encoding.

Valid values are rpc and document. Default value is rpc.

Warning: If you specify document for this attribute, all the methods that implement the operations of the Web Service must have only one parameter.

Note: Because the style attribute applies to an entire Web Service, all operations specified in a single <web-service> element must be either RPC-oriented or documented-oriented; WebLogic Server does not support mixing the two styles within the same Web Service.

String

No.

jmsUri

Specifies that client applications can use the JMS transport to invoke the Web Service, in addition to the default HTTP/S transport. The form of this attribute is:

connection_factory_name/queue_name

where connection_factory_name is the JNDI name of the JMS connection factory and queue_name is the JNDI name of the JMS queue that you have configured for the JMS transport. For example:

jmsURI="JMSTransFactory/JMSTransQueue"

If this attribute is set, the generated WSDL of the Web Service contains an additional port that uses a JMS binding. The clientgen Ant task, when generating the stubs used to invoke this Web Service, generates a getServicePortJMS() method, in addition to the default getServicePort() method, used for JMS and HTTP/S respectively.

Note: If you specify the jmsUri attribute and plan to always use the JMS transport in your client applications when invoking the Web Service, every operation of the Web Service must be one-way. This means that every <operation> child element of this <web-service> must specify the invocation-style="one-way" attribute.

String.

No.

portName

Name of the <port> child element of the <service> element of the dynamically generated WSDL of this Web Service.

The default value is the name attribute of this element with Port appended. For example, if the name of this Web Service is TraderService, the port name will be TraderServicePort.

String

No

portTypeName

Name of the default <portType> element in the dynamically generated WSDL of this Web Service.

The default value is the name attribute of this element with Port appended. For example, if the name of this Web Service is TraderService, the portType name will be TraderServicePort.

String

No.

useSoap12

Specifies whether to use SOAP 1.2 as the message format protocol. By default, WebLogic Web Services use SOAP 1.1.

If you specify useSoap12="True", the generated WSDL of the deployed WebLogic Web Service includes two ports: the standard port that specifies a binding for SOAP 1.1 as the message format protocol, and a second port that uses SOAP 1.2. Client applications, when invoking the Web Service, can use the second port if they want to use SOAP 1.2 as their message format protocol.

Valid values for this attribute are True and False. The default value is False.

Boolean

No.

web-services

The root element of the web-services.xml deployment descriptor.

This element does not have any attributes.

 

Back to Top Previous Next