Java WS : Where is the XSD part?

I started learning Java Web Services following the book "Java Web Services : Up and Running". In some sections of the book, the author talks about some `xsd` parts. The problem is that when I try the code and when I generate the `WSDL`, I don't get those parts. Here is an example of a WS implementation : import java.awt.Image; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.FileInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import javax.imageio.ImageIO; import javax.imageio.ImageReader; import javax.imageio.stream.ImageInputStream; import javax.jws.WebMethod; import javax.jws.WebService; @WebService(serviceName = "SkiImageService") // @HandlerChain(file = "../handlers/handler-chain.xml") public class SkiImageService { private static final String[] names = {"nordic.jpg", "tele.jpg", "alpine.jpg"}; private String default_key; private Map photos; public SkiImageService() { photos = new HashMap(); photos.put("nordic", "nordic.jpg"); photos.put("alpine", "alpine.jpg"); photos.put("telemk", "telemk.jpg"); default_key = "nordic"; } // Create a named image from the raw bytes. private Image createImage(String name) { byte[] bytes = getRawBytes(name); ByteArrayInputStream in = new ByteArrayInputStream(bytes); Iterator iterators = ImageIO.getImageReadersByFormatName("jpeg"); ImageReader iterator = (ImageReader) iterators.next(); try { ImageInputStream iis = ImageIO.createImageInputStream(in); iterator.setInput(iis, true); return iterator.read(0); } catch (IOException e) { System.err.println(e); return null; } } // Create a list of all available images. private List createImageList() { List list = new ArrayList(); Set key_set = photos.keySet(); for (String key : key_set) { Image image = createImage(key); if (image != null) { list.add(image); } } return list; } // Returns one image given the image's name. @WebMethod public Image getImage(String name) { return createImage(name); } // Returns a list of all available images. @WebMethod public List getImages() { return createImageList(); } // Read the bytes from the file for one image. @SuppressWarnings("unused") private byte[] getRawBytes(String name) { ByteArrayOutputStream out = new ByteArrayOutputStream(); try { String cwd = System.getProperty("user.dir"); String sep = System.getProperty("file.separator"); String base_name = cwd + sep + "jpegs" + sep; String file_name = base_name + name + ".jpg"; FileInputStream in = new FileInputStream(file_name); // Send default image if there's none with this name. if (in == null) { in = new FileInputStream(base_name + "nordic.jpg"); } byte[] buffer = new byte[2048]; int n = 0; while ((n = in.read(buffer)) != -1) { out.write(buffer, 0, n); // append to ByteArrayOutputStream } in.close(); } catch (IOException e) { System.err.println(e); } return out.toByteArray(); } } When I look to my WSDL, I don't find the following : Where can I find the XSD file/part ? Regards, Mick.

以上就是Java WS : Where is the XSD part?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏