Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
java web服务SOAP_Java_Eclipse_Web Services_Soap - Fatal编程技术网

java web服务SOAP

java web服务SOAP,java,eclipse,web-services,soap,Java,Eclipse,Web Services,Soap,我有这样的问题: 创建您自己的SOAP web服务,该服务将保存有关人员的信息 e、 在地图上。每个人都具有以下属性: 名字,姓氏,出生日期。 您的web服务将响应一个查询,该查询将根据姓氏、出生日期筛选存储的条目。 根据提供的示例创建JUnit测试,以验证您的SOAP web服务是否按预期工作 我在Eclipse中创建了动态Web项目,并编写了如下类: public class Person { String firstName, surname, birthDate; pub

我有这样的问题: 创建您自己的SOAP web服务,该服务将保存有关人员的信息 e、 在地图上。每个人都具有以下属性: 名字,姓氏,出生日期。 您的web服务将响应一个查询,该查询将根据姓氏、出生日期筛选存储的条目。 根据提供的示例创建JUnit测试,以验证您的SOAP web服务是否按预期工作

我在Eclipse中创建了动态Web项目,并编写了如下类:

public class Person {
    String firstName, surname, birthDate;
    public Person(String firstName, String surname, String birthDate) {
        this.firstName = firstName;
        this.surname = surname;
        this.birthDate = birthDate;
    }
}
a.searchBySurname(SearchBySurname searchBySurname2);
和搜索:

public class Search {
    ArrayList<Person> people = new ArrayList<Person>();
    public Search() {
        Person jim = new Person("Jim", "Abacki","01/01/1990");
        Person scott = new Person("Scott","Babacki", "01/01/1990");
        Person anna = new Person("Anna","Cabacki", "01/01/1991");
        Person dan = new Person("Dan","Dabacki", "01/01/1992");
        Person ola = new Person("Ola","Fabacki", "01/01/1993");
        Person eva = new Person("Eva","Fabacki", "01/01/1991");

        people.add(jim);
        people.add(scott);
        people.add(anna);
        people.add(dan);
        people.add(ola);
        people.add(eva);
    }

    public String[] searchBySurname(String surname){

        int i =0;
        for(Person x : people){
            if(x.surname==surname){
                i++;
            }
        }
        String[] result = new String[i];
        int a=0;
        for(Person x : people){

            if(x.surname==surname){
                result[a]=x.firstName+ " "+ x.surname + " "+ x.birthDate;
                a++;
            }
        }
        return result;
    }


    public String[] searchByBirthDate(String birthDate){
        int i =0;
        for(Person x : people){
            if(x.surname==birthDate){
                i++;
            }
        }
        String[] result = new String[i];
        int a=0;
        for(Person x : people){

            if(x.surname==birthDate){
                result[a]=x.firstName + " "+ x.surname + " "+ x.birthDate;
                a++;
            }
        }
        return result;
    }

}
Eclipse为我提供了如下建议:

public class Person {
    String firstName, surname, birthDate;
    public Person(String firstName, String surname, String birthDate) {
        this.firstName = firstName;
        this.surname = surname;
        this.birthDate = birthDate;
    }
}
a.searchBySurname(SearchBySurname searchBySurname2);
这对我来说也很奇怪,因为这个函数作为参数应该接受字符串

以下是我的问题:
我做错了什么?你能帮我解决这个问题吗?也许有人有很好的教程,因为我在Internet上找到的东西没有帮助。

如果不首先生成有效的WSDL,您就无法调用您的服务。基于您的错误,Eclipse认为您缺少一个操作方法。这是因为Person类没有任何方法。因此,没有操作

幸运的是,就您的设置方式而言,您不需要遍历并生成基于Person的WSDL。但是,您的搜索类使用Person,WSDL应该可以毫无问题地生成。这是您唯一需要的WSDL

现在,对于您的searchBySurname方法,根据您所拥有的,这似乎并不正常。我在这里调试的想法: 您的搜索源看起来不错,所以WSDL应该不错。 b客户端生成??? c当WSDL指定字符串时,该方法需要一个SearchBySurname对象,因此客户端生成一定是错误的。因此,它告诉您使用SearchBySurname对象而不是字符串

*查看本教程: