我使用wsimport和给定的第三方WSDL(我无法改变)生成Java代码。 WSDL使用Java关键字(' return'),因此wsimport不会生成JAVA代码。
为了能够向您展示一个示例,我全球取代了名称' return'进入' retParam'。
这里生成的java代码来自WSDL的某个消息:
/**
*
* @param retParam
* @param header0
* @param parameters
* @param header
*/
@WebMethod(operationName = "CreatePermissionRequest", action = "http://www.url.be/WSUpdate/v1/CreatePermissionRequest")
public void createPermissionRequest(
@WebParam(name = "CreatePermissionRequestRequest", targetNamespace = "http://www.url2.be/WSUpdate/messages/v1_00", partName = "parameters")
CreatePermissionRequestRequest parameters,
@WebParam(name = "SyncHeader", targetNamespace = "http://www.url.be/v1_00", header = true, partName = "header")
SyncHeader header,
@WebParam(name = "CreatePermissionRequestReply", targetNamespace = "http://www.url2.be/WSUpdate/messages/v1_00", mode = WebParam.Mode.OUT, partName = "retParam")
Holder<CreatePermissionRequestReply> retParam,
@WebParam(name = "SyncResponseHeader", targetNamespace = "http://www.url.be/v1_00", header = true, mode = WebParam.Mode.OUT, partName = "header")
Holder<SyncResponseHeader> header0);
这是WSDL中的条目:
<message name="CreatePermissionRequestReply">
<part name="retParam" element="messages:CreatePermissionRequestReply" />
<part name="header" element="fsb:SyncResponseHeader" />
</message>
正如您所看到的那样,零件名称被称为&#39; retParam&#39;这是在createPermissionRequest - 接口的属性中转换的。当我使用wsimport生成Java代码时,我需要指定哪个自定义绑定,因此部件名称&#39; retParam&#39;被映射到其他东西?
目前我正在使用此绑定文件,但它不起作用:(:
<?xml version="1.0" encoding="UTF-8"?>
<jaxws:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxws="http://java.sun.com/xml/ns/jaxws" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" version="2.0" wsdlLocation="WSUpdateTAP.wsdl">
<jaxws:bindings node="wsdl:definitions/wsdl:portType[@name='WSUpdate']/wsdl:operation[@name='CreatePermissionRequest']">
<jaxb:parameter part="definitions/message[@name='CreatePermissionRequestReply']/
part[@name='retParam']" element="retParam"
name="ret"/>
</jaxws:bindings>
</jaxws:bindings>
这里有一个完整的WSDL(不是如上所述的更新服务,但对于Status服务,它是一个较小的WSDL但具有相同的问题:使用return关键字):
<types>
<xs:schema
targetNamespace="http://www.url2.be/WSStatus/messages/v1_00"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:import namespace="http://www.url1.be/v1_00"
schemaLocation="fsb/fsb.xsd" />
<xs:include schemaLocation="WSStatus/wsstatus_messages.xsd" />
</xs:schema>
</types>
<message name="checkAvailabilityRequestMessage">
<part name="parameters" element="messages:checkAvailability" />
<part name="header" element="fsb:SyncHeader" />
</message>
<message name="checkAvailabilityResponseMessage">
<part name="return" element="messages:checkAvailabilityReturn" />
<part name="header" element="fsb:SyncResponseHeader" />
</message>
<portType name="WSStatus">
<operation name="checkAvailability">
<input message="tns:checkAvailabilityRequestMessage"></input>
<output message="tns:checkAvailabilityResponseMessage"></output>
</operation>
</portType>
<binding name="WSStatusSOAPBinding" type="tns:WSStatus">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="checkAvailability">
<soap:operation style="document"
soapAction="http://www.url1.be/WSStatus/v1/checkAvailability" />
<input>
<soap:body use="literal" parts="parameters" />
<soap:header use="literal" part="header"
message="tns:checkAvailabilityRequestMessage" />
</input>
<output>
<soap:body use="literal" parts="return" />
<soap:header use="literal" part="header"
message="tns:checkAvailabilityResponseMessage">
</soap:header>
</output>
</operation>
</binding>
<service name="WSStatusService">
<port name="WSStatusSOAP" binding="tns:WSStatusSOAPBinding">
<soap:address location="https://www.url2.be/fsb/WSStatus" />
</port>
</service>
</definitions>
任何想法有什么不对?