简体   繁体   English

Eclipse:Web服务:使用Tomcat7的404错误

[英]Eclipse: Web services: 404 error using Tomcat7

I'm using this link to create a web service using the buttom-up approach: http://dtechtalkcenter.blogspot.com/2012/10/creating-code-first-web-service-bottom.html . 我正在使用此链接使用自上而下的方法创建Web服务: http : //dtechtalkcenter.blogspot.com/2012/10/creating-code-first-web-service-bottom.html

However, I'm getting this error no matter what I do : 但是,无论我做什么,都会遇到此错误:

Etat HTTP 404 - /StandardWebService/services/ProductServiceImplPort Etat HTTP 404-/ StandardWebService / services / ProductServiceImplPort

type Rapport d''état 类型Rapport d''état

message /StandardWebService/services/ProductServiceImplPort 消息/ StandardWebService / services / ProductServiceImplPort

description La ressource demandée n''est pas disponible. 描述La资源需求不负责任。

Your help would be appreciated ;) 您的帮助将不胜感激;)

Ey! y! I have deployed the WebService finally!! 我终于部署了WebService!

The only change I've made in the classes provided by your link is adding targetNamespace in class ProductService. 我在您的链接提供的类中所做的唯一更改是在ProductService类中添加了targetNamespace。

  package es.rubioric.ws;

  import java.util.List;

  import javax.jws.WebParam;
  import javax.jws.WebService;

  @WebService(targetNamespace="http://ws.rubioric.es/")
  public interface ProductService {
       //Return List of product
       List<Product> getProducts();

       //add the product into the list
       void addProduct(@WebParam(name="product")Product product);
   }

EDT: Include Service Impl EDT:包括服务Impl

  package es.rubioric.ws;

  import java.util.ArrayList;
  import java.util.List;
  import javax.jws.WebService;

  @WebService(endpointInterface ="es.rubioric.ws.ProductService")
  public class ProductServiceImpl implements ProductService{

  @Override
  public List<Product> getProducts() {

       List<Product> product=new ArrayList<Product>();
       product.add(new Product("Windows","OS", "windows server", 300));
       product.add(new Product("Linux","OS", "Linux server", 100));
       product.add(new Product("Mac","OS", "Mac server", 500));
       return product;
  }

  @Override
  public void addProduct(Product product) {
        System.out.println(product);
  }
} 

It's seems very important the last slash ('/') in the targetNamespace included in this class. 此类中包含的targetNamespace中的最后一个斜杠('/')似乎非常重要。 I don't know how works the automatic generation mechanism used but it generates two namespaces: http://ws.rubioric.es/ and http://ws.rubioric.es 我不知道所使用的自动生成机制如何工作,但是它会生成两个名称空间: http : //ws.rubioric.es/http://ws.rubioric.es

Including the slash, these namespaces are different - which seems a good thing [sorry for my poor explanation, I don't know much about this kind of WebServices] and allow deployment. 包括斜杠在内,这些名称空间是不同的 -这似乎是一件好事[对不起我的解释,我对这种WebServices不太了解],并允许部署。

终于跑了!

I include this other image for explaining you what I mean with console 我提供了这张其他图片来解释您控制台的意思

Eclipse控制台

It's always red, don't mind the color, but there is where you're going to get a stacktrace pointing the problem. 它始终是红色,不介意颜色,但是在这里您将获得指向问题的堆栈跟踪。

Another tip: In Eclipse Mars, after this window 另一个提示:在该窗口之后的Eclipse Mars中

在此处输入图片说明

if your push next twice, appears a SOAP configuration window. 如果您下一次按下两次,将显示一个SOAP配置窗口。

肥皂

Uncheck the "Generate separate XSD ..." to avoid extra conflicting xsd file generation. 取消选中“生成单独的XSD ...”,以避免额外的冲突xsd文件生成。

Let me know if this works for you. 让我知道这是否适合您。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM