uCosminexus Application Server, Web Service Development Guide

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

32.2.1 Web Services machine

To use Streaming in the Web Service, annotate the com.sun.xml.ws.developer.StreamingAttachment annotation in the Web Service Implementation Class. For the com.sun.xml.ws.developer.StreamingAttachment annotation, see 16.2.2 com.sun.xml.ws.developer.StreamingAttachment annotation.

The following is an example of the Web Service Implementation Class that uses Streaming. In this example, "C:/TMP" directory is specified as the output destination of the temporary file created by Streaming. Perform detailed parsing of SOAP messages containing attachments and output MIME bodies of 50,000 bytes or more as temporary files.

package com.sample;
 
......
 
@MTOM
@StreamingAttachment(dir="C:/TMP", parseEagerly=true, memoryThreshold=50000L)
@BindingType(...)
public class UserInfoImpl implements UserInfo {
 
    public DataHandler getUserInfo(DataHandler dataHandler)
        throws UserDefinedException {
        if (dataHandler instanceof StreamingDataHandler) {
            StreamingDataHandler sdh = null;
            try {
                sdh = (StreamingDataHandler)dataHandler;
                ......
            } finally {
                try {
                    if (sdh != null) {
                        sdh.close();
                    }
                } catch(Exception ex) {
                    ......
                }
            }
        }
        ......    }
}

If you are using Streaming in a Web Service side, and you receive a request message that satisfies all the following conditions, data of the response message will be in Base64 format.