uCosminexus Application Server, Web Service Development Guide

[Contents][Glossary][Index][Back][Next]

28.3.1 WSDL coding when attachments are used (wsi:swaRef format)

To handle attachments in WSDL, code using the wsi:swaRef type. The wsi:swaRef type is defined in the WS-I Attachments Profile - Version 1.0 as the type for handling attachments in WSDL

The following is an example of WSDL coded with the wsi:swaRef type on the basis of the type defined in WS-I Attachments Profile - Version 1.0:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://localhost" 
 xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd" ...>
 <wsdl:types>
 <schema elementFormDefault="qualified" targetNamespace="http://localhost" 
 xmlns="http://www.w3.org/2001/XMLSchema">
 <import namespace="http://ws-i.org/profiles/basic/1.1/xsd"/>
 <element name="getUserData">
 <complexType>
 <sequence>
 <element name="in0" type="xsd:string"/>
 <element name="in1" type="wsi:swaRef"/>
 </sequence>
 </complexType>
 </element>
 ...
 </schema>
 </wsdl:types>
 <wsdl:message name="getUserDataRequest">
 <wsdl:part element="intf:getUserData" name="parameters"/>
 </wsdl:message>
 ...
 <wsdl:portType name="UserInfo">
 <wsdl:operation name="getUserData">
 <wsdl:input message="intf:getUserDataRequest" name="getUserDataRequest"/>
 ...
 </wsdl:operation>
 </wsdl:portType>
 ...
</wsdl:definitions>

In this example, the wsi:swaRef type, indicating an attachment, is specified in the getUserData method argument (type of the element element in the schema definition).

Precautions for handling attachments in WSDL
  • The swaRef type can be specified in the schema element type (type attribute of the element element). If the swaRef type is specified in the attribute type (type attribute of the attribute element), the operations might not function properly.
  • In the XML Schema that specifies the swaRef type, you must import the name space http://ws-i.org/profiles/basic/1.1/xsd as shown in the WSDL example. If the name space is not imported, a Cosminexus XML Processor error is output.
    The following table describes the types and usability of the schemaLocation attribute of the xsd:import element that imports the namespace :

    Table 28-3 Type and usability of the schemaLocation attribute of the xsd:import element (when swaRef type is used)

    No. schemaLocation attributes Usability
    1 Not specified Can be used. #1
    2 http://wsi.org/profiles/basic/1.1/swaref.xsd Can be used. #1
    3 Other than No.1 and No.2 Cannot be used. #2

    #1
    The cjwsimport command references the schema of the name space http://ws-i.org/profiles/basic/1.1/xsd stored in the Cosminexus JAX-WS functionality.

    #2
    The cjwsimport command references the schema present in the location specified in the schemaLocation attribute. However, because the command references a schema for which contents cannot be guaranteed with the Cosminexus JAX-WS functionality, this is not supported.

  • Attachments cannot be used in the user-defined exceptions, so the swaRef type cannot be specified in the schema element type (type attribute of the element element) referenced from the wsdl:fault element. If the swaRef type is specified in the schema element type referenced from the wsdl:fault element, the operations might not function properly.