source2wsdd

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. Web-services.xml file can be generated from a source file using source2wsdd ant task. The source file can also be marked up with special javadoc tags. Soruce2wsdd use these tags to make appropriate changes to the generated web-service.xml deployment descriptor.

The following sections describe the different javadoc tags that can be used along with source2wsdd ant task:


Tag Reference

@wlws:webservice

wlws:webservice tag is specified on a class javadoc. Attributes specified in this tag will be used to populate web-service element tag in the web-services.xml deployment descriptor. An example is shown below:

 

/** 
 * MegaService - a service to show different features of 
 * Weblogic webservice stack.
 * 
 * @wlws:webservice targetNamespace="http://www.bea.com/mega-service/"
 *    name="MegaWebService"
 *    portName="MegaPort"
 *    portTypeName="MegaPort"
*/
public class MegaService{
  ...
}
 

Following attributes can be specified on a web-service javadoc tag:

Attribute

Description

Name

Name of the Web service.

targetNamespace

Namespace of this Web service.

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.

protocol

Protocol over which the service is invoked.

Valid values are http or https. Default is http.

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.

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.

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.

@wlws:operation

wlws:operation tag is specified on a method javadoc. Attributes specified in this tag will be used to populate operation element tag in the web-services.xml deployment descriptor. An example is shown below:

 
 
  /** 
   * A one way call. Client will not wait for this method to
   * complete.
   *
   * Note: A one way call must have a void return type.
   *
   * @wlws:operation 
   *       invocation-style="one-way"
   */
  public void oneWayCall( long time ){
    .....
  }
 
 

Attribute

Description

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.

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.

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

@wlws:part <name>

wlws:part <name> tag is specified on a method javadoc. Attributes specified in this tag will be used to populate the param element in the web-services.xml deployment descriptor. An example is shown below:

 

  /** 
   * operation with headers
   *
   * @wlws:part addressInHeader location="header" 
   * @wlws:part dataInHeader location="header" 
   *
   * @wlws:part return location="body" 
   */
  public BaseData methodWithHeaders( String addressInHeader, 
      int idInBody, BaseData dataInHeader ){
 
    dataInHeader.setAddress( addressInHeader );
    dataInHeader.setId( idInBody );
 
    return dataInHeader;
  }

 

Attribute

Description

name

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

 

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

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.

type

XML Schema data type of the parameter.

class-name

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