wsdl2java和document / literal包装样式问题

时间:2012-02-25 12:52:57

标签: java web-services soap wsdl2java

大家好,你好!

说,我有一个网络服务:

@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"

 @XmlType(name = "stubMethod")

由于它的异常“IllegalAnnotationException:两个类具有相同的XML类型......”引发了争议。解决方案是更改@XmlType(name = on“stubMethod”以外的内容,比如说“stubMethod1”。

我的问题是,为什么wsdl2java工具会生成特定的破坏代码以及什么是“内部”模式,@ XMLType会生成绑定(其中出现“stubMethod1”标记)?

提前致谢!

0 个答案:

没有答案