|
Key
This line was removed.
This word was removed. This word was added.
This line was added.
|
Changes (5)
View Page Historyh2. Introduction
This document is a complement to Petals SE-JSR181 component documentation. It assumes that you already know how to generate a JSR181 SU using PetalsStudio : most code examples detailed here are embedded in the JSR181 SU main class, pointed as <jsr181:class> in the jbi.xml of the SU.
h2. Implementing a web method that deals with complex types and attachments
This example is an upload method : it receives path + file name information (where to store the file) as a parameter, and a file to upload (as a binary attachment).
Note that the example contains a bug workaround (as of Petals 4 early releases) : the 1st attachment, if any, is ignored as it contains... a copy of the payload + soap envelope (sic). This may be fixed in your Petals release (and this hack should disappear from this doc as soon as the fix is spread enough).
h3. Upload method in SU main class (JAX-WS annotated)
int n = 0;
for(DataHandler att : atts) {
for(DataHandler att : atts) {
if(n == 1) { // Ignore 1st attachment (bug workaround... may be useless with latest release ?)
FileOutputStream out = new FileOutputStream(dest.getPath() + File.separator + dest.getName());
InputStream in = att.getInputStream();
InputStream in = att.getInputStream();
h3. Class for complex type parameter
This class is a simple JavaBean (POJO with getter/setter methods for each field : here, fields are "path" and "name", as the class represents an "upload destination" = a file).