uCosminexus Application Server, Web Service Development Guide
This subsection describes the support range of the xsd:schema element.
When xsd:base64Binary is specified in the type attribute of the xsd:element element, which is a WSDL schema declaration, you can explicitly specify the MIME type by using the xmime:expectedContentTypes attribute to associate the Base64 format data with a Java type corresponding to the MIME type. The following table describes whether you can code the xmime:expectedContentTypes attribute for the xsd:element element, which is a WSDL schema declaration.
Table 20-1 Codability of the xmime:expectedContentTypes attribute
| No. | Parameters of wsdl:message that reference the xsd:element element | Codability of the xmime:expectedContentTypes attribute for the xsd:element element |
|---|---|---|
| 1 | wsdl:input | Y#1 |
| 2 | wsdl:output | Y#1 |
| 3 | wsdl:fault | N#2 |
To map WSDL to the Java type when the xmime:expectedContentTypes attribute is specified in the xsd:element element, map the xsd:base64Binary type with the xmime:expectedContentTypes attribute of the WSDL to the Java type. The following figure shows an example of mapping the WSDL to a Java type.
Figure 20-1 Example of mapping the WSDL to a Java type
Do not code parameters other than the charset parameter of text/xml and application/xml in the MIME type to be specified in the xmime:expectedContentTypes attribute. If a parameter other than the charset parameter of text/xml and application/xml are coded, the operations are not guaranteed.
The Java type to be mapped from WSDL changes depending on the MIME type specified in the xmime:expectedContentTypes attribute. The following table describes the relationship between the MIME types coded in the xmime:expectedContentTypes attribute and the associated Java types.
Table 20-2 Value of the xmime:expectedContentTypes attribute and the associated Java types
| No. | Value of the xmime:expectedContentTypes attribute (MIME type) | Associated Java type |
|---|---|---|
| 1 | application/xml | javax.xml.transform.Source |
| 2 | image/png#1 | java.awt.Image#2 |
| 3 | image/jpeg#1 | |
| 4 | Code the above MIME types delimited with commas (Example: image/png, image/jpeg)#3 | |
| 5 | image/*#3 | |
| 6 | text/plain | java.lang.String |
| 7 | text/*#4 | javax.activation.DataHandler |
| 8 | text/xml#5 | javax.xml.transform.Source |
| 9 | Other than above mentioned #4, #6 | javax.activation.DataHandler |
The MIME type specified in the xmime:expectedContentTypes attribute is mapped to the value of the javax.xml.bind.annotation.XmlMimeType annotation that is annotated in the JavaBean class corresponding to the element coding the xmime:expectedContentTypes attribute, from among the JavaBean classes that are automatically generated by the cjwsimport command. The following figure shows an example of mapping the automatically generated JavaBean class from the WSDL.
Figure 20-2 Mapping the automatically generated JavaBean class from the WSDL
To map the WSDL to a Java type, you use the attribute xmime:expectedContentTypes existing in the Namespace xmime, but the Namespace xmime need not be imported using the xsd:import element with the JAX-WS.
When you use the WSDL created with the cjwsgen command, you must import the Namespace xmime as and when required. The following is an example of importing the Namespace xmime:
<wsdl:definitions targetNamespace="http://localhost" xmlns:intf="http://localhost" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" ......> <wsdl:types> <xsd:schema targetNamespace="http://localhost"> <xsd:import namespace="http://www.w3.org/2005/05/xmlmime"/> <xsd:element name="setPhotoData" type="intf:setPhotoData"/> <xsd:complexType name="setPhotoData"> <xsd:sequence> <xsd:element name="in0" type="xsd:base64Binary" xmime:expectedContentTypes="image/jpeg"/> </xsd:sequence> </xsd:complexType> ...... </xsd:schema> </wsdl:types> ...... |
All Rights Reserved. Copyright (C) 2013, Hitachi, Ltd.