我正在使用Apache CXF来处理web服务。我有一个WSDL,我用wsdl2java生成了类。在WSDL中,我有以下定义
<xs:complexType name="consultarTramitesPorOrganismoResponse">
<xs:sequence>
<xs:element form="qualified" minOccurs="0" name="return" type="tns:consultarTramitesPorOrganismoWSResponseSalida"/>
</xs:sequence>
Java类是正确生成的。
我有以下客户:
public class Cliente2 {
private static final QName SERVICE_NAME =
new QName("http://ws.funcionario.map.es/",
"reaCXFWS");
public Cliente2() {
super();
}
public static void main(String[] args) {
Cliente2 cliente2 = new Cliente2();
System.out.println("principio de cliente");
URL wsdlURL=null;
try {
wsdlURL = new URL("file:/D:/carlota/forja38315/reaCXFWS.wsdl");
} catch (MalformedURLException e) {
}
System.out.println("cliente paso 1");
ReaCXFWS ss = new ReaCXFWS(wsdlURL, SERVICE_NAME);
System.out.println("cliente paso 11");
WSREACXFService port = ss.getWSREACXFServiceImplPort();
System.out.println("Cliente paso 2 antes de llamada");
ConsultarCategoriasPorOrganismoWSResponseSalida resp1 = port.consultarCategoriasPorOrganismo("2");
// ConsultarCategoriasPorOrganismoWSResponseSalida resp = port.consultarCategoriasPorOrganismo("2");
System.out.println("Server responded with: " + resp1);
}
}
当我执行客户端时,我收到以下错误消息:
Exception in thread "main" javax.xml.ws.WebServiceException: class es.map.funcionario.ws.ConsultarCategoriasPorOrganismoResponse do not have a property of the name return
at com.sun.xml.internal.ws.client.sei.ResponseBuilder$DocLit.<init>(ResponseBuilder.java:500)
at com.sun.xml.internal.ws.client.sei.SEIMethodHandler.buildResponseBuilder(SEIMethodHandler.java:160)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.<init>(SyncMethodHandler.java:74)
at com.sun.xml.internal.ws.client.sei.SEIStub.<init>(SEIStub.java:71)
at com.sun.xml.internal.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(WSServiceDelegate.java:628)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:331)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:313)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:295)
at javax.xml.ws.Service.getPort(Service.java:92)
at es.map.funcionario.ws.ReaCXFWS.getWSREACXFServiceImplPort(ReaCXFWS.java:61)
at clientes.Cliente2.main(Cliente2.java:40)
Caused by: javax.xml.bind.JAXBException: return is not a valid property on class es.map.funcionario.ws.ConsultarCategoriasPorOrganismoResponse
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getElementPropertyAccessor(JAXBContextImpl.java:931)
at com.sun.xml.internal.ws.client.sei.ResponseBuilder$DocLit.<init>(ResponseBuilder.java:489)
... 10 more
Process exited with exit code 1.
有人可以帮我解决这个错误吗?
提前致谢
Carlota Vina