Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.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 jaxws复杂类型包_Java_Wcf_Jax Ws_Jax Ws Customization - Fatal编程技术网

Java jaxws复杂类型包

Java jaxws复杂类型包,java,wcf,jax-ws,jax-ws-customization,Java,Wcf,Jax Ws,Jax Ws Customization,假设jaxws-soap生成的客户端使用wsimport使用了一个WCF服务。 服务SEI看起来像 @WebMethod(operationName = "DoSomething", action = "http://mydomain.com/PersonService/Dosomething") @WebResult(name = "DoSomethingResult", targetNamespace = "http://mydomain.com/") @RequestWrapper(loc

假设jaxws-soap生成的客户端使用wsimport使用了一个WCF服务。 服务SEI看起来像

@WebMethod(operationName = "DoSomething", action = "http://mydomain.com/PersonService/Dosomething")
@WebResult(name = "DoSomethingResult", targetNamespace = "http://mydomain.com/")
@RequestWrapper(localName = "DoSomething", targetNamespace = "http://mydomain.com/", className = "webservice.jaxws.DoSomething")
@ResponseWrapper(localName = "DoSomethingResponse", targetNamespace = "http://mydomain.com/", className = "webservice.jaxws.DoSomething")
public Person doSomething(
    @WebParam(name = "person", targetNamespace = "http://mydomain.com/")
    Person person);
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
  "person"
})
@XmlRootElement(name = "DoSomething")
public class DoSomething {

@XmlElement(nillable = true)
protected Person person;
public Person getPerson() {
    return person;
}
public void setPerson(Person value) {
    this.person = value;
}
它接受一个复杂类型的Person并返回相同类型的Person和生成的DoSomething

@WebMethod(operationName = "DoSomething", action = "http://mydomain.com/PersonService/Dosomething")
@WebResult(name = "DoSomethingResult", targetNamespace = "http://mydomain.com/")
@RequestWrapper(localName = "DoSomething", targetNamespace = "http://mydomain.com/", className = "webservice.jaxws.DoSomething")
@ResponseWrapper(localName = "DoSomethingResponse", targetNamespace = "http://mydomain.com/", className = "webservice.jaxws.DoSomething")
public Person doSomething(
    @WebParam(name = "person", targetNamespace = "http://mydomain.com/")
    Person person);
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
  "person"
})
@XmlRootElement(name = "DoSomething")
public class DoSomething {

@XmlElement(nillable = true)
protected Person person;
public Person getPerson() {
    return person;
}
public void setPerson(Person value) {
    this.person = value;
}
如果Person和DoSomething是同一个包,那么一切都正常,只要我将Person移动到其他地方,WCF服务就无法从Person对象中获取任何内容(字段为null或0),JAXWS无法正确反序列化WCF的返回值,尽管没有异常

我注意到,如果它们在同一个包中,那么将调用setPerson,但如果它们在不同的包中,则不会调用setPerson


我想知道是否可以将复杂类型的Person作为DoSomething放在不同的包中。

结果需要Person包中的magic package-info.java文件

结果需要Person包中的magic package-info.java文件

此处定义:此处定义: