我正在尝试查找是否有一种方法可以自定义例如ChemSpider WebServiceCSID2ExtRefs
的操作,该操作将字符串列表作为参数之一传递并返回对象列表:
<!-- Request element: -->
<s:element name="CSID2ExtRefs">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="CSID" type="s:int"/>
<s:element minOccurs="0" maxOccurs="1" name="datasources" type="tns:ArrayOfString"/>
<s:element minOccurs="0" maxOccurs="1" name="token" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<!-- Response element: -->
<s:element name="CSID2ExtRefsResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="CSID2ExtRefsResult" type="tns:ArrayOfExtRef"/>
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="ArrayOfExtRef">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="ExtRef" type="tns:ExtRef"/>
</s:sequence>
</s:complexType>
<s:complexType name="ArrayOfString">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="string" nillable="true" type="s:string"/>
</s:sequence>
</s:complexType>
wsimport
接口方法生成的是(with jaxws:enableWrapperStyle = true
):
@WebMethod(operationName = "CSID2ExtRefs", action = "http://www.chemspider.com/CSID2ExtRefs")
@WebResult(name = "CSID2ExtRefsResult", targetNamespace = "http://www.chemspider.com/")
@RequestWrapper(localName = "CSID2ExtRefs", targetNamespace = "http://www.chemspider.com/", className = "chemspider.core.CSID2ExtRefsRequest")
@ResponseWrapper(localName = "CSID2ExtRefsResponse", targetNamespace = "http://www.chemspider.com/", className = "chemspider.core.CSID2ExtRefsResponse")
public ArrayOfExtRef csid2ExtRefs(
@WebParam(name = "CSID", targetNamespace = "http://www.chemspider.com/")
int csid,
@WebParam(name = "datasources", targetNamespace = "http://www.chemspider.com/")
ArrayOfString datasources,
@WebParam(name = "token", targetNamespace = "http://www.chemspider.com/")
String token);
但我想打开ArrayOfExtRef
并ArrayOfString
打开列表,例如获取以下内容:
public List<ExtRef> csid2ExtRefs(
@WebParam(...)
int csid,
@WebParam(...)
List<String> datasources,
@WebParam(...)
String token);
如果我手动进行此更改,JAX-WS 工作正常。我想知道,是否有任何方法可以为此编写适当的自定义?