2016-11-05 70 views
0

我在Java中的JAX WS Web服务,我用下面的行改变它从类型文档RPCJava的JAX WS生成WSDL VS WSGEN

@SOAPBinding(style = Style.RPC) 

问题是,当我尝试从JDK 1.8.0_91使用wsgen.exe(版本2.2.9):用于方法生成

"C:\Program Files\Java\jdk1.8.0_91\bin\wsgen.exe" -verbose -cp . com.ws.ServiceImpl -wsdl -inlineSchemas 

的WSDL insertDevolutions如下:

<xs:schema version="1.0" targetNamespace="..." xmlns:xs="http://www.w3.org/2001/XMLSchema">  
    <xs:complexType name="arrayList"> 
     <xs:complexContent> 
      <xs:extension base="tns:abstractList"> 
       <xs:sequence/> 
      </xs:extension> 
     </xs:complexContent> 
    </xs:complexType> 
    <xs:complexType name="abstractList" abstract="true"> 
     <xs:complexContent> 
      <xs:extension base="tns:abstractCollection"> 
       <xs:sequence/> 
      </xs:extension> 
     </xs:complexContent> 
    </xs:complexType> 
    <xs:complexType name="abstractCollection" abstract="true"> 
     <xs:sequence/> 
    </xs:complexType> 
</xs:schema> 
... 
<message name="insertDevolutions"> 
    <part name="arg0" type="xsd:string"/> 
    <part name="arg1" type="tns:arrayList"/> 
    <part name="arg2" type="xsd:string"/> 
    <part name="arg3" type="xsd:string"/> 
    <part name="arg4" type="xsd:string"/> 
    <part name="arg5" type="xsd:string"/> 
    <part name="arg6" type="xsd:boolean"/> 
</message> 

但因为对象下放正确生成通过与URL http://localhost:8080/TestWS/ServiceImpl?wsdl服务产生的WSDL是完全不同的:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="..." attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="..."> 
    <xs:complexType name="devolution"> 
     <xs:sequence> 
      <xs:element name="company" type="xs:string"/> 
      <xs:element name="currency" type="xs:string"/> 
      <xs:element name="registerDate" type="xs:dateTime"/>> 
      <xs:element name="total" type="xs:double"/> 
     </xs:sequence> 
    </xs:complexType> 
    <xs:complexType final="#all" name="devolutionArray"> 
     <xs:sequence> 
      <xs:element maxOccurs="unbounded" minOccurs="0" name="item" nillable="true" type="tns:devolution"/> 
     </xs:sequence> 
    </xs:complexType> 
</xs:schema> 
... 
<wsdl:message name="insertDevolutions"> 
    <wsdl:part name="arg0" type="xsd:string"/> 
    <wsdl:part name="arg1" type="tns:devolutionArray"/> 
    <wsdl:part name="arg2" type="xsd:string"/> 
    <wsdl:part name="arg3" type="xsd:string"/> 
    <wsdl:part name="arg4" type="xsd:string"/> 
    <wsdl:part name="arg5" type="xsd:string"/> 
    <wsdl:part name="arg6" type="xsd:boolean"/> 
</wsdl:message> 

所以我想知道是怎么WSDL与WSDL生成的URL中的选项,因为我认为JAX WS使用与wsgen相同的工具。是否有另一种工具可以像服务提供的那样生成WSDL?

+0

您使用哪个容器? – AliReza19330

回答

0

最后我发现,WSDL用CXF生成,因为该工具WSGEN使用默认的JAXB实现,这一次不转换像List<>和接口类,如ArrayList<>转换就像我在下面的方法之前提到的:

<xs:complexType name="arrayList"> 
    <xs:complexContent> 
     <xs:extension base="tns:abstractList"> 
      <xs:sequence/> 
     </xs:extension> 
    </xs:complexContent> 
</xs:complexType> 

所以当我用CXF与follwing命令提供的工具:

"C:\apache-cxf-3.1.6\bin\java2ws" -wsdl -d . com.ws.ServiceImpl 

RPC风格的WSDL正确生成。