i m using mtom feature in jaxws web service to send image from server to client and i m getting the following error pls i apreciate any help.
error is Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: com/sun/x
ml/stream/buffer/XMLStreamBuffer
at com.sun.xml.ws.api.addressing.AddressingVersion.<init>(AddressingVers
ion.java:436)
at com.sun.xml.ws.api.addressing.AddressingVersion.<init>(AddressingVers
ion.java:67)
at com.sun.xml.ws.api.addressing.AddressingVersion$1.<init>(AddressingVe
rsion.java:146)
code is
package services;
import java.awt.Image;
import java.net.URL;
import javax.annotation.Resource;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.xml.ws.BindingType;
import javax.xml.bind.annotation.XmlMimeType;
import javax.xml.ws.WebServiceException;
import java.awt.*;
import javax.swing.*;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.soap.MTOM;
@WebService(serviceName="ImageService", portName="ImagePort", name="Image" ,wsdlLocation="ImageService.wsdl")
@BindingType(value=javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING)
public class ImageService { @Resource private WebServiceContext wsContext;
@WebMethod public java.awt.Image getJavaImage()
{wsContext.getMessageContext().put(com.sun.xml.ws.developer.JAXWSProperties.MTOM_THRESHOLOD_VALUE,0);
String path = "C:\\pictures\\07062010028.jpg";
Image img = Toolkit.getDefaultToolkit().getImage(path);
return img;
}
}
import services.Image;
import services.ImageService;
import java.awt.Dimension;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.SwingUtilities;
import javax.xml.ws.soap.MTOMFeature;
import java.util.Map;
import javax.activation.DataHandler;
import javax.xml.ws.BindingProvider;
import java.io.InputStream;
import javax.xml.ws.*;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.soap.MTOM;
import javax.annotation.Resource;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.xml.ws.BindingType;
import javax.xml.bind.annotation.XmlMimeType;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.soap.SOAPBinding;
import javax.xml.bind.JAXBContext;
import javax.xml.ws.Service;
import javax.xml.ws.BindingProvider;
import java.io.*;
import java.net.*;
import java.util.*;
import java.awt.Image.*;
import javax.xml.soap.*;
import javax.activation.DataHandler;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.ws.Holder;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.soap.SOAPBinding;
import javax.xml.ws.WebServiceRef;
import javax.swing.*;
import java.lang.*;
public class ImageFrame {
public ImageFrame()
{
}
public static void main(String args[])
{
java.awt.EventQueue.invokeLater(new Runnable()
{
public void run()
{
try
{ // Call Web Service Operation
JButton jButton1 = new JButton();
jButton1.setText("Java Button");
ImageService service = new ImageService();
Image port = service.getImagePort(new MTOMFeature());
SOAPBinding binding = (SOAPBinding) ((BindingProvider)port).getBinding();
binding.setMTOMEnabled(true);
java.awt.Image result = port.getJavaImage();
JFrame f=new JFrame();
System.out.println();
jButton1.setIcon(new ImageIcon(result));
f.add(jButton1);
f.setVisible(true);
} catch (Exception ex)
{
ex.printStackTrace();
}
}
});
}
}