SII supply AEAT information. WebServiceException: class xxx do not have a property of the name NNN

1

IDE: NetBeans 8.2 I have created the SOAP client without problems for the SupplyFactEmitted service. When I try to instantiate the port for a query:

  private static void pruebaConsulta(){
    https.www2_agenciatributaria_gob_es.static_files.common.internet.dep.aplicaciones.es.aeat.ssii.fact.ws.suministrofactemitidas.SiiService service = new https.www2_agenciatributaria_gob_es.static_files.common.internet.dep.aplicaciones.es.aeat.ssii.fact.ws.suministrofactemitidas.SiiService();
    System.out.println("he instanciado el service");
    https.www2_agenciatributaria_gob_es.static_files.common.internet.dep.aplicaciones.es.aeat.ssii.fact.ws.suministrofactemitidas.SiiSOAP port = service.getSuministroFactEmitidasPruebas();
    System.out.println("he instanciado el port");

}

I get the following error:

Exception in thread "main" javax.xml.ws.WebServiceException: class https.www2_agenciatributaria_gob_es.static_files.common.internet.dep.aplicaciones.es.aeat.ssii.fact.ws.respuestasuministro.RespuestaLRFEmitidasType do not have a property of the name {https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/ssii/fact/ws/SuministroInformacion.xsd}Cabecera
at com.sun.xml.internal.ws.client.sei.ResponseBuilder$DocLit.<init>(ResponseBuilder.java:616)
at com.sun.xml.internal.ws.client.sei.StubHandler.buildResponseBuilder(StubHandler.java:173)
at com.sun.xml.internal.ws.client.sei.StubHandler.<init>(StubHandler.java:157)
at com.sun.xml.internal.ws.db.DatabindingImpl.initStubHandlers(DatabindingImpl.java:145)
at com.sun.xml.internal.ws.db.DatabindingImpl.<init>(DatabindingImpl.java:90)
at com.sun.xml.internal.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:59)
at com.sun.xml.internal.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:43)
at com.sun.xml.internal.ws.db.DatabindingFactoryImpl.createRuntime(DatabindingFactoryImpl.java:105)
at com.sun.xml.internal.ws.client.WSServiceDelegate.buildRuntimeModel(WSServiceDelegate.java:875)
at com.sun.xml.internal.ws.client.WSServiceDelegate.createSEIPortInfo(WSServiceDelegate.java:892)
at com.sun.xml.internal.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:855)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:435)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:404)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:386)
at javax.xml.ws.Service.getPort(Service.java:119)
at https.www2_agenciatributaria_gob_es.static_files.common.internet.dep.aplicaciones.es.aeat.ssii.fact.ws.suministrofactemitidas.SiiService.getSuministroFactEmitidasPruebas(SiiService.java:94)
at prueba.ws.PruebaWs.pruebaConsulta(PruebaWs.java:40)
at prueba.ws.PruebaWs.main(PruebaWs.java:23) 

Caused by:

Caused by: javax.xml.bind.JAXBException: {https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/ssii/fact/ws/SuministroInformacion.xsd}Cabecera is not a valid property on class https.www2_agenciatributaria_gob_es.static_files.common.internet.dep.aplicaciones.es.aeat.ssii.fact.ws.respuestasuministro.RespuestaLRFEmitidasType
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getElementPropertyAccessor(JAXBContextImpl.java:934)
at com.sun.xml.internal.ws.db.glassfish.JAXBRIContextWrapper.getElementPropertyAccessor(JAXBRIContextWrapper.java:106)
at com.sun.xml.internal.ws.client.sei.ResponseBuilder$DocLit.<init>(ResponseBuilder.java:606)
... 17 more

I have not put any code of mine. Everything used is provided by the Netbeans assistant, which has generated its code from the WSDL of the service.

Can someone give me a clue about what happens with the assistant?

Should we add any parameters to the wsimport?

    
asked by Jose A. Gam 26.04.2017 в 17:39
source

3 answers

1

This problem (and others) I had when I started doing tests with the SII webservice. It is clear that the code that automatically generates the Netbeans (or in my case the Eclipse) is not quite correct.

For my part, the best solution I found was to use the wsimport tool found in the $JDK/bin folder as follows:

wsimport -b bindings.xml -Xnocompile https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/ssii/fact/ws/SuministroFactEmitidas.wsdl

Where the file bindings.xml contains the following:

<jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
    <jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
</jaxws:bindings>
    
answered by 28.04.2017 в 13:59
0

I have read that there are other alternatives to parsing and generating code for a wsdl among others:

  • Apache cxf
  • Apache Axis 2 (the 1 seems to be abandoned)

However they are quite heavy jars (+ 20Megas) and at the moment I do not want to use them.

    
answered by 26.04.2017 в 19:16
0

Have you solved this problem?

I in version 0.6 worked without problems and now when I change to 0.7 it gives me the error.

I put the code that I have and the error it gives me.

-- Code --
System.setProperty("javax.net.ssl.keyStore", "firma.pfx");
System.setProperty("javax.net.ssl.keyStoreType", "PKCS12");
System.setProperty("javax.net.ssl.keyStorePassword", "pass");

SiiService service = new SiiService();
SiiSOAP siiSOAP = service.getSuministroFactEmitidasPruebas();

-- Error -- 
javax.xml.ws.WebServiceException: class https.www2_agenciatributaria_gob_es.static_files.common.internet.dep.aplicaciones.es.aeat.ssii.fact.ws.respuestasuministro.RespuestaLRFEmitidasType do not have a property of the name {https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/ssii/fact/ws/SuministroInformacion.xsd}Cabecera
    at com.sun.xml.ws.client.sei.ResponseBuilder$DocLit.<init>(ResponseBuilder.java:511)
    at com.sun.xml.ws.client.sei.SEIMethodHandler.buildResponseBuilder(SEIMethodHandler.java:172)
    at com.sun.xml.ws.client.sei.SyncMethodHandler.<init>(SyncMethodHandler.java:85)
    at com.sun.xml.ws.client.sei.SEIStub.<init>(SEIStub.java:82)
    at com.sun.xml.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(WSServiceDelegate.java:639)
    at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:342)
    at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:324)
    at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:306)
    at javax.xml.ws.Service.getPort(Service.java:119)
    at https.www2_agenciatributaria_gob_es.static_files.common.internet.dep.aplicaciones.es.aeat.ssii.fact.ws.suministrofactemitidas.SiiService.getSuministroFactEmitidasPruebas(SiiService.java:72)
    at Barpimo.Contabilidad.SII.SuministroFacturas.consultaEstadoEmitidas(SuministroFacturas.java:258)
    at Barpimo.Contabilidad.SII.SuministroFacturas.<init>(SuministroFacturas.java:50)
    at aapella.lanzador.<init>(lanzador.java:212)
    at aapella.lanzador$4.run(lanzador.java:1486)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: javax.xml.bind.JAXBException: {https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/ssii/fact/ws/SuministroInformacion.xsd}Cabecera is not a valid property on class https.www2_agenciatributaria_gob_es.static_files.common.internet.dep.aplicaciones.es.aeat.ssii.fact.ws.respuestasuministro.RespuestaLRFEmitidasType
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getElementPropertyAccessor(JAXBContextImpl.java:942)
    at com.sun.xml.ws.client.sei.ResponseBuilder$DocLit.<init>(ResponseBuilder.java:500)
    ... 27 more

SOLVED I have rebuilt the WebServices and without problems.

    
answered by 22.05.2017 в 15:08