Java Reference
In-Depth Information
Note that this example shows how you would convert a BLOB to a returnable byte array for
the service operation, as that's the more real-world use case.
The WSDL generated by these JAX-WS annotations will generate the basic XML schema
xs:base64 type for the byte array returned. The important consideration here is that handling
binary data will probably require a conversation with clients out of band so that they know
what to expect. If, as in this example, you request image data based on an identifier, how does
the client know what image codec to expect? Is this a GIF, a JPG, or a PNG? If it is a bitmap
or a TIFF, as many credit card readers produce, that file format is not natively supported with-
in Java SE, and the client must have the Advanced Imaging API on its classpath.
NOTE
Use care when packaging binary data in SOAP messages, or clients may not know what to expect.
You can advertise in comments the type or codec of your binary data, or you could advertise it in
making specific method names. A method to retrieve mugshots could be more appropriately named
getMugshotTiff() or getMugshotJpg() , for instance.
See Also
Optimizing Transmission of Binary Content on the Server .
Search WWH ::




Custom Search