Java 如何为自动生成的SOAP Web服务请求提供相同的接口?
我正在使用Java 如何为自动生成的SOAP Web服务请求提供相同的接口?,java,web-services,soap,jaxb,cxf,Java,Web Services,Soap,Jaxb,Cxf,我正在使用CXF(wsdl2java)自动生成soapwebservice类 生成的soap方法来自xml标记,如: <wsdl:message name="GetAvailabilityReq"> <wsdl:part name="parameters" element="q1:GetAvailabilityReq" xmlns:q1="http://path.to./MyService" /> </wsdl:mes
CXF
(wsdl2java)自动生成soap
webservice类
生成的soap方法来自xml标记,如:
<wsdl:message name="GetAvailabilityReq">
<wsdl:part name="parameters" element="q1:GetAvailabilityReq"
xmlns:q1="http://path.to./MyService" />
</wsdl:message>
如何在同一界面下对所有请求进行分组
例如AvailabilityReq实现BaseReq
和BookingReq实现BaseReq
?或者也可以是扩展
注意:所提供的wsdl
文件并不共享所有请求的公共接口,但我希望生成该接口
关于自动生成,我可能不得不告诉jaxb/cxf这一点,但如何解决呢?解决方案是在pom.xml中提供以下信息:
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.8.2</version>
</dependency>
<extraargs>
<extraarg>-xjc-XautoInheritance</extraarg>
<extraarg>-xjc-XautoInheritance-xmlRootElementsImplement=package.to.MyCommonInterface</extraarg>
</extraargs>
org.jvnet.jaxb2_commons
jaxb2基础知识
0.8.2
-xjc XAUTO继承
-xjc XautoInheritation xmlRootElementsImplement=package.to.MyCommonInterface
我很好奇,因为我总是用另一种方式-java2wsdl这个插件会有帮助吗?
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.8.2</version>
</dependency>
<extraargs>
<extraarg>-xjc-XautoInheritance</extraarg>
<extraarg>-xjc-XautoInheritance-xmlRootElementsImplement=package.to.MyCommonInterface</extraarg>
</extraargs>