wsdl2java和文档/文字包装样式问题

wsdl2java和文档/文字包装样式问题,java,web-services,soap,wsdl2java,Java,Web Services,Soap,Wsdl2java,大家好 比如说,我有一个web服务: @WebService public interface StubWebService { /** * Just a stub method. */ public void stubMethod(); } 我想用wsdl2java工具生成它的客户机。生成之后,我得到一个文档/文字包装的web服务存根。让我们来看一下: @WebService(targetNamespace = "target", name =

大家好

比如说,我有一个web服务:

@WebService
public interface StubWebService {
   /**
    * Just a stub method.
    */
   public void stubMethod();

}
我想用wsdl2java工具生成它的客户机。生成之后,我得到一个文档/文字包装的web服务存根。让我们来看一下:

    @WebService(targetNamespace = "target", name =    
         "StubWebService")
    @XmlSeeAlso({ObjectFactory.class})
    public interface StubWebService {

      @RequestWrapper(
        localName = "stubMethod",
        targetNamespace = "target",
        className = "packageName.StubMethod")
      @WebMethod
      @ResponseWrapper(
        localName = "stubMethodResponse",
        targetNamespace = "target",
        className = "packageName.StubMethodResponse")
      public void stubMethod();
   }
当然,还有:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "stubMethod")
public class StubMethod {
}

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "stubMethodResponse")
public class StubMethodResponse {
}
可以看出,存在重复片段,例如:

@RequestWrapper(localName = "stubMethod"

正因为如此,引发了异常“IllegalAnnotationException:两个类具有相同的XML类型…”。解决方案是在“stubMethod”之外的其他内容上更改@XmlType(name=),例如“stubMethod1”

我的问题是,为什么wsdl2java工具会生成一个断章取义的代码,@XmlType生成一个绑定到的“内部”模式是什么(其中显示了“stubMethod1”标记)


提前感谢!

它只抱怨stubMethod?没有抱怨stubMethodResponse?stubMethodResponse的行为是相同的……实际上,每个包装类的行为都是相同的。
 @XmlType(name = "stubMethod")