// 
//     Licensed to the Apache Software Foundation (ASF) under one
//     or more contributor license agreements.  See the NOTICE file
//     distributed with this work for additional information
//     regarding copyright ownership.  The ASF licenses this file
//     to you under the Apache License, Version 2.0 (the
//     "License"); you may not use this file except in compliance
//     with the License.  You may obtain a copy of the License at
// 
//       http://www.apache.org/licenses/LICENSE-2.0
// 
//     Unless required by applicable law or agreed to in writing,
//     software distributed under the License is distributed on an
//     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
//     KIND, either express or implied.  See the License for the
//     specific language governing permissions and limitations
//     under the License.
//

= Web Service Application Passing Binary Data, pt 1: Overview
:jbake-type: tutorial
:jbake-tags: tutorials 
:jbake-status: published
:icons: font
:syntax: true
:source-highlighter: pygments
:toc: left
:toc-title:
:description: Web Service Application Passing Binary Data, pt 1: Overview - Apache NetBeans
:keywords: Apache NetBeans, Tutorials, Web Service Application Passing Binary Data, pt 1: Overview

In this tutorial, you create a Java EE web application that contains a web service, which you implement as a stateless session bean. You also add a package with four JPEG files to the web application. The web service has two operations that are accessible by clients, for getting individual images and for getting a set of all 4 images as thumbnails. You add private methods that convert the JPEG files to byte arrays and convert those byte arrays to  ``Image``  objects. In Java EE you put these private methods directly in the web service, because the web service is also an EJB.

After you create the web service, you deploy it to an instance of the GlassFish server 3.1 or later. You use the NetBeans IDE's built-in web service tester to view sample SOAP request and response messages.

The default JAX-WS service infrastructure cannot inform clients that the binary data needs to be interpreted as JPEG files. Therefore, you generate a copy of the XML Schema and WSDL files and edit the XML schema to tell any client to expect the  ``image/jpeg``  content type for the return element. You also alter the service code to use the customized WSDL and Schema.

Finally, you create a Java client application that displays the images in an album created from Swing components.

You can download a complete version of service and client applications from the link:https://netbeans.org/projects/samples/downloads/directory/Samples%252FWeb%2520Services%252FWeb%2520Service%2520Passing%2520Binary%2520Data%2520--%2520EE6[+NetBeans Samples Catalog+].

*Lessons In This Tutorial*

image::images/netbeans-stamp-80-74-73.png[title="Content on this page applies to the NetBeans IDE 7.2, 7.3, 7.4 and 8.0"]

1. => Overview
2. link:./flower_ws.html[+ Creating the Web Service+]
3. link:./flower-code-ws.html[+ Coding and Testing the Web Service+]
4. link:./flower_wsdl_schema.html[+ Modifying the Schema and WSDL Files to Pass Binary Data+]
5. link:./flower_swing.html[+ Creating the Swing Client+]


== Software Needed for the Tutorial

*To follow this tutorial, you need the following software and resources.*

|===
|Software or Resource |Version Required 

|link:https://netbeans.org/downloads/index.html[+NetBeans IDE+] |Java EE download bundle 

|link:http://www.oracle.com/technetwork/java/javase/downloads/index.html[+Java Development Kit (JDK)+] |version 7 or 8 

|Java EE-compliant web or application server |link:http://glassfish.java.net/[+GlassFish Server Open Source Edition 3.1 or later+]
 

|Pictures used in this tutorial |link:images/rose.jpg[+rose.jpg+]
link:images/sunflower.jpg[+sunflower.jpg+]
link:images/aster.jpg[+aster.jpg+]
link:images/honeysuckle.jpg[+honeysuckle.jpg+] 
|===

*Note: *the GlassFish server can be installed with the Java EE download bundle of NetBeans IDE. Alternatively, you can visit the link:https://glassfish.java.net/download.html[+the GlassFish server downloads page+].

*Tip: *Optionally, for troubleshooting purposes, you can link:https://netbeans.org/files/documents/4/2343/SoapWithAttachments.zip[+download the completed sample+] and inspect the sources.

At the end of this tutorial, you will have a running Java Swing application that consumes JPEG images via a web service, with the result displayed below.

image::images/running-client.png[title="JFrame showing all flower images passed from web service"]


== Next step:

link:./flower_ws.html[+ Creating the Web Service+]

link:/about/contact_form.html?to=3&subject=Feedback:%20Flower%20Overview%20EE6[+Send Feedback on This Tutorial+]



== See Also

For background information prior to using this tutorial, see the following resources:

* link:./jax-ws.html[+Getting Started with JAX-WS Web Services+]
* link:../../docs/websvc/client.html[+Developing Web Service Clients+]
* link:../javaee/javaee-gettingstarted.html[+Getting Started with Java EE Applications+]
* link:./wsit.html[+Advanced Web Service Interoperability+]

To send comments and suggestions, get support, and keep informed about the latest developments on the NetBeans IDE Java EE development features, link:../../../community/lists/top.html[+join the nbj2ee@netbeans.org mailing list+].

