diff --git a/CHANGELOG.md b/CHANGELOG.md
index c86d470d..6aecf3eb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,3 @@
# Notas de versão
-- Atualizado Java Certificado (Ver https://github.com/Samuel-Oliveira/Java_Certificado)
-- Atualizado Cacert (Sefaz Minas)
-- Adicionado ZoneId direto a configuracao e removido da Chamada dos metodos. O padrao de ZoneId é America/Sao_Paulo
\ No newline at end of file
+- Corrigido erro Inutilizacão CE
\ No newline at end of file
diff --git a/README.md b/README.md
index a3b4a974..612d8af1 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Java-NFe [![MIT License](https://img.shields.io/github/license/Samuel-Oliveira/Java_NFe.svg) ](https://github.com/Samuel-Oliveira/Java_NFe/blob/master/LICENSE) [![Maven Central](https://img.shields.io/maven-central/v/br.com.swconsultoria/java-nfe.svg?label=Maven%20Central)](https://search.maven.org/artifact/br.com.swconsultoria/java-nfe/4.00.24/jar)
+# Java-NFe [![MIT License](https://img.shields.io/github/license/Samuel-Oliveira/Java_NFe.svg) ](https://github.com/Samuel-Oliveira/Java_NFe/blob/master/LICENSE) [![Maven Central](https://img.shields.io/maven-central/v/br.com.swconsultoria/java-nfe.svg?label=Maven%20Central)](https://search.maven.org/artifact/br.com.swconsultoria/java-nfe/4.00.25/jar)
Biblioteca Java para consumo do WebService de NFe/NFCe
## Dúvidas, Sugestões ou Consultoria
@@ -17,7 +17,7 @@ Para Iniciar :
br.com.swconsultoria
java-nfe
- 4.00.24
+ 4.00.25
```
@@ -29,7 +29,7 @@ repositories {
}
}
dependencies {
- implementation "br.com.swconsultoria:java-nfe:4.00.24"
+ implementation "br.com.swconsultoria:java-nfe:4.00.25"
}
```
@@ -39,6 +39,9 @@ ________________________________________________________________________________
# Historico de Versões
+## v4.00.25 - 30/07/2023 - Schemas PL.009k
+- Corrigido erro Inutilizacão CE
+
## v4.00.24 - 05/05/2023 - Schemas PL.009k
- Atualizado Java Certificado (Ver https://github.com/Samuel-Oliveira/Java_Certificado)
- Atualizado Cacert (Sefaz Minas)
diff --git a/docs/docs/index.md b/docs/docs/index.md
index 60112499..0a69bcb3 100644
--- a/docs/docs/index.md
+++ b/docs/docs/index.md
@@ -1,4 +1,4 @@
-[![Build Status](https://travis-ci.org/Samuel-Oliveira/Java_NFe.svg?branch=master)](https://travis-ci.org/Samuel-Oliveira/Java_NFe) [![MIT License](https://img.shields.io/github/license/Samuel-Oliveira/Java_NFe.svg) ](https://github.com/Samuel-Oliveira/Java_NFe/blob/master/LICENSE) [![Maven Central](https://img.shields.io/maven-central/v/br.com.swconsultoria/java-nfe.svg?label=Maven%20Central)](https://search.maven.org/artifact/br.com.swconsultoria/java-nfe/4.00.24/jar) [![Language grade: Java](https://img.shields.io/lgtm/grade/java/g/Samuel-Oliveira/Java_NFe.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Samuel-Oliveira/Java_NFe/context:java) [![Total alerts](https://img.shields.io/lgtm/alerts/g/Samuel-Oliveira/Java_NFe.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Samuel-Oliveira/Java_NFe/alerts/)
+[![Build Status](https://travis-ci.org/Samuel-Oliveira/Java_NFe.svg?branch=master)](https://travis-ci.org/Samuel-Oliveira/Java_NFe) [![MIT License](https://img.shields.io/github/license/Samuel-Oliveira/Java_NFe.svg) ](https://github.com/Samuel-Oliveira/Java_NFe/blob/master/LICENSE) [![Maven Central](https://img.shields.io/maven-central/v/br.com.swconsultoria/java-nfe.svg?label=Maven%20Central)](https://search.maven.org/artifact/br.com.swconsultoria/java-nfe/4.00.25/jar) [![Language grade: Java](https://img.shields.io/lgtm/grade/java/g/Samuel-Oliveira/Java_NFe.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Samuel-Oliveira/Java_NFe/context:java) [![Total alerts](https://img.shields.io/lgtm/alerts/g/Samuel-Oliveira/Java_NFe.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Samuel-Oliveira/Java_NFe/alerts/)
***Biblioteca Java para consumo do WebService de NFe/NFCe***
@@ -11,7 +11,7 @@
Para Iniciar :
-- Caso use Libs baixe o [java-nfe-4.00.24.jar](https://github.com/Samuel-Oliveira/Java_NFe/raw/master/java-nfe-4.00.24.jar) e o adicione às bibliotecas de Seu Projeto.
+- Caso use Libs baixe o [java-nfe-4.00.25.jar](https://github.com/Samuel-Oliveira/Java_NFe/raw/master/java-nfe-4.00.25.jar) e o adicione às bibliotecas de Seu Projeto.
- Baixe o [Schemas.rar](https://github.com/Samuel-Oliveira/Java_NFe/raw/master/schemas.zip) e extraia na sua Máquina.
@@ -20,7 +20,7 @@ Para Iniciar :
br.com.swconsultoria
java-nfe
- 4.00.24
+ 4.00.25
```
@@ -32,7 +32,7 @@ repositories {
}
}
dependencies {
- implementation "br.com.swconsultoria:java-nfe:4.00.24"
+ implementation "br.com.swconsultoria:java-nfe:4.00.25"
}
```
diff --git a/pom.xml b/pom.xml
index 9b79165e..d5706925 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
4.0.0
br.com.swconsultoria
java-nfe
- 4.00.24-SNAPSHOT
+ 4.00.26-SNAPSHOT
Java_NFe
Api java para consumo do webService de nota fiscal eletronica
https://github.com/Samuel-Oliveira/Java_NFe
diff --git a/src/main/java/br/com/swconsultoria/nfe/Inutilizar.java b/src/main/java/br/com/swconsultoria/nfe/Inutilizar.java
index a94ddd3b..04c62acd 100644
--- a/src/main/java/br/com/swconsultoria/nfe/Inutilizar.java
+++ b/src/main/java/br/com/swconsultoria/nfe/Inutilizar.java
@@ -3,6 +3,7 @@
import br.com.swconsultoria.nfe.dom.ConfiguracoesNfe;
import br.com.swconsultoria.nfe.dom.enuns.AssinaturaEnum;
import br.com.swconsultoria.nfe.dom.enuns.DocumentoEnum;
+import br.com.swconsultoria.nfe.dom.enuns.EstadosEnum;
import br.com.swconsultoria.nfe.dom.enuns.ServicosEnum;
import br.com.swconsultoria.nfe.exception.NfeException;
import br.com.swconsultoria.nfe.schema_4.inutNFe.TInutNFe;
@@ -45,21 +46,39 @@ static TRetInutNFe inutiliza(ConfiguracoesNfe config, TInutNFe inutNFe, Document
OMElement ome = AXIOMUtil.stringToOM(xml);
- NFeInutilizacao4Stub.NfeDadosMsg dadosMsg = new NFeInutilizacao4Stub.NfeDadosMsg();
- dadosMsg.setExtraElement(ome);
+ if (EstadosEnum.CE.equals(config.getEstado()) ) {
+ br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeDadosMsg dadosMsgCe =
+ new br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeDadosMsg();
+ dadosMsgCe.setExtraElement(ome);
+ br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub stubCe = new br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub(
+ WebServiceUtil.getUrl(config, tipoDocumento, ServicosEnum.INUTILIZACAO));
- NFeInutilizacao4Stub stub = new NFeInutilizacao4Stub(
- WebServiceUtil.getUrl(config, tipoDocumento, ServicosEnum.INUTILIZACAO));
+ // Timeout
+ if (ObjetoUtil.verifica(config.getTimeout()).isPresent()) {
+ stubCe._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT, config.getTimeout());
+ stubCe._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT, config.getTimeout());
+ }
+ br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeResultMsg resultCe = stubCe.nfeInutilizacaoNF(dadosMsgCe);
- // Timeout
- if (ObjetoUtil.verifica(config.getTimeout()).isPresent()) {
- stub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT, config.getTimeout());
- stub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT, config.getTimeout());
+ log.info("[XML-RETORNO]: " + resultCe.getExtraElement().toString());
+ return XmlNfeUtil.xmlToObject(resultCe.getExtraElement().toString(), TRetInutNFe.class);
+ } else{
+ NFeInutilizacao4Stub.NfeDadosMsg dadosMsg = new NFeInutilizacao4Stub.NfeDadosMsg();
+ dadosMsg.setExtraElement(ome);
+ NFeInutilizacao4Stub stub = new NFeInutilizacao4Stub(
+ WebServiceUtil.getUrl(config, tipoDocumento, ServicosEnum.INUTILIZACAO));
+
+ // Timeout
+ if (ObjetoUtil.verifica(config.getTimeout()).isPresent()) {
+ stub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT, config.getTimeout());
+ stub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT, config.getTimeout());
+ }
+ NFeInutilizacao4Stub.NfeResultMsg result = stub.nfeInutilizacaoNF(dadosMsg);
+
+ log.info("[XML-RETORNO]: " + result.getExtraElement().toString());
+ return XmlNfeUtil.xmlToObject(result.getExtraElement().toString(), TRetInutNFe.class);
}
- NFeInutilizacao4Stub.NfeResultMsg result = stub.nfeInutilizacaoNF(dadosMsg);
- log.info("[XML-RETORNO]: " + result.getExtraElement().toString());
- return XmlNfeUtil.xmlToObject(result.getExtraElement().toString(), TRetInutNFe.class);
} catch (RemoteException | XMLStreamException | JAXBException e) {
throw new NfeException(e.getMessage(),e);
}
diff --git a/src/main/java/br/com/swconsultoria/nfe/dom/ConfiguracoesNfe.java b/src/main/java/br/com/swconsultoria/nfe/dom/ConfiguracoesNfe.java
index befb6666..adb2c0c1 100644
--- a/src/main/java/br/com/swconsultoria/nfe/dom/ConfiguracoesNfe.java
+++ b/src/main/java/br/com/swconsultoria/nfe/dom/ConfiguracoesNfe.java
@@ -109,7 +109,7 @@ public static ConfiguracoesNfe criarConfiguracoes(EstadosEnum estado, AmbienteEn
if (Logger.getLogger("").isLoggable(Level.SEVERE)) {
System.err.println("####################################################################");
- System.err.println(" Api Java Nfe - Versão 4.00.24 - 06/05/2023");
+ System.err.println(" Api Java Nfe - Versão 4.00.25 - 30/07/2023");
if (Logger.getLogger("").isLoggable(Level.WARNING)) {
System.err.println(" Samuel Olivera - samuel@swconsultoria.com.br ");
}
@@ -199,7 +199,7 @@ public boolean isContigenciaSVC() {
}
/**
- * Atribui um valor para contigenciaSCAN. Caso True, as operações da NF-e
+ * Atribui um valor para contigenciaSVC. Caso True, as operações da NF-e
* funcionarão no modo de Contingência.
* Usar para situações em que não for possível estabelecer conexão com o
* WebService SEFAZ Origem.
diff --git a/src/main/java/br/com/swconsultoria/nfe/wsdl/NFeInutilizacao/ce/NFeInutilizacao4CallbackHandler.java b/src/main/java/br/com/swconsultoria/nfe/wsdl/NFeInutilizacao/ce/NFeInutilizacao4CallbackHandler.java
new file mode 100644
index 00000000..d8caf128
--- /dev/null
+++ b/src/main/java/br/com/swconsultoria/nfe/wsdl/NFeInutilizacao/ce/NFeInutilizacao4CallbackHandler.java
@@ -0,0 +1,55 @@
+/**
+ * NFeInutilizacao4CallbackHandler.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis2 version: 1.7.5 Built on : May 06, 2017 (03:45:26 BST)
+ */
+package br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce;
+
+
+/**
+ * NFeInutilizacao4CallbackHandler Callback class, Users can extend this class and implement
+ * their own receiveResult and receiveError methods.
+ */
+public abstract class NFeInutilizacao4CallbackHandler {
+ protected Object clientData;
+
+ /**
+ * User can pass in any object that needs to be accessed once the NonBlocking
+ * Web service call is finished and appropriate method of this CallBack is called.
+ * @param clientData Object mechanism by which the user can pass in user data
+ * that will be avilable at the time this callback is called.
+ */
+ public NFeInutilizacao4CallbackHandler(Object clientData) {
+ this.clientData = clientData;
+ }
+
+ /**
+ * Please use this constructor if you don't want to set any clientData
+ */
+ public NFeInutilizacao4CallbackHandler() {
+ this.clientData = null;
+ }
+
+ /**
+ * Get the client data
+ */
+ public Object getClientData() {
+ return clientData;
+ }
+
+ /**
+ * auto generated Axis2 call back method for nfeInutilizacaoNF method
+ * override this method for handling normal response from nfeInutilizacaoNF operation
+ */
+ public void receiveResultnfeInutilizacaoNF(
+ br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeResultMsg result) {
+ }
+
+ /**
+ * auto generated Axis2 Error handler
+ * override this method for handling error response from nfeInutilizacaoNF operation
+ */
+ public void receiveErrornfeInutilizacaoNF(java.lang.Exception e) {
+ }
+}
diff --git a/src/main/java/br/com/swconsultoria/nfe/wsdl/NFeInutilizacao/ce/NFeInutilizacao4Stub.java b/src/main/java/br/com/swconsultoria/nfe/wsdl/NFeInutilizacao/ce/NFeInutilizacao4Stub.java
new file mode 100644
index 00000000..f00ea168
--- /dev/null
+++ b/src/main/java/br/com/swconsultoria/nfe/wsdl/NFeInutilizacao/ce/NFeInutilizacao4Stub.java
@@ -0,0 +1,1275 @@
+/**
+ * NFeInutilizacao4Stub.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis2 version: 1.7.5 Built on : May 06, 2017 (03:45:26 BST)
+ */
+package br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce;
+
+
+/*
+ * NFeInutilizacao4Stub java implementation
+ */
+public class NFeInutilizacao4Stub extends org.apache.axis2.client.Stub {
+ private static int counter = 0;
+ protected org.apache.axis2.description.AxisOperation[] _operations;
+
+ //hashmaps to keep the fault mapping
+ private java.util.HashMap faultExceptionNameMap = new java.util.HashMap();
+ private java.util.HashMap faultExceptionClassNameMap = new java.util.HashMap();
+ private java.util.HashMap faultMessageMap = new java.util.HashMap();
+ private javax.xml.namespace.QName[] opNameArray = null;
+
+ /**
+ *Constructor that takes in a configContext
+ */
+ public NFeInutilizacao4Stub(
+ org.apache.axis2.context.ConfigurationContext configurationContext,
+ java.lang.String targetEndpoint) throws org.apache.axis2.AxisFault {
+ this(configurationContext, targetEndpoint, false);
+ }
+
+ /**
+ * Constructor that takes in a configContext and useseperate listner
+ */
+ public NFeInutilizacao4Stub(
+ org.apache.axis2.context.ConfigurationContext configurationContext,
+ java.lang.String targetEndpoint, boolean useSeparateListener)
+ throws org.apache.axis2.AxisFault {
+ //To populate AxisService
+ populateAxisService();
+ populateFaults();
+
+ _serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext,
+ _service);
+
+ _serviceClient.getOptions()
+ .setTo(new org.apache.axis2.addressing.EndpointReference(
+ targetEndpoint));
+ _serviceClient.getOptions().setUseSeparateListener(useSeparateListener);
+
+ //Set the soap version
+ _serviceClient.getOptions()
+ .setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+ }
+
+ /**
+ * Default Constructor
+ */
+ public NFeInutilizacao4Stub(
+ org.apache.axis2.context.ConfigurationContext configurationContext)
+ throws org.apache.axis2.AxisFault {
+ this(configurationContext,
+ "http://nfce.sefaz.ce.gov.br:80/nfce4/services/NFeInutilizacao4");
+ }
+
+ /**
+ * Default Constructor
+ */
+ public NFeInutilizacao4Stub() throws org.apache.axis2.AxisFault {
+ this("http://nfce.sefaz.ce.gov.br:80/nfce4/services/NFeInutilizacao4");
+ }
+
+ /**
+ * Constructor taking the target endpoint
+ */
+ public NFeInutilizacao4Stub(java.lang.String targetEndpoint)
+ throws org.apache.axis2.AxisFault {
+ this(null, targetEndpoint);
+ }
+
+ private static synchronized java.lang.String getUniqueSuffix() {
+ // reset the counter if it is greater than 99999
+ if (counter > 99999) {
+ counter = 0;
+ }
+
+ counter = counter + 1;
+
+ return java.lang.Long.toString(java.lang.System.currentTimeMillis()) +
+ "_" + counter;
+ }
+
+ private void populateAxisService() throws org.apache.axis2.AxisFault {
+ //creating the Service with a unique name
+ _service = new org.apache.axis2.description.AxisService(
+ "NFeInutilizacao4" + getUniqueSuffix());
+ addAnonymousOperations();
+
+ //creating the operations
+ org.apache.axis2.description.AxisOperation __operation;
+
+ _operations = new org.apache.axis2.description.AxisOperation[1];
+
+ __operation = new org.apache.axis2.description.OutInAxisOperation();
+
+ __operation.setName(new javax.xml.namespace.QName(
+ "http://www.portalfiscal.inf.br/nfe/wsdl/NFeInutilizacao4",
+ "nfeInutilizacaoNF"));
+ _service.addOperation(__operation);
+
+ _operations[0] = __operation;
+ }
+
+ //populates the faults
+ private void populateFaults() {
+ }
+
+ /**
+ * Auto generated method signature
+ * Servico destinado ao atendimento de solicitacoes de inutilizacao de numeracao
+ * @see br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4#nfeInutilizacaoNF
+ * @param nfeDadosMsg0
+ */
+ public br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeResultMsg nfeInutilizacaoNF(
+ br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeDadosMsg nfeDadosMsg0)
+ throws java.rmi.RemoteException {
+ org.apache.axis2.context.MessageContext _messageContext = null;
+
+ try {
+ org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName());
+ _operationClient.getOptions()
+ .setAction("http://www.portalfiscal.inf.br/nfe/wsdl/NFeInutilizacao4/nfeInutilizacaoNF");
+ _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
+
+ addPropertyToOperationClient(_operationClient,
+ org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
+ "&");
+
+ // create a message context
+ _messageContext = new org.apache.axis2.context.MessageContext();
+
+ // create SOAP envelope with that payload
+ org.apache.axiom.soap.SOAPEnvelope env = null;
+
+ env = toEnvelope(getFactory(_operationClient.getOptions()
+ .getSoapVersionURI()),
+ nfeDadosMsg0,
+
+ optimizeContent(
+ new javax.xml.namespace.QName(
+ "",
+ "nfeInutilizacaoNF")),
+ new javax.xml.namespace.QName(
+ "",
+ "nfeDadosMsg"));
+
+ //adding SOAP soap_headers
+ _serviceClient.addHeadersToEnvelope(env);
+ env.getBody().declareNamespace("http://www.portalfiscal.inf.br/nfe/wsdl/NFeInutilizacao4", "ns1");
+
+ // set the message context with that soap envelope
+ _messageContext.setEnvelope(env);
+
+ // add the message contxt to the operation client
+ _operationClient.addMessageContext(_messageContext);
+
+ //execute the operation client
+ _operationClient.execute(true);
+
+ org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+ org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
+
+ java.lang.Object object = fromOM(_returnEnv.getBody()
+ .getFirstElement(),
+ br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeResultMsg.class);
+
+ return (br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeResultMsg) object;
+ } catch (org.apache.axis2.AxisFault f) {
+ org.apache.axiom.om.OMElement faultElt = f.getDetail();
+
+ if (faultElt != null) {
+ if (faultExceptionNameMap.containsKey(
+ new org.apache.axis2.client.FaultMapKey(
+ faultElt.getQName(), "nfeInutilizacaoNF"))) {
+ //make the fault by reflection
+ try {
+ java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(
+ faultElt.getQName(), "nfeInutilizacaoNF"));
+ java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
+ java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(java.lang.String.class);
+ java.lang.Exception ex = (java.lang.Exception) constructor.newInstance(f.getMessage());
+
+ //message class
+ java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(
+ faultElt.getQName(), "nfeInutilizacaoNF"));
+ java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
+ java.lang.Object messageObject = fromOM(faultElt,
+ messageClass);
+ java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
+ new java.lang.Class[] { messageClass });
+ m.invoke(ex, new java.lang.Object[] { messageObject });
+
+ throw new java.rmi.RemoteException(ex.getMessage(), ex);
+ } catch (java.lang.ClassCastException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ } catch (java.lang.ClassNotFoundException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ } catch (java.lang.NoSuchMethodException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ } catch (java.lang.reflect.InvocationTargetException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ } catch (java.lang.IllegalAccessException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ } catch (java.lang.InstantiationException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ }
+ } else {
+ throw f;
+ }
+ } else {
+ throw f;
+ }
+ } finally {
+ if (_messageContext.getTransportOut() != null) {
+ _messageContext.getTransportOut().getSender()
+ .cleanup(_messageContext);
+ }
+ }
+ }
+
+ /**
+ * Auto generated method signature for Asynchronous Invocations
+ * Servico destinado ao atendimento de solicitacoes de inutilizacao de numeracao
+ * @see br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4#startnfeInutilizacaoNF
+ * @param nfeDadosMsg0
+ */
+ public void startnfeInutilizacaoNF(
+ br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeDadosMsg nfeDadosMsg0,
+ final br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4CallbackHandler callback)
+ throws java.rmi.RemoteException {
+ org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName());
+ _operationClient.getOptions()
+ .setAction("http://www.portalfiscal.inf.br/nfe/wsdl/NFeInutilizacao4/nfeInutilizacaoNF");
+ _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
+
+ addPropertyToOperationClient(_operationClient,
+ org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
+ "&");
+
+ // create SOAP envelope with that payload
+ org.apache.axiom.soap.SOAPEnvelope env = null;
+ final org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext();
+
+ //Style is Doc.
+ env = toEnvelope(getFactory(_operationClient.getOptions()
+ .getSoapVersionURI()),
+ nfeDadosMsg0,
+ optimizeContent(
+ new javax.xml.namespace.QName(
+ "http://www.portalfiscal.inf.br/nfe/wsdl/NFeInutilizacao4",
+ "nfeInutilizacaoNF")),
+ new javax.xml.namespace.QName(
+ "http://www.portalfiscal.inf.br/nfe/wsdl/NFeInutilizacao4",
+ "nfeDadosMsg"));
+
+ // adding SOAP soap_headers
+ _serviceClient.addHeadersToEnvelope(env);
+ // create message context with that soap envelope
+ _messageContext.setEnvelope(env);
+
+ // add the message context to the operation client
+ _operationClient.addMessageContext(_messageContext);
+
+ _operationClient.setCallback(new org.apache.axis2.client.async.AxisCallback() {
+ public void onMessage(
+ org.apache.axis2.context.MessageContext resultContext) {
+ try {
+ org.apache.axiom.soap.SOAPEnvelope resultEnv = resultContext.getEnvelope();
+
+ java.lang.Object object = fromOM(resultEnv.getBody()
+ .getFirstElement(),
+ br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeResultMsg.class);
+ callback.receiveResultnfeInutilizacaoNF((br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeResultMsg) object);
+ } catch (org.apache.axis2.AxisFault e) {
+ callback.receiveErrornfeInutilizacaoNF(e);
+ }
+ }
+
+ public void onError(java.lang.Exception error) {
+ if (error instanceof org.apache.axis2.AxisFault) {
+ org.apache.axis2.AxisFault f = (org.apache.axis2.AxisFault) error;
+ org.apache.axiom.om.OMElement faultElt = f.getDetail();
+
+ if (faultElt != null) {
+ if (faultExceptionNameMap.containsKey(
+ new org.apache.axis2.client.FaultMapKey(
+ faultElt.getQName(),
+ "nfeInutilizacaoNF"))) {
+ //make the fault by reflection
+ try {
+ java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(
+ faultElt.getQName(),
+ "nfeInutilizacaoNF"));
+ java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
+ java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(java.lang.String.class);
+ java.lang.Exception ex = (java.lang.Exception) constructor.newInstance(f.getMessage());
+
+ //message class
+ java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(
+ faultElt.getQName(),
+ "nfeInutilizacaoNF"));
+ java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
+ java.lang.Object messageObject = fromOM(faultElt,
+ messageClass);
+ java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
+ new java.lang.Class[] { messageClass });
+ m.invoke(ex,
+ new java.lang.Object[] { messageObject });
+
+ callback.receiveErrornfeInutilizacaoNF(new java.rmi.RemoteException(
+ ex.getMessage(), ex));
+ } catch (java.lang.ClassCastException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ callback.receiveErrornfeInutilizacaoNF(f);
+ } catch (java.lang.ClassNotFoundException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ callback.receiveErrornfeInutilizacaoNF(f);
+ } catch (java.lang.NoSuchMethodException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ callback.receiveErrornfeInutilizacaoNF(f);
+ } catch (java.lang.reflect.InvocationTargetException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ callback.receiveErrornfeInutilizacaoNF(f);
+ } catch (java.lang.IllegalAccessException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ callback.receiveErrornfeInutilizacaoNF(f);
+ } catch (java.lang.InstantiationException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ callback.receiveErrornfeInutilizacaoNF(f);
+ } catch (org.apache.axis2.AxisFault e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ callback.receiveErrornfeInutilizacaoNF(f);
+ }
+ } else {
+ callback.receiveErrornfeInutilizacaoNF(f);
+ }
+ } else {
+ callback.receiveErrornfeInutilizacaoNF(f);
+ }
+ } else {
+ callback.receiveErrornfeInutilizacaoNF(error);
+ }
+ }
+
+ public void onFault(
+ org.apache.axis2.context.MessageContext faultContext) {
+ org.apache.axis2.AxisFault fault = org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(faultContext);
+ onError(fault);
+ }
+
+ public void onComplete() {
+ try {
+ _messageContext.getTransportOut().getSender()
+ .cleanup(_messageContext);
+ } catch (org.apache.axis2.AxisFault axisFault) {
+ callback.receiveErrornfeInutilizacaoNF(axisFault);
+ }
+ }
+ });
+
+ org.apache.axis2.util.CallbackReceiver _callbackReceiver = null;
+
+ if ((_operations[0].getMessageReceiver() == null) &&
+ _operationClient.getOptions().isUseSeparateListener()) {
+ _callbackReceiver = new org.apache.axis2.util.CallbackReceiver();
+ _operations[0].setMessageReceiver(_callbackReceiver);
+ }
+
+ //execute the operation client
+ _operationClient.execute(false);
+ }
+
+ private boolean optimizeContent(javax.xml.namespace.QName opName) {
+ if (opNameArray == null) {
+ return false;
+ }
+
+ for (int i = 0; i < opNameArray.length; i++) {
+ if (opName.equals(opNameArray[i])) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private org.apache.axiom.om.OMElement toOM(
+ br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeDadosMsg param,
+ boolean optimizeContent) throws org.apache.axis2.AxisFault {
+ try {
+ return param.getOMElement(br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeDadosMsg.MY_QNAME,
+ org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+ } catch (org.apache.axis2.databinding.ADBException e) {
+ throw org.apache.axis2.AxisFault.makeFault(e);
+ }
+ }
+
+ private org.apache.axiom.om.OMElement toOM(
+ br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeResultMsg param,
+ boolean optimizeContent) throws org.apache.axis2.AxisFault {
+ try {
+ return param.getOMElement(br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeResultMsg.MY_QNAME,
+ org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+ } catch (org.apache.axis2.databinding.ADBException e) {
+ throw org.apache.axis2.AxisFault.makeFault(e);
+ }
+ }
+
+ private org.apache.axiom.soap.SOAPEnvelope toEnvelope(
+ org.apache.axiom.soap.SOAPFactory factory,
+ br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeDadosMsg param,
+ boolean optimizeContent, javax.xml.namespace.QName elementQName)
+ throws org.apache.axis2.AxisFault {
+ try {
+ org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
+ emptyEnvelope.getBody()
+ .addChild(param.getOMElement(
+ br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeDadosMsg.MY_QNAME,
+ factory));
+
+ return emptyEnvelope;
+ } catch (org.apache.axis2.databinding.ADBException e) {
+ throw org.apache.axis2.AxisFault.makeFault(e);
+ }
+ }
+
+ /* methods to provide back word compatibility */
+
+ /**
+ * get the default envelope
+ */
+ private org.apache.axiom.soap.SOAPEnvelope toEnvelope(
+ org.apache.axiom.soap.SOAPFactory factory) {
+ return factory.getDefaultEnvelope();
+ }
+
+ private java.lang.Object fromOM(org.apache.axiom.om.OMElement param,
+ java.lang.Class type) throws org.apache.axis2.AxisFault {
+ try {
+ if (br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeDadosMsg.class.equals(
+ type)) {
+ return br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeDadosMsg.Factory.parse(param.getXMLStreamReaderWithoutCaching());
+ }
+
+ if (br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeResultMsg.class.equals(
+ type)) {
+ return br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeResultMsg.Factory.parse(param.getXMLStreamReaderWithoutCaching());
+ }
+ } catch (java.lang.Exception e) {
+ throw org.apache.axis2.AxisFault.makeFault(e);
+ }
+
+ return null;
+ }
+
+ //http://nfce.sefaz.ce.gov.br:80/nfce4/services/NFeInutilizacao4
+ public static class ExtensionMapper {
+ public static java.lang.Object getTypeObject(
+ java.lang.String namespaceURI, java.lang.String typeName,
+ javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception {
+ throw new org.apache.axis2.databinding.ADBException(
+ "Unsupported type " + namespaceURI + " " + typeName);
+ }
+ }
+
+ public static class NfeDadosMsg implements org.apache.axis2.databinding.ADBBean {
+ public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/nfe/wsdl/NFeInutilizacao4",
+ "nfeDadosMsg", "ns1");
+
+ /**
+ * field for ExtraElement
+ */
+ protected org.apache.axiom.om.OMElement localExtraElement;
+
+ /**
+ * Auto generated getter method
+ * @return org.apache.axiom.om.OMElement
+ */
+ public org.apache.axiom.om.OMElement getExtraElement() {
+ return localExtraElement;
+ }
+
+ /**
+ * Auto generated setter method
+ * @param param ExtraElement
+ */
+ public void setExtraElement(org.apache.axiom.om.OMElement param) {
+ this.localExtraElement = param;
+ }
+
+ /**
+ *
+ * @param parentQName
+ * @param factory
+ * @return org.apache.axiom.om.OMElement
+ */
+ public org.apache.axiom.om.OMElement getOMElement(
+ final javax.xml.namespace.QName parentQName,
+ final org.apache.axiom.om.OMFactory factory)
+ throws org.apache.axis2.databinding.ADBException {
+ return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource(
+ this, MY_QNAME));
+ }
+
+ public void serialize(final javax.xml.namespace.QName parentQName,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws javax.xml.stream.XMLStreamException,
+ org.apache.axis2.databinding.ADBException {
+ serialize(parentQName, xmlWriter, false);
+ }
+
+ public void serialize(final javax.xml.namespace.QName parentQName,
+ javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType)
+ throws javax.xml.stream.XMLStreamException,
+ org.apache.axis2.databinding.ADBException {
+ java.lang.String prefix = null;
+ java.lang.String namespace = null;
+
+ prefix = parentQName.getPrefix();
+ namespace = parentQName.getNamespaceURI();
+ writeStartElement(prefix, namespace, parentQName.getLocalPart(),
+ xmlWriter);
+
+ if (serializeType) {
+ java.lang.String namespacePrefix = registerPrefix(xmlWriter,
+ "http://www.portalfiscal.inf.br/nfe/wsdl/NFeInutilizacao4");
+
+ if ((namespacePrefix != null) &&
+ (namespacePrefix.trim().length() > 0)) {
+ writeAttribute("xsi",
+ "http://www.w3.org/2001/XMLSchema-instance", "type",
+ namespacePrefix + ":nfeDadosMsg", xmlWriter);
+ } else {
+ writeAttribute("xsi",
+ "http://www.w3.org/2001/XMLSchema-instance", "type",
+ "nfeDadosMsg", xmlWriter);
+ }
+ }
+
+ if (localExtraElement != null) {
+ localExtraElement.serialize(xmlWriter);
+ } else {
+ throw new org.apache.axis2.databinding.ADBException(
+ "extraElement cannot be null!!");
+ }
+
+ xmlWriter.writeEndElement();
+ }
+
+ private static java.lang.String generatePrefix(
+ java.lang.String namespace) {
+ if (namespace.equals(
+ "http://www.portalfiscal.inf.br/nfe/wsdl/NFeInutilizacao4")) {
+ return "ns1";
+ }
+
+ return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
+ }
+
+ /**
+ * Utility method to write an element start tag.
+ */
+ private void writeStartElement(java.lang.String prefix,
+ java.lang.String namespace, java.lang.String localPart,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws javax.xml.stream.XMLStreamException {
+ java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
+
+ if (writerPrefix != null) {
+ xmlWriter.writeStartElement(writerPrefix, localPart, namespace);
+ } else {
+ if (namespace.length() == 0) {
+ prefix = "";
+ } else if (prefix == null) {
+ prefix = generatePrefix(namespace);
+ }
+
+ xmlWriter.writeStartElement(prefix, localPart, namespace);
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ }
+ }
+
+ /**
+ * Util method to write an attribute with the ns prefix
+ */
+ private void writeAttribute(java.lang.String prefix,
+ java.lang.String namespace, java.lang.String attName,
+ java.lang.String attValue,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws javax.xml.stream.XMLStreamException {
+ java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
+
+ if (writerPrefix != null) {
+ xmlWriter.writeAttribute(writerPrefix, namespace, attName,
+ attValue);
+ } else {
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ xmlWriter.writeAttribute(prefix, namespace, attName, attValue);
+ }
+ }
+
+ /**
+ * Util method to write an attribute without the ns prefix
+ */
+ private void writeAttribute(java.lang.String namespace,
+ java.lang.String attName, java.lang.String attValue,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws javax.xml.stream.XMLStreamException {
+ if (namespace.equals("")) {
+ xmlWriter.writeAttribute(attName, attValue);
+ } else {
+ xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace),
+ namespace, attName, attValue);
+ }
+ }
+
+ /**
+ * Util method to write an attribute without the ns prefix
+ */
+ private void writeQNameAttribute(java.lang.String namespace,
+ java.lang.String attName, javax.xml.namespace.QName qname,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws javax.xml.stream.XMLStreamException {
+ java.lang.String attributeNamespace = qname.getNamespaceURI();
+ java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
+
+ if (attributePrefix == null) {
+ attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
+ }
+
+ java.lang.String attributeValue;
+
+ if (attributePrefix.trim().length() > 0) {
+ attributeValue = attributePrefix + ":" + qname.getLocalPart();
+ } else {
+ attributeValue = qname.getLocalPart();
+ }
+
+ if (namespace.equals("")) {
+ xmlWriter.writeAttribute(attName, attributeValue);
+ } else {
+ registerPrefix(xmlWriter, namespace);
+ xmlWriter.writeAttribute(attributePrefix, namespace, attName,
+ attributeValue);
+ }
+ }
+
+ /**
+ * method to handle Qnames
+ */
+ private void writeQName(javax.xml.namespace.QName qname,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws javax.xml.stream.XMLStreamException {
+ java.lang.String namespaceURI = qname.getNamespaceURI();
+
+ if (namespaceURI != null) {
+ java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
+
+ if (prefix == null) {
+ prefix = generatePrefix(namespaceURI);
+ xmlWriter.writeNamespace(prefix, namespaceURI);
+ xmlWriter.setPrefix(prefix, namespaceURI);
+ }
+
+ if (prefix.trim().length() > 0) {
+ xmlWriter.writeCharacters(prefix + ":" +
+ org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ } else {
+ // i.e this is the default namespace
+ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ }
+ } else {
+ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ }
+ }
+
+ private void writeQNames(javax.xml.namespace.QName[] qnames,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws javax.xml.stream.XMLStreamException {
+ if (qnames != null) {
+ // we have to store this data until last moment since it is not possible to write any
+ // namespace data after writing the charactor data
+ java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer();
+ java.lang.String namespaceURI = null;
+ java.lang.String prefix = null;
+
+ for (int i = 0; i < qnames.length; i++) {
+ if (i > 0) {
+ stringToWrite.append(" ");
+ }
+
+ namespaceURI = qnames[i].getNamespaceURI();
+
+ if (namespaceURI != null) {
+ prefix = xmlWriter.getPrefix(namespaceURI);
+
+ if ((prefix == null) || (prefix.length() == 0)) {
+ prefix = generatePrefix(namespaceURI);
+ xmlWriter.writeNamespace(prefix, namespaceURI);
+ xmlWriter.setPrefix(prefix, namespaceURI);
+ }
+
+ if (prefix.trim().length() > 0) {
+ stringToWrite.append(prefix).append(":")
+ .append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ } else {
+ stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ }
+ } else {
+ stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ }
+ }
+
+ xmlWriter.writeCharacters(stringToWrite.toString());
+ }
+ }
+
+ /**
+ * Register a namespace prefix
+ */
+ private java.lang.String registerPrefix(
+ javax.xml.stream.XMLStreamWriter xmlWriter,
+ java.lang.String namespace)
+ throws javax.xml.stream.XMLStreamException {
+ java.lang.String prefix = xmlWriter.getPrefix(namespace);
+
+ if (prefix == null) {
+ prefix = generatePrefix(namespace);
+
+ javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
+
+ while (true) {
+ java.lang.String uri = nsContext.getNamespaceURI(prefix);
+
+ if ((uri == null) || (uri.length() == 0)) {
+ break;
+ }
+
+ prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
+ }
+
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ }
+
+ return prefix;
+ }
+
+ /**
+ * Factory class that keeps the parse method
+ */
+ public static class Factory {
+ private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class);
+
+ /**
+ * static method to create the object
+ * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
+ * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
+ * Postcondition: If this object is an element, the reader is positioned at its end element
+ * If this object is a complex type, the reader is positioned at the end element of its outer element
+ */
+ public static NfeDadosMsg parse(
+ javax.xml.stream.XMLStreamReader reader)
+ throws java.lang.Exception {
+ NfeDadosMsg object = new NfeDadosMsg();
+
+ int event;
+ javax.xml.namespace.QName currentQName = null;
+ java.lang.String nillableValue = null;
+ java.lang.String prefix = "";
+ java.lang.String namespaceuri = "";
+
+ try {
+ while (!reader.isStartElement() && !reader.isEndElement())
+ reader.next();
+
+ currentQName = reader.getName();
+
+ if (reader.getAttributeValue(
+ "http://www.w3.org/2001/XMLSchema-instance",
+ "type") != null) {
+ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
+ "type");
+
+ if (fullTypeName != null) {
+ java.lang.String nsPrefix = null;
+
+ if (fullTypeName.indexOf(":") > -1) {
+ nsPrefix = fullTypeName.substring(0,
+ fullTypeName.indexOf(":"));
+ }
+
+ nsPrefix = (nsPrefix == null) ? "" : nsPrefix;
+
+ java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(
+ ":") + 1);
+
+ if (!"nfeDadosMsg".equals(type)) {
+ //find namespace for the prefix
+ java.lang.String nsUri = reader.getNamespaceContext()
+ .getNamespaceURI(nsPrefix);
+
+ return (NfeDadosMsg) ExtensionMapper.getTypeObject(nsUri,
+ type, reader);
+ }
+ }
+ }
+
+ // Note all attributes that were handled. Used to differ normal attributes
+ // from anyAttributes.
+ java.util.Vector handledAttributes = new java.util.Vector();
+
+ reader.next();
+
+ while (!reader.isStartElement() && !reader.isEndElement())
+ reader.next();
+
+ if (reader.isStartElement()) {
+ //use the QName from the parser as the name for the builder
+ javax.xml.namespace.QName startQname1 = reader.getName();
+
+ // We need to wrap the reader so that it produces a fake START_DOCUMENT event
+ // this is needed by the builder classes
+ org.apache.axis2.databinding.utils.NamedStaxOMBuilder builder1 =
+ new org.apache.axis2.databinding.utils.NamedStaxOMBuilder(new org.apache.axis2.util.StreamWrapper(
+ reader), startQname1);
+ object.setExtraElement(builder1.getOMElement());
+
+ reader.next();
+ } // End of if for expected property start element
+
+ else {
+ // 1 - A start element we are not expecting indicates an invalid parameter was passed
+ throw new org.apache.axis2.databinding.ADBException(
+ "Unexpected subelement " + reader.getName());
+ }
+
+ while (!reader.isStartElement() && !reader.isEndElement())
+ reader.next();
+
+ if (reader.isStartElement()) {
+ // 2 - A start element we are not expecting indicates a trailing invalid property
+ throw new org.apache.axis2.databinding.ADBException(
+ "Unexpected subelement " + reader.getName());
+ }
+ } catch (javax.xml.stream.XMLStreamException e) {
+ throw new java.lang.Exception(e);
+ }
+
+ return object;
+ }
+ } //end of factory class
+ }
+
+ public static class NfeResultMsg implements org.apache.axis2.databinding.ADBBean {
+ public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/nfe/wsdl/NFeInutilizacao4",
+ "nfeResultMsg", "ns1");
+
+ /**
+ * field for ExtraElement
+ */
+ protected org.apache.axiom.om.OMElement localExtraElement;
+
+ /**
+ * Auto generated getter method
+ * @return org.apache.axiom.om.OMElement
+ */
+ public org.apache.axiom.om.OMElement getExtraElement() {
+ return localExtraElement;
+ }
+
+ /**
+ * Auto generated setter method
+ * @param param ExtraElement
+ */
+ public void setExtraElement(org.apache.axiom.om.OMElement param) {
+ this.localExtraElement = param;
+ }
+
+ /**
+ *
+ * @param parentQName
+ * @param factory
+ * @return org.apache.axiom.om.OMElement
+ */
+ public org.apache.axiom.om.OMElement getOMElement(
+ final javax.xml.namespace.QName parentQName,
+ final org.apache.axiom.om.OMFactory factory)
+ throws org.apache.axis2.databinding.ADBException {
+ return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource(
+ this, MY_QNAME));
+ }
+
+ public void serialize(final javax.xml.namespace.QName parentQName,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws javax.xml.stream.XMLStreamException,
+ org.apache.axis2.databinding.ADBException {
+ serialize(parentQName, xmlWriter, false);
+ }
+
+ public void serialize(final javax.xml.namespace.QName parentQName,
+ javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType)
+ throws javax.xml.stream.XMLStreamException,
+ org.apache.axis2.databinding.ADBException {
+ java.lang.String prefix = null;
+ java.lang.String namespace = null;
+
+ prefix = parentQName.getPrefix();
+ namespace = parentQName.getNamespaceURI();
+ writeStartElement(prefix, namespace, parentQName.getLocalPart(),
+ xmlWriter);
+
+ if (serializeType) {
+ java.lang.String namespacePrefix = registerPrefix(xmlWriter,
+ "http://www.portalfiscal.inf.br/nfe/wsdl/NFeInutilizacao4");
+
+ if ((namespacePrefix != null) &&
+ (namespacePrefix.trim().length() > 0)) {
+ writeAttribute("xsi",
+ "http://www.w3.org/2001/XMLSchema-instance", "type",
+ namespacePrefix + ":nfeResultMsg", xmlWriter);
+ } else {
+ writeAttribute("xsi",
+ "http://www.w3.org/2001/XMLSchema-instance", "type",
+ "nfeResultMsg", xmlWriter);
+ }
+ }
+
+ if (localExtraElement != null) {
+ localExtraElement.serialize(xmlWriter);
+ } else {
+ throw new org.apache.axis2.databinding.ADBException(
+ "extraElement cannot be null!!");
+ }
+
+ xmlWriter.writeEndElement();
+ }
+
+ private static java.lang.String generatePrefix(
+ java.lang.String namespace) {
+ if (namespace.equals(
+ "http://www.portalfiscal.inf.br/nfe/wsdl/NFeInutilizacao4")) {
+ return "ns1";
+ }
+
+ return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
+ }
+
+ /**
+ * Utility method to write an element start tag.
+ */
+ private void writeStartElement(java.lang.String prefix,
+ java.lang.String namespace, java.lang.String localPart,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws javax.xml.stream.XMLStreamException {
+ java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
+
+ if (writerPrefix != null) {
+ xmlWriter.writeStartElement(writerPrefix, localPart, namespace);
+ } else {
+ if (namespace.length() == 0) {
+ prefix = "";
+ } else if (prefix == null) {
+ prefix = generatePrefix(namespace);
+ }
+
+ xmlWriter.writeStartElement(prefix, localPart, namespace);
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ }
+ }
+
+ /**
+ * Util method to write an attribute with the ns prefix
+ */
+ private void writeAttribute(java.lang.String prefix,
+ java.lang.String namespace, java.lang.String attName,
+ java.lang.String attValue,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws javax.xml.stream.XMLStreamException {
+ java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
+
+ if (writerPrefix != null) {
+ xmlWriter.writeAttribute(writerPrefix, namespace, attName,
+ attValue);
+ } else {
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ xmlWriter.writeAttribute(prefix, namespace, attName, attValue);
+ }
+ }
+
+ /**
+ * Util method to write an attribute without the ns prefix
+ */
+ private void writeAttribute(java.lang.String namespace,
+ java.lang.String attName, java.lang.String attValue,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws javax.xml.stream.XMLStreamException {
+ if (namespace.equals("")) {
+ xmlWriter.writeAttribute(attName, attValue);
+ } else {
+ xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace),
+ namespace, attName, attValue);
+ }
+ }
+
+ /**
+ * Util method to write an attribute without the ns prefix
+ */
+ private void writeQNameAttribute(java.lang.String namespace,
+ java.lang.String attName, javax.xml.namespace.QName qname,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws javax.xml.stream.XMLStreamException {
+ java.lang.String attributeNamespace = qname.getNamespaceURI();
+ java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
+
+ if (attributePrefix == null) {
+ attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
+ }
+
+ java.lang.String attributeValue;
+
+ if (attributePrefix.trim().length() > 0) {
+ attributeValue = attributePrefix + ":" + qname.getLocalPart();
+ } else {
+ attributeValue = qname.getLocalPart();
+ }
+
+ if (namespace.equals("")) {
+ xmlWriter.writeAttribute(attName, attributeValue);
+ } else {
+ registerPrefix(xmlWriter, namespace);
+ xmlWriter.writeAttribute(attributePrefix, namespace, attName,
+ attributeValue);
+ }
+ }
+
+ /**
+ * method to handle Qnames
+ */
+ private void writeQName(javax.xml.namespace.QName qname,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws javax.xml.stream.XMLStreamException {
+ java.lang.String namespaceURI = qname.getNamespaceURI();
+
+ if (namespaceURI != null) {
+ java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
+
+ if (prefix == null) {
+ prefix = generatePrefix(namespaceURI);
+ xmlWriter.writeNamespace(prefix, namespaceURI);
+ xmlWriter.setPrefix(prefix, namespaceURI);
+ }
+
+ if (prefix.trim().length() > 0) {
+ xmlWriter.writeCharacters(prefix + ":" +
+ org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ } else {
+ // i.e this is the default namespace
+ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ }
+ } else {
+ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ }
+ }
+
+ private void writeQNames(javax.xml.namespace.QName[] qnames,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws javax.xml.stream.XMLStreamException {
+ if (qnames != null) {
+ // we have to store this data until last moment since it is not possible to write any
+ // namespace data after writing the charactor data
+ java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer();
+ java.lang.String namespaceURI = null;
+ java.lang.String prefix = null;
+
+ for (int i = 0; i < qnames.length; i++) {
+ if (i > 0) {
+ stringToWrite.append(" ");
+ }
+
+ namespaceURI = qnames[i].getNamespaceURI();
+
+ if (namespaceURI != null) {
+ prefix = xmlWriter.getPrefix(namespaceURI);
+
+ if ((prefix == null) || (prefix.length() == 0)) {
+ prefix = generatePrefix(namespaceURI);
+ xmlWriter.writeNamespace(prefix, namespaceURI);
+ xmlWriter.setPrefix(prefix, namespaceURI);
+ }
+
+ if (prefix.trim().length() > 0) {
+ stringToWrite.append(prefix).append(":")
+ .append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ } else {
+ stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ }
+ } else {
+ stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ }
+ }
+
+ xmlWriter.writeCharacters(stringToWrite.toString());
+ }
+ }
+
+ /**
+ * Register a namespace prefix
+ */
+ private java.lang.String registerPrefix(
+ javax.xml.stream.XMLStreamWriter xmlWriter,
+ java.lang.String namespace)
+ throws javax.xml.stream.XMLStreamException {
+ java.lang.String prefix = xmlWriter.getPrefix(namespace);
+
+ if (prefix == null) {
+ prefix = generatePrefix(namespace);
+
+ javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
+
+ while (true) {
+ java.lang.String uri = nsContext.getNamespaceURI(prefix);
+
+ if ((uri == null) || (uri.length() == 0)) {
+ break;
+ }
+
+ prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
+ }
+
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ }
+
+ return prefix;
+ }
+
+ /**
+ * Factory class that keeps the parse method
+ */
+ public static class Factory {
+ private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class);
+
+ /**
+ * static method to create the object
+ * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
+ * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
+ * Postcondition: If this object is an element, the reader is positioned at its end element
+ * If this object is a complex type, the reader is positioned at the end element of its outer element
+ */
+ public static NfeResultMsg parse(
+ javax.xml.stream.XMLStreamReader reader)
+ throws java.lang.Exception {
+ NfeResultMsg object = new NfeResultMsg();
+
+ int event;
+ javax.xml.namespace.QName currentQName = null;
+ java.lang.String nillableValue = null;
+ java.lang.String prefix = "";
+ java.lang.String namespaceuri = "";
+
+ try {
+ while (!reader.isStartElement() && !reader.isEndElement())
+ reader.next();
+
+ currentQName = reader.getName();
+
+ if (reader.getAttributeValue(
+ "http://www.w3.org/2001/XMLSchema-instance",
+ "type") != null) {
+ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
+ "type");
+
+ if (fullTypeName != null) {
+ java.lang.String nsPrefix = null;
+
+ if (fullTypeName.indexOf(":") > -1) {
+ nsPrefix = fullTypeName.substring(0,
+ fullTypeName.indexOf(":"));
+ }
+
+ nsPrefix = (nsPrefix == null) ? "" : nsPrefix;
+
+ java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(
+ ":") + 1);
+
+ if (!"nfeResultMsg".equals(type)) {
+ //find namespace for the prefix
+ java.lang.String nsUri = reader.getNamespaceContext()
+ .getNamespaceURI(nsPrefix);
+
+ return (NfeResultMsg) ExtensionMapper.getTypeObject(nsUri,
+ type, reader);
+ }
+ }
+ }
+
+ // Note all attributes that were handled. Used to differ normal attributes
+ // from anyAttributes.
+ java.util.Vector handledAttributes = new java.util.Vector();
+
+ reader.next();
+
+ while (!reader.isStartElement() && !reader.isEndElement())
+ reader.next();
+
+ if (reader.isStartElement()) {
+ //use the QName from the parser as the name for the builder
+ javax.xml.namespace.QName startQname1 = reader.getName();
+
+ // We need to wrap the reader so that it produces a fake START_DOCUMENT event
+ // this is needed by the builder classes
+ org.apache.axis2.databinding.utils.NamedStaxOMBuilder builder1 =
+ new org.apache.axis2.databinding.utils.NamedStaxOMBuilder(new org.apache.axis2.util.StreamWrapper(
+ reader), startQname1);
+ object.setExtraElement(builder1.getOMElement());
+
+ reader.next();
+ } // End of if for expected property start element
+
+ else {
+ // 1 - A start element we are not expecting indicates an invalid parameter was passed
+ throw new org.apache.axis2.databinding.ADBException(
+ "Unexpected subelement " + reader.getName());
+ }
+
+ while (!reader.isStartElement() && !reader.isEndElement())
+ reader.next();
+
+ if (reader.isStartElement()) {
+ // 2 - A start element we are not expecting indicates a trailing invalid property
+ throw new org.apache.axis2.databinding.ADBException(
+ "Unexpected subelement " + reader.getName());
+ }
+ } catch (javax.xml.stream.XMLStreamException e) {
+ throw new java.lang.Exception(e);
+ }
+
+ return object;
+ }
+ } //end of factory class
+ }
+}