我有一个 Web服务,它接收自定义对象并返回另一个自定义对象。它可以在GlassFish或JBoss上成功部署。
@WebMethod(operationName = "providerRQ")
@WebResult(name = "BookingInfoResponse" , targetNamespace = "http://tlonewayresprovidrs.jaxbutil.rakes.nhst.com/")
public com.nhst.rakes.jaxbutil.tlonewayresprovidrs.BookingInfoResponse providerRQ(@WebParam(name = "BookingInfoRequest" , targetNamespace = "http://tlonewayresprovidrq.jaxbutil.rakes.nhst.com/")
com.nhst.rakes.jaxbutil.tlonewayresprovidrq.BookingInfoRequest BookingInfoRequest) {
com.nhst.rakes.jaxbutil.tlonewayresprovidrs.BookingInfoResponse BookingInfoResponse = new com.nhst.rakes.jaxbutil.tlonewayresprovidrs.BookingInfoResponse();
return BookingInfoResponse;
}
但是当我为这个网络服务创建一个客户端时,生成了两个 BookingInfoRequest 和 BookingInfoResponse 的实例,即使我只需要一个实例。
这次返回一个错误,指出多个具有相同名称的类是不可能的.......
这是wsdl .....
<?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.1-hudson-28-. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.1-hudson-28-. --><definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://demo/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://demo/" name="DemoJAXBParamService">
<wsp:Policy wsu:Id="DemoJAXBParamPortBindingPolicy">
<ns1:OptimizedMimeSerialization xmlns:ns1="http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization" />
</wsp:Policy>
<types>
<xsd:schema>
<xsd:import namespace="http://tlonewayresprovidrs.jaxbutil.rakes.nhst.com/" schemaLocation="http://localhost:31133/DemoJAXBParamService/DemoJAXBParamService?xsd=1" />
</xsd:schema>
<xsd:schema>
<xsd:import namespace="http://tlonewayresprovidrs.jaxbutil.rakes.nhst.com" schemaLocation="http://localhost:31133/DemoJAXBParamService/DemoJAXBParamService?xsd=2" />
</xsd:schema>
<xsd:schema>
<xsd:import namespace="http://tlonewayresprovidrq.jaxbutil.rakes.nhst.com/" schemaLocation="http://localhost:31133/DemoJAXBParamService/DemoJAXBParamService?xsd=3" />
</xsd:schema>
<xsd:schema>
<xsd:import namespace="http://tlonewayresprovidrq.jaxbutil.rakes.nhst.com" schemaLocation="http://localhost:31133/DemoJAXBParamService/DemoJAXBParamService?xsd=4" />
</xsd:schema>
<xsd:schema>
<xsd:import namespace="http://demo/" schemaLocation="http://localhost:31133/DemoJAXBParamService/DemoJAXBParamService?xsd=5" />
</xsd:schema>
</types>
<message name="providerRQ">
<part name="parameters" element="tns:providerRQ" />
</message>
<message name="providerRQResponse">
<part name="parameters" element="tns:providerRQResponse" />
</message>
<portType name="DemoJAXBParam">
<operation name="providerRQ">
<input wsam:Action="http://demo/DemoJAXBParam/providerRQRequest" message="tns:providerRQ" />
<output wsam:Action="http://demo/DemoJAXBParam/providerRQResponse" message="tns:providerRQResponse" />
</operation>
</portType>
<binding name="DemoJAXBParamPortBinding" type="tns:DemoJAXBParam">
<wsp:PolicyReference URI="#DemoJAXBParamPortBindingPolicy" />
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
<operation name="providerRQ">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<service name="DemoJAXBParamService">
<port name="DemoJAXBParamPort" binding="tns:DemoJAXBParamPortBinding">
<soap:address location="http://localhost:31133/DemoJAXBParamService/DemoJAXBParamService" />
</port>
</service>
</definitions>
所以,我想知道如何只生成一个实例(我不知道为什么在客户端生成两个实例?)。
请帮助我朝正确的方向前进。