Subversion Repositories Integrator Subversion

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
414 espaco 1
/**
2
 * NFeInutilizacao4Stub.java
3
 *
4
 * This file was auto-generated from WSDL
5
 * by the Apache Axis2 version: 1.7.5  Built on : May 06, 2017 (03:45:26 BST)
6
 */
7
package br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce;
8
 
9
 
10
/*
11
 *  NFeInutilizacao4Stub java implementation
12
 */
13
public class NFeInutilizacao4Stub extends org.apache.axis2.client.Stub {
14
    private static int counter = 0;
15
    protected org.apache.axis2.description.AxisOperation[] _operations;
16
 
17
    //hashmaps to keep the fault mapping
18
    private java.util.HashMap faultExceptionNameMap = new java.util.HashMap();
19
    private java.util.HashMap faultExceptionClassNameMap = new java.util.HashMap();
20
    private java.util.HashMap faultMessageMap = new java.util.HashMap();
21
    private javax.xml.namespace.QName[] opNameArray = null;
22
 
23
    /**
24
     *Constructor that takes in a configContext
25
     */
26
    public NFeInutilizacao4Stub(
27
        org.apache.axis2.context.ConfigurationContext configurationContext,
28
        java.lang.String targetEndpoint) throws org.apache.axis2.AxisFault {
29
        this(configurationContext, targetEndpoint, false);
30
    }
31
 
32
    /**
33
     * Constructor that takes in a configContext  and useseperate listner
34
     */
35
    public NFeInutilizacao4Stub(
36
        org.apache.axis2.context.ConfigurationContext configurationContext,
37
        java.lang.String targetEndpoint, boolean useSeparateListener)
38
        throws org.apache.axis2.AxisFault {
39
        //To populate AxisService
40
        populateAxisService();
41
        populateFaults();
42
 
43
        _serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext,
44
                _service);
45
 
46
        _serviceClient.getOptions()
47
                      .setTo(new org.apache.axis2.addressing.EndpointReference(
48
                targetEndpoint));
49
        _serviceClient.getOptions().setUseSeparateListener(useSeparateListener);
50
 
51
        //Set the soap version
52
        _serviceClient.getOptions()
53
                      .setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
54
    }
55
 
56
    /**
57
     * Default Constructor
58
     */
59
    public NFeInutilizacao4Stub(
60
        org.apache.axis2.context.ConfigurationContext configurationContext)
61
        throws org.apache.axis2.AxisFault {
62
        this(configurationContext,
63
            "http://nfce.sefaz.ce.gov.br:80/nfce4/services/NFeInutilizacao4");
64
    }
65
 
66
    /**
67
     * Default Constructor
68
     */
69
    public NFeInutilizacao4Stub() throws org.apache.axis2.AxisFault {
70
        this("http://nfce.sefaz.ce.gov.br:80/nfce4/services/NFeInutilizacao4");
71
    }
72
 
73
    /**
74
     * Constructor taking the target endpoint
75
     */
76
    public NFeInutilizacao4Stub(java.lang.String targetEndpoint)
77
        throws org.apache.axis2.AxisFault {
78
        this(null, targetEndpoint);
79
    }
80
 
81
    private static synchronized java.lang.String getUniqueSuffix() {
82
        // reset the counter if it is greater than 99999
83
        if (counter > 99999) {
84
            counter = 0;
85
        }
86
 
87
        counter = counter + 1;
88
 
89
        return java.lang.Long.toString(java.lang.System.currentTimeMillis()) +
90
        "_" + counter;
91
    }
92
 
93
    private void populateAxisService() throws org.apache.axis2.AxisFault {
94
        //creating the Service with a unique name
95
        _service = new org.apache.axis2.description.AxisService(
96
                "NFeInutilizacao4" + getUniqueSuffix());
97
        addAnonymousOperations();
98
 
99
        //creating the operations
100
        org.apache.axis2.description.AxisOperation __operation;
101
 
102
        _operations = new org.apache.axis2.description.AxisOperation[1];
103
 
104
        __operation = new org.apache.axis2.description.OutInAxisOperation();
105
 
106
        __operation.setName(new javax.xml.namespace.QName(
107
                "http://www.portalfiscal.inf.br/nfe/wsdl/NFeInutilizacao4",
108
                "nfeInutilizacaoNF"));
109
        _service.addOperation(__operation);
110
 
111
        _operations[0] = __operation;
112
    }
113
 
114
    //populates the faults
115
    private void populateFaults() {
116
    }
117
 
118
    /**
119
     * Auto generated method signature
120
     * Servico destinado ao atendimento de solicitacoes de inutilizacao de numeracao
121
     * @see br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4#nfeInutilizacaoNF
122
     * @param nfeDadosMsg0
123
     */
124
    public br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeResultMsg nfeInutilizacaoNF(
125
        br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeDadosMsg nfeDadosMsg0)
126
        throws java.rmi.RemoteException {
127
        org.apache.axis2.context.MessageContext _messageContext = null;
128
 
129
        try {
130
            org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName());
131
            _operationClient.getOptions()
132
                            .setAction("http://www.portalfiscal.inf.br/nfe/wsdl/NFeInutilizacao4/nfeInutilizacaoNF");
133
            _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
134
 
135
            addPropertyToOperationClient(_operationClient,
136
                org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
137
                "&");
138
 
139
            // create a message context
140
            _messageContext = new org.apache.axis2.context.MessageContext();
141
 
142
            // create SOAP envelope with that payload
143
            org.apache.axiom.soap.SOAPEnvelope env = null;
144
 
145
            env = toEnvelope(getFactory(_operationClient.getOptions()
146
                                                        .getSoapVersionURI()),
147
                    nfeDadosMsg0,
148
 
149
            optimizeContent(
150
                    new javax.xml.namespace.QName(
151
                            "",
152
                            "nfeInutilizacaoNF")),
153
                    new javax.xml.namespace.QName(
154
                            "",
155
                            "nfeDadosMsg"));
156
 
157
            //adding SOAP soap_headers
158
            _serviceClient.addHeadersToEnvelope(env);
159
            env.getBody().declareNamespace("http://www.portalfiscal.inf.br/nfe/wsdl/NFeInutilizacao4", "ns1");
160
 
161
            // set the message context with that soap envelope
162
            _messageContext.setEnvelope(env);
163
 
164
            // add the message contxt to the operation client
165
            _operationClient.addMessageContext(_messageContext);
166
 
167
            //execute the operation client
168
            _operationClient.execute(true);
169
 
170
            org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
171
            org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
172
 
173
            java.lang.Object object = fromOM(_returnEnv.getBody()
174
                                                       .getFirstElement(),
175
                    br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeResultMsg.class);
176
 
177
            return (br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeResultMsg) object;
178
        } catch (org.apache.axis2.AxisFault f) {
179
            org.apache.axiom.om.OMElement faultElt = f.getDetail();
180
 
181
            if (faultElt != null) {
182
                if (faultExceptionNameMap.containsKey(
183
                            new org.apache.axis2.client.FaultMapKey(
184
                                faultElt.getQName(), "nfeInutilizacaoNF"))) {
185
                    //make the fault by reflection
186
                    try {
187
                        java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(
188
                                    faultElt.getQName(), "nfeInutilizacaoNF"));
189
                        java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
190
                        java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(java.lang.String.class);
191
                        java.lang.Exception ex = (java.lang.Exception) constructor.newInstance(f.getMessage());
192
 
193
                        //message class
194
                        java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(
195
                                    faultElt.getQName(), "nfeInutilizacaoNF"));
196
                        java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
197
                        java.lang.Object messageObject = fromOM(faultElt,
198
                                messageClass);
199
                        java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
200
                                new java.lang.Class[] { messageClass });
201
                        m.invoke(ex, new java.lang.Object[] { messageObject });
202
 
203
                        throw new java.rmi.RemoteException(ex.getMessage(), ex);
204
                    } catch (java.lang.ClassCastException e) {
205
                        // we cannot intantiate the class - throw the original Axis fault
206
                        throw f;
207
                    } catch (java.lang.ClassNotFoundException e) {
208
                        // we cannot intantiate the class - throw the original Axis fault
209
                        throw f;
210
                    } catch (java.lang.NoSuchMethodException e) {
211
                        // we cannot intantiate the class - throw the original Axis fault
212
                        throw f;
213
                    } catch (java.lang.reflect.InvocationTargetException e) {
214
                        // we cannot intantiate the class - throw the original Axis fault
215
                        throw f;
216
                    } catch (java.lang.IllegalAccessException e) {
217
                        // we cannot intantiate the class - throw the original Axis fault
218
                        throw f;
219
                    } catch (java.lang.InstantiationException e) {
220
                        // we cannot intantiate the class - throw the original Axis fault
221
                        throw f;
222
                    }
223
                } else {
224
                    throw f;
225
                }
226
            } else {
227
                throw f;
228
            }
229
        } finally {
230
            if (_messageContext.getTransportOut() != null) {
231
                _messageContext.getTransportOut().getSender()
232
                               .cleanup(_messageContext);
233
            }
234
        }
235
    }
236
 
237
    /**
238
     * Auto generated method signature for Asynchronous Invocations
239
     * Servico destinado ao atendimento de solicitacoes de inutilizacao de numeracao
240
     * @see br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4#startnfeInutilizacaoNF
241
     * @param nfeDadosMsg0
242
     */
243
    public void startnfeInutilizacaoNF(
244
        br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeDadosMsg nfeDadosMsg0,
245
        final br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4CallbackHandler callback)
246
        throws java.rmi.RemoteException {
247
        org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName());
248
        _operationClient.getOptions()
249
                        .setAction("http://www.portalfiscal.inf.br/nfe/wsdl/NFeInutilizacao4/nfeInutilizacaoNF");
250
        _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
251
 
252
        addPropertyToOperationClient(_operationClient,
253
            org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
254
            "&");
255
 
256
        // create SOAP envelope with that payload
257
        org.apache.axiom.soap.SOAPEnvelope env = null;
258
        final org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext();
259
 
260
        //Style is Doc.
261
        env = toEnvelope(getFactory(_operationClient.getOptions()
262
                                                    .getSoapVersionURI()),
263
                nfeDadosMsg0,
264
                optimizeContent(
265
                    new javax.xml.namespace.QName(
266
                        "http://www.portalfiscal.inf.br/nfe/wsdl/NFeInutilizacao4",
267
                        "nfeInutilizacaoNF")),
268
                new javax.xml.namespace.QName(
269
                    "http://www.portalfiscal.inf.br/nfe/wsdl/NFeInutilizacao4",
270
                    "nfeDadosMsg"));
271
 
272
        // adding SOAP soap_headers
273
        _serviceClient.addHeadersToEnvelope(env);
274
        // create message context with that soap envelope
275
        _messageContext.setEnvelope(env);
276
 
277
        // add the message context to the operation client
278
        _operationClient.addMessageContext(_messageContext);
279
 
280
        _operationClient.setCallback(new org.apache.axis2.client.async.AxisCallback() {
281
                public void onMessage(
282
                    org.apache.axis2.context.MessageContext resultContext) {
283
                    try {
284
                        org.apache.axiom.soap.SOAPEnvelope resultEnv = resultContext.getEnvelope();
285
 
286
                        java.lang.Object object = fromOM(resultEnv.getBody()
287
                                                                  .getFirstElement(),
288
                                br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeResultMsg.class);
289
                        callback.receiveResultnfeInutilizacaoNF((br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeResultMsg) object);
290
                    } catch (org.apache.axis2.AxisFault e) {
291
                        callback.receiveErrornfeInutilizacaoNF(e);
292
                    }
293
                }
294
 
295
                public void onError(java.lang.Exception error) {
296
                    if (error instanceof org.apache.axis2.AxisFault) {
297
                        org.apache.axis2.AxisFault f = (org.apache.axis2.AxisFault) error;
298
                        org.apache.axiom.om.OMElement faultElt = f.getDetail();
299
 
300
                        if (faultElt != null) {
301
                            if (faultExceptionNameMap.containsKey(
302
                                        new org.apache.axis2.client.FaultMapKey(
303
                                            faultElt.getQName(),
304
                                            "nfeInutilizacaoNF"))) {
305
                                //make the fault by reflection
306
                                try {
307
                                    java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(
308
                                                faultElt.getQName(),
309
                                                "nfeInutilizacaoNF"));
310
                                    java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
311
                                    java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(java.lang.String.class);
312
                                    java.lang.Exception ex = (java.lang.Exception) constructor.newInstance(f.getMessage());
313
 
314
                                    //message class
315
                                    java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(
316
                                                faultElt.getQName(),
317
                                                "nfeInutilizacaoNF"));
318
                                    java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
319
                                    java.lang.Object messageObject = fromOM(faultElt,
320
                                            messageClass);
321
                                    java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
322
                                            new java.lang.Class[] { messageClass });
323
                                    m.invoke(ex,
324
                                        new java.lang.Object[] { messageObject });
325
 
326
                                    callback.receiveErrornfeInutilizacaoNF(new java.rmi.RemoteException(
327
                                            ex.getMessage(), ex));
328
                                } catch (java.lang.ClassCastException e) {
329
                                    // we cannot intantiate the class - throw the original Axis fault
330
                                    callback.receiveErrornfeInutilizacaoNF(f);
331
                                } catch (java.lang.ClassNotFoundException e) {
332
                                    // we cannot intantiate the class - throw the original Axis fault
333
                                    callback.receiveErrornfeInutilizacaoNF(f);
334
                                } catch (java.lang.NoSuchMethodException e) {
335
                                    // we cannot intantiate the class - throw the original Axis fault
336
                                    callback.receiveErrornfeInutilizacaoNF(f);
337
                                } catch (java.lang.reflect.InvocationTargetException e) {
338
                                    // we cannot intantiate the class - throw the original Axis fault
339
                                    callback.receiveErrornfeInutilizacaoNF(f);
340
                                } catch (java.lang.IllegalAccessException e) {
341
                                    // we cannot intantiate the class - throw the original Axis fault
342
                                    callback.receiveErrornfeInutilizacaoNF(f);
343
                                } catch (java.lang.InstantiationException e) {
344
                                    // we cannot intantiate the class - throw the original Axis fault
345
                                    callback.receiveErrornfeInutilizacaoNF(f);
346
                                } catch (org.apache.axis2.AxisFault e) {
347
                                    // we cannot intantiate the class - throw the original Axis fault
348
                                    callback.receiveErrornfeInutilizacaoNF(f);
349
                                }
350
                            } else {
351
                                callback.receiveErrornfeInutilizacaoNF(f);
352
                            }
353
                        } else {
354
                            callback.receiveErrornfeInutilizacaoNF(f);
355
                        }
356
                    } else {
357
                        callback.receiveErrornfeInutilizacaoNF(error);
358
                    }
359
                }
360
 
361
                public void onFault(
362
                    org.apache.axis2.context.MessageContext faultContext) {
363
                    org.apache.axis2.AxisFault fault = org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(faultContext);
364
                    onError(fault);
365
                }
366
 
367
                public void onComplete() {
368
                    try {
369
                        _messageContext.getTransportOut().getSender()
370
                                       .cleanup(_messageContext);
371
                    } catch (org.apache.axis2.AxisFault axisFault) {
372
                        callback.receiveErrornfeInutilizacaoNF(axisFault);
373
                    }
374
                }
375
            });
376
 
377
        org.apache.axis2.util.CallbackReceiver _callbackReceiver = null;
378
 
379
        if ((_operations[0].getMessageReceiver() == null) &&
380
                _operationClient.getOptions().isUseSeparateListener()) {
381
            _callbackReceiver = new org.apache.axis2.util.CallbackReceiver();
382
            _operations[0].setMessageReceiver(_callbackReceiver);
383
        }
384
 
385
        //execute the operation client
386
        _operationClient.execute(false);
387
    }
388
 
389
    private boolean optimizeContent(javax.xml.namespace.QName opName) {
390
        if (opNameArray == null) {
391
            return false;
392
        }
393
 
394
        for (int i = 0; i < opNameArray.length; i++) {
395
            if (opName.equals(opNameArray[i])) {
396
                return true;
397
            }
398
        }
399
 
400
        return false;
401
    }
402
 
403
    private org.apache.axiom.om.OMElement toOM(
404
        br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeDadosMsg param,
405
        boolean optimizeContent) throws org.apache.axis2.AxisFault {
406
        try {
407
            return param.getOMElement(br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeDadosMsg.MY_QNAME,
408
                org.apache.axiom.om.OMAbstractFactory.getOMFactory());
409
        } catch (org.apache.axis2.databinding.ADBException e) {
410
            throw org.apache.axis2.AxisFault.makeFault(e);
411
        }
412
    }
413
 
414
    private org.apache.axiom.om.OMElement toOM(
415
        br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeResultMsg param,
416
        boolean optimizeContent) throws org.apache.axis2.AxisFault {
417
        try {
418
            return param.getOMElement(br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeResultMsg.MY_QNAME,
419
                org.apache.axiom.om.OMAbstractFactory.getOMFactory());
420
        } catch (org.apache.axis2.databinding.ADBException e) {
421
            throw org.apache.axis2.AxisFault.makeFault(e);
422
        }
423
    }
424
 
425
    private org.apache.axiom.soap.SOAPEnvelope toEnvelope(
426
        org.apache.axiom.soap.SOAPFactory factory,
427
        br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeDadosMsg param,
428
        boolean optimizeContent, javax.xml.namespace.QName elementQName)
429
        throws org.apache.axis2.AxisFault {
430
        try {
431
            org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
432
            emptyEnvelope.getBody()
433
                         .addChild(param.getOMElement(
434
                    br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeDadosMsg.MY_QNAME,
435
                    factory));
436
 
437
            return emptyEnvelope;
438
        } catch (org.apache.axis2.databinding.ADBException e) {
439
            throw org.apache.axis2.AxisFault.makeFault(e);
440
        }
441
    }
442
 
443
    /* methods to provide back word compatibility */
444
 
445
    /**
446
     *  get the default envelope
447
     */
448
    private org.apache.axiom.soap.SOAPEnvelope toEnvelope(
449
        org.apache.axiom.soap.SOAPFactory factory) {
450
        return factory.getDefaultEnvelope();
451
    }
452
 
453
    private java.lang.Object fromOM(org.apache.axiom.om.OMElement param,
454
        java.lang.Class type) throws org.apache.axis2.AxisFault {
455
        try {
456
            if (br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeDadosMsg.class.equals(
457
                        type)) {
458
                return br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeDadosMsg.Factory.parse(param.getXMLStreamReaderWithoutCaching());
459
            }
460
 
461
            if (br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeResultMsg.class.equals(
462
                        type)) {
463
                return br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.ce.NFeInutilizacao4Stub.NfeResultMsg.Factory.parse(param.getXMLStreamReaderWithoutCaching());
464
            }
465
        } catch (java.lang.Exception e) {
466
            throw org.apache.axis2.AxisFault.makeFault(e);
467
        }
468
 
469
        return null;
470
    }
471
 
472
    //http://nfce.sefaz.ce.gov.br:80/nfce4/services/NFeInutilizacao4
473
    public static class ExtensionMapper {
474
        public static java.lang.Object getTypeObject(
475
            java.lang.String namespaceURI, java.lang.String typeName,
476
            javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception {
477
            throw new org.apache.axis2.databinding.ADBException(
478
                "Unsupported type " + namespaceURI + " " + typeName);
479
        }
480
    }
481
 
482
    public static class NfeDadosMsg implements org.apache.axis2.databinding.ADBBean {
483
        public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/nfe/wsdl/NFeInutilizacao4",
484
                "nfeDadosMsg", "ns1");
485
 
486
        /**
487
         * field for ExtraElement
488
         */
489
        protected org.apache.axiom.om.OMElement localExtraElement;
490
 
491
        /**
492
         * Auto generated getter method
493
         * @return org.apache.axiom.om.OMElement
494
         */
495
        public org.apache.axiom.om.OMElement getExtraElement() {
496
            return localExtraElement;
497
        }
498
 
499
        /**
500
         * Auto generated setter method
501
         * @param param ExtraElement
502
         */
503
        public void setExtraElement(org.apache.axiom.om.OMElement param) {
504
            this.localExtraElement = param;
505
        }
506
 
507
        /**
508
         *
509
         * @param parentQName
510
         * @param factory
511
         * @return org.apache.axiom.om.OMElement
512
         */
513
        public org.apache.axiom.om.OMElement getOMElement(
514
            final javax.xml.namespace.QName parentQName,
515
            final org.apache.axiom.om.OMFactory factory)
516
            throws org.apache.axis2.databinding.ADBException {
517
            return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource(
518
                    this, MY_QNAME));
519
        }
520
 
521
        public void serialize(final javax.xml.namespace.QName parentQName,
522
            javax.xml.stream.XMLStreamWriter xmlWriter)
523
            throws javax.xml.stream.XMLStreamException,
524
                org.apache.axis2.databinding.ADBException {
525
            serialize(parentQName, xmlWriter, false);
526
        }
527
 
528
        public void serialize(final javax.xml.namespace.QName parentQName,
529
            javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType)
530
            throws javax.xml.stream.XMLStreamException,
531
                org.apache.axis2.databinding.ADBException {
532
            java.lang.String prefix = null;
533
            java.lang.String namespace = null;
534
 
535
            prefix = parentQName.getPrefix();
536
            namespace = parentQName.getNamespaceURI();
537
            writeStartElement(prefix, namespace, parentQName.getLocalPart(),
538
                xmlWriter);
539
 
540
            if (serializeType) {
541
                java.lang.String namespacePrefix = registerPrefix(xmlWriter,
542
                        "http://www.portalfiscal.inf.br/nfe/wsdl/NFeInutilizacao4");
543
 
544
                if ((namespacePrefix != null) &&
545
                        (namespacePrefix.trim().length() > 0)) {
546
                    writeAttribute("xsi",
547
                        "http://www.w3.org/2001/XMLSchema-instance", "type",
548
                        namespacePrefix + ":nfeDadosMsg", xmlWriter);
549
                } else {
550
                    writeAttribute("xsi",
551
                        "http://www.w3.org/2001/XMLSchema-instance", "type",
552
                        "nfeDadosMsg", xmlWriter);
553
                }
554
            }
555
 
556
            if (localExtraElement != null) {
557
                localExtraElement.serialize(xmlWriter);
558
            } else {
559
                throw new org.apache.axis2.databinding.ADBException(
560
                    "extraElement cannot be null!!");
561
            }
562
 
563
            xmlWriter.writeEndElement();
564
        }
565
 
566
        private static java.lang.String generatePrefix(
567
            java.lang.String namespace) {
568
            if (namespace.equals(
569
                        "http://www.portalfiscal.inf.br/nfe/wsdl/NFeInutilizacao4")) {
570
                return "ns1";
571
            }
572
 
573
            return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
574
        }
575
 
576
        /**
577
         * Utility method to write an element start tag.
578
         */
579
        private void writeStartElement(java.lang.String prefix,
580
            java.lang.String namespace, java.lang.String localPart,
581
            javax.xml.stream.XMLStreamWriter xmlWriter)
582
            throws javax.xml.stream.XMLStreamException {
583
            java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
584
 
585
            if (writerPrefix != null) {
586
                xmlWriter.writeStartElement(writerPrefix, localPart, namespace);
587
            } else {
588
                if (namespace.length() == 0) {
589
                    prefix = "";
590
                } else if (prefix == null) {
591
                    prefix = generatePrefix(namespace);
592
                }
593
 
594
                xmlWriter.writeStartElement(prefix, localPart, namespace);
595
                xmlWriter.writeNamespace(prefix, namespace);
596
                xmlWriter.setPrefix(prefix, namespace);
597
            }
598
        }
599
 
600
        /**
601
         * Util method to write an attribute with the ns prefix
602
         */
603
        private void writeAttribute(java.lang.String prefix,
604
            java.lang.String namespace, java.lang.String attName,
605
            java.lang.String attValue,
606
            javax.xml.stream.XMLStreamWriter xmlWriter)
607
            throws javax.xml.stream.XMLStreamException {
608
            java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
609
 
610
            if (writerPrefix != null) {
611
                xmlWriter.writeAttribute(writerPrefix, namespace, attName,
612
                    attValue);
613
            } else {
614
                xmlWriter.writeNamespace(prefix, namespace);
615
                xmlWriter.setPrefix(prefix, namespace);
616
                xmlWriter.writeAttribute(prefix, namespace, attName, attValue);
617
            }
618
        }
619
 
620
        /**
621
         * Util method to write an attribute without the ns prefix
622
         */
623
        private void writeAttribute(java.lang.String namespace,
624
            java.lang.String attName, java.lang.String attValue,
625
            javax.xml.stream.XMLStreamWriter xmlWriter)
626
            throws javax.xml.stream.XMLStreamException {
627
            if (namespace.equals("")) {
628
                xmlWriter.writeAttribute(attName, attValue);
629
            } else {
630
                xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace),
631
                    namespace, attName, attValue);
632
            }
633
        }
634
 
635
        /**
636
         * Util method to write an attribute without the ns prefix
637
         */
638
        private void writeQNameAttribute(java.lang.String namespace,
639
            java.lang.String attName, javax.xml.namespace.QName qname,
640
            javax.xml.stream.XMLStreamWriter xmlWriter)
641
            throws javax.xml.stream.XMLStreamException {
642
            java.lang.String attributeNamespace = qname.getNamespaceURI();
643
            java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
644
 
645
            if (attributePrefix == null) {
646
                attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
647
            }
648
 
649
            java.lang.String attributeValue;
650
 
651
            if (attributePrefix.trim().length() > 0) {
652
                attributeValue = attributePrefix + ":" + qname.getLocalPart();
653
            } else {
654
                attributeValue = qname.getLocalPart();
655
            }
656
 
657
            if (namespace.equals("")) {
658
                xmlWriter.writeAttribute(attName, attributeValue);
659
            } else {
660
                registerPrefix(xmlWriter, namespace);
661
                xmlWriter.writeAttribute(attributePrefix, namespace, attName,
662
                    attributeValue);
663
            }
664
        }
665
 
666
        /**
667
         *  method to handle Qnames
668
         */
669
        private void writeQName(javax.xml.namespace.QName qname,
670
            javax.xml.stream.XMLStreamWriter xmlWriter)
671
            throws javax.xml.stream.XMLStreamException {
672
            java.lang.String namespaceURI = qname.getNamespaceURI();
673
 
674
            if (namespaceURI != null) {
675
                java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
676
 
677
                if (prefix == null) {
678
                    prefix = generatePrefix(namespaceURI);
679
                    xmlWriter.writeNamespace(prefix, namespaceURI);
680
                    xmlWriter.setPrefix(prefix, namespaceURI);
681
                }
682
 
683
                if (prefix.trim().length() > 0) {
684
                    xmlWriter.writeCharacters(prefix + ":" +
685
                        org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
686
                            qname));
687
                } else {
688
                    // i.e this is the default namespace
689
                    xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
690
                            qname));
691
                }
692
            } else {
693
                xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
694
                        qname));
695
            }
696
        }
697
 
698
        private void writeQNames(javax.xml.namespace.QName[] qnames,
699
            javax.xml.stream.XMLStreamWriter xmlWriter)
700
            throws javax.xml.stream.XMLStreamException {
701
            if (qnames != null) {
702
                // we have to store this data until last moment since it is not possible to write any
703
                // namespace data after writing the charactor data
704
                java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer();
705
                java.lang.String namespaceURI = null;
706
                java.lang.String prefix = null;
707
 
708
                for (int i = 0; i < qnames.length; i++) {
709
                    if (i > 0) {
710
                        stringToWrite.append(" ");
711
                    }
712
 
713
                    namespaceURI = qnames[i].getNamespaceURI();
714
 
715
                    if (namespaceURI != null) {
716
                        prefix = xmlWriter.getPrefix(namespaceURI);
717
 
718
                        if ((prefix == null) || (prefix.length() == 0)) {
719
                            prefix = generatePrefix(namespaceURI);
720
                            xmlWriter.writeNamespace(prefix, namespaceURI);
721
                            xmlWriter.setPrefix(prefix, namespaceURI);
722
                        }
723
 
724
                        if (prefix.trim().length() > 0) {
725
                            stringToWrite.append(prefix).append(":")
726
                                         .append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
727
                                    qnames[i]));
728
                        } else {
729
                            stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
730
                                    qnames[i]));
731
                        }
732
                    } else {
733
                        stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
734
                                qnames[i]));
735
                    }
736
                }
737
 
738
                xmlWriter.writeCharacters(stringToWrite.toString());
739
            }
740
        }
741
 
742
        /**
743
         * Register a namespace prefix
744
         */
745
        private java.lang.String registerPrefix(
746
            javax.xml.stream.XMLStreamWriter xmlWriter,
747
            java.lang.String namespace)
748
            throws javax.xml.stream.XMLStreamException {
749
            java.lang.String prefix = xmlWriter.getPrefix(namespace);
750
 
751
            if (prefix == null) {
752
                prefix = generatePrefix(namespace);
753
 
754
                javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
755
 
756
                while (true) {
757
                    java.lang.String uri = nsContext.getNamespaceURI(prefix);
758
 
759
                    if ((uri == null) || (uri.length() == 0)) {
760
                        break;
761
                    }
762
 
763
                    prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
764
                }
765
 
766
                xmlWriter.writeNamespace(prefix, namespace);
767
                xmlWriter.setPrefix(prefix, namespace);
768
            }
769
 
770
            return prefix;
771
        }
772
 
773
        /**
774
         *  Factory class that keeps the parse method
775
         */
776
        public static class Factory {
777
            private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class);
778
 
779
            /**
780
             * static method to create the object
781
             * Precondition:  If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
782
             *                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
783
             * Postcondition: If this object is an element, the reader is positioned at its end element
784
             *                If this object is a complex type, the reader is positioned at the end element of its outer element
785
             */
786
            public static NfeDadosMsg parse(
787
                javax.xml.stream.XMLStreamReader reader)
788
                throws java.lang.Exception {
789
                NfeDadosMsg object = new NfeDadosMsg();
790
 
791
                int event;
792
                javax.xml.namespace.QName currentQName = null;
793
                java.lang.String nillableValue = null;
794
                java.lang.String prefix = "";
795
                java.lang.String namespaceuri = "";
796
 
797
                try {
798
                    while (!reader.isStartElement() && !reader.isEndElement())
799
                        reader.next();
800
 
801
                    currentQName = reader.getName();
802
 
803
                    if (reader.getAttributeValue(
804
                                "http://www.w3.org/2001/XMLSchema-instance",
805
                                "type") != null) {
806
                        java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
807
                                "type");
808
 
809
                        if (fullTypeName != null) {
810
                            java.lang.String nsPrefix = null;
811
 
812
                            if (fullTypeName.indexOf(":") > -1) {
813
                                nsPrefix = fullTypeName.substring(0,
814
                                        fullTypeName.indexOf(":"));
815
                            }
816
 
817
                            nsPrefix = (nsPrefix == null) ? "" : nsPrefix;
818
 
819
                            java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(
820
                                        ":") + 1);
821
 
822
                            if (!"nfeDadosMsg".equals(type)) {
823
                                //find namespace for the prefix
824
                                java.lang.String nsUri = reader.getNamespaceContext()
825
                                                               .getNamespaceURI(nsPrefix);
826
 
827
                                return (NfeDadosMsg) ExtensionMapper.getTypeObject(nsUri,
828
                                    type, reader);
829
                            }
830
                        }
831
                    }
832
 
833
                    // Note all attributes that were handled. Used to differ normal attributes
834
                    // from anyAttributes.
835
                    java.util.Vector handledAttributes = new java.util.Vector();
836
 
837
                    reader.next();
838
 
839
                    while (!reader.isStartElement() && !reader.isEndElement())
840
                        reader.next();
841
 
842
                    if (reader.isStartElement()) {
843
                        //use the QName from the parser as the name for the builder
844
                        javax.xml.namespace.QName startQname1 = reader.getName();
845
 
846
                        // We need to wrap the reader so that it produces a fake START_DOCUMENT event
847
                        // this is needed by the builder classes
848
                        org.apache.axis2.databinding.utils.NamedStaxOMBuilder builder1 =
849
                            new org.apache.axis2.databinding.utils.NamedStaxOMBuilder(new org.apache.axis2.util.StreamWrapper(
850
                                    reader), startQname1);
851
                        object.setExtraElement(builder1.getOMElement());
852
 
853
                        reader.next();
854
                    } // End of if for expected property start element
855
 
856
                    else {
857
                        // 1 - A start element we are not expecting indicates an invalid parameter was passed
858
                        throw new org.apache.axis2.databinding.ADBException(
859
                            "Unexpected subelement " + reader.getName());
860
                    }
861
 
862
                    while (!reader.isStartElement() && !reader.isEndElement())
863
                        reader.next();
864
 
865
                    if (reader.isStartElement()) {
866
                        // 2 - A start element we are not expecting indicates a trailing invalid property
867
                        throw new org.apache.axis2.databinding.ADBException(
868
                            "Unexpected subelement " + reader.getName());
869
                    }
870
                } catch (javax.xml.stream.XMLStreamException e) {
871
                    throw new java.lang.Exception(e);
872
                }
873
 
874
                return object;
875
            }
876
        } //end of factory class
877
    }
878
 
879
    public static class NfeResultMsg implements org.apache.axis2.databinding.ADBBean {
880
        public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/nfe/wsdl/NFeInutilizacao4",
881
                "nfeResultMsg", "ns1");
882
 
883
        /**
884
         * field for ExtraElement
885
         */
886
        protected org.apache.axiom.om.OMElement localExtraElement;
887
 
888
        /**
889
         * Auto generated getter method
890
         * @return org.apache.axiom.om.OMElement
891
         */
892
        public org.apache.axiom.om.OMElement getExtraElement() {
893
            return localExtraElement;
894
        }
895
 
896
        /**
897
         * Auto generated setter method
898
         * @param param ExtraElement
899
         */
900
        public void setExtraElement(org.apache.axiom.om.OMElement param) {
901
            this.localExtraElement = param;
902
        }
903
 
904
        /**
905
         *
906
         * @param parentQName
907
         * @param factory
908
         * @return org.apache.axiom.om.OMElement
909
         */
910
        public org.apache.axiom.om.OMElement getOMElement(
911
            final javax.xml.namespace.QName parentQName,
912
            final org.apache.axiom.om.OMFactory factory)
913
            throws org.apache.axis2.databinding.ADBException {
914
            return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource(
915
                    this, MY_QNAME));
916
        }
917
 
918
        public void serialize(final javax.xml.namespace.QName parentQName,
919
            javax.xml.stream.XMLStreamWriter xmlWriter)
920
            throws javax.xml.stream.XMLStreamException,
921
                org.apache.axis2.databinding.ADBException {
922
            serialize(parentQName, xmlWriter, false);
923
        }
924
 
925
        public void serialize(final javax.xml.namespace.QName parentQName,
926
            javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType)
927
            throws javax.xml.stream.XMLStreamException,
928
                org.apache.axis2.databinding.ADBException {
929
            java.lang.String prefix = null;
930
            java.lang.String namespace = null;
931
 
932
            prefix = parentQName.getPrefix();
933
            namespace = parentQName.getNamespaceURI();
934
            writeStartElement(prefix, namespace, parentQName.getLocalPart(),
935
                xmlWriter);
936
 
937
            if (serializeType) {
938
                java.lang.String namespacePrefix = registerPrefix(xmlWriter,
939
                        "http://www.portalfiscal.inf.br/nfe/wsdl/NFeInutilizacao4");
940
 
941
                if ((namespacePrefix != null) &&
942
                        (namespacePrefix.trim().length() > 0)) {
943
                    writeAttribute("xsi",
944
                        "http://www.w3.org/2001/XMLSchema-instance", "type",
945
                        namespacePrefix + ":nfeResultMsg", xmlWriter);
946
                } else {
947
                    writeAttribute("xsi",
948
                        "http://www.w3.org/2001/XMLSchema-instance", "type",
949
                        "nfeResultMsg", xmlWriter);
950
                }
951
            }
952
 
953
            if (localExtraElement != null) {
954
                localExtraElement.serialize(xmlWriter);
955
            } else {
956
                throw new org.apache.axis2.databinding.ADBException(
957
                    "extraElement cannot be null!!");
958
            }
959
 
960
            xmlWriter.writeEndElement();
961
        }
962
 
963
        private static java.lang.String generatePrefix(
964
            java.lang.String namespace) {
965
            if (namespace.equals(
966
                        "http://www.portalfiscal.inf.br/nfe/wsdl/NFeInutilizacao4")) {
967
                return "ns1";
968
            }
969
 
970
            return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
971
        }
972
 
973
        /**
974
         * Utility method to write an element start tag.
975
         */
976
        private void writeStartElement(java.lang.String prefix,
977
            java.lang.String namespace, java.lang.String localPart,
978
            javax.xml.stream.XMLStreamWriter xmlWriter)
979
            throws javax.xml.stream.XMLStreamException {
980
            java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
981
 
982
            if (writerPrefix != null) {
983
                xmlWriter.writeStartElement(writerPrefix, localPart, namespace);
984
            } else {
985
                if (namespace.length() == 0) {
986
                    prefix = "";
987
                } else if (prefix == null) {
988
                    prefix = generatePrefix(namespace);
989
                }
990
 
991
                xmlWriter.writeStartElement(prefix, localPart, namespace);
992
                xmlWriter.writeNamespace(prefix, namespace);
993
                xmlWriter.setPrefix(prefix, namespace);
994
            }
995
        }
996
 
997
        /**
998
         * Util method to write an attribute with the ns prefix
999
         */
1000
        private void writeAttribute(java.lang.String prefix,
1001
            java.lang.String namespace, java.lang.String attName,
1002
            java.lang.String attValue,
1003
            javax.xml.stream.XMLStreamWriter xmlWriter)
1004
            throws javax.xml.stream.XMLStreamException {
1005
            java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
1006
 
1007
            if (writerPrefix != null) {
1008
                xmlWriter.writeAttribute(writerPrefix, namespace, attName,
1009
                    attValue);
1010
            } else {
1011
                xmlWriter.writeNamespace(prefix, namespace);
1012
                xmlWriter.setPrefix(prefix, namespace);
1013
                xmlWriter.writeAttribute(prefix, namespace, attName, attValue);
1014
            }
1015
        }
1016
 
1017
        /**
1018
         * Util method to write an attribute without the ns prefix
1019
         */
1020
        private void writeAttribute(java.lang.String namespace,
1021
            java.lang.String attName, java.lang.String attValue,
1022
            javax.xml.stream.XMLStreamWriter xmlWriter)
1023
            throws javax.xml.stream.XMLStreamException {
1024
            if (namespace.equals("")) {
1025
                xmlWriter.writeAttribute(attName, attValue);
1026
            } else {
1027
                xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace),
1028
                    namespace, attName, attValue);
1029
            }
1030
        }
1031
 
1032
        /**
1033
         * Util method to write an attribute without the ns prefix
1034
         */
1035
        private void writeQNameAttribute(java.lang.String namespace,
1036
            java.lang.String attName, javax.xml.namespace.QName qname,
1037
            javax.xml.stream.XMLStreamWriter xmlWriter)
1038
            throws javax.xml.stream.XMLStreamException {
1039
            java.lang.String attributeNamespace = qname.getNamespaceURI();
1040
            java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
1041
 
1042
            if (attributePrefix == null) {
1043
                attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
1044
            }
1045
 
1046
            java.lang.String attributeValue;
1047
 
1048
            if (attributePrefix.trim().length() > 0) {
1049
                attributeValue = attributePrefix + ":" + qname.getLocalPart();
1050
            } else {
1051
                attributeValue = qname.getLocalPart();
1052
            }
1053
 
1054
            if (namespace.equals("")) {
1055
                xmlWriter.writeAttribute(attName, attributeValue);
1056
            } else {
1057
                registerPrefix(xmlWriter, namespace);
1058
                xmlWriter.writeAttribute(attributePrefix, namespace, attName,
1059
                    attributeValue);
1060
            }
1061
        }
1062
 
1063
        /**
1064
         *  method to handle Qnames
1065
         */
1066
        private void writeQName(javax.xml.namespace.QName qname,
1067
            javax.xml.stream.XMLStreamWriter xmlWriter)
1068
            throws javax.xml.stream.XMLStreamException {
1069
            java.lang.String namespaceURI = qname.getNamespaceURI();
1070
 
1071
            if (namespaceURI != null) {
1072
                java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
1073
 
1074
                if (prefix == null) {
1075
                    prefix = generatePrefix(namespaceURI);
1076
                    xmlWriter.writeNamespace(prefix, namespaceURI);
1077
                    xmlWriter.setPrefix(prefix, namespaceURI);
1078
                }
1079
 
1080
                if (prefix.trim().length() > 0) {
1081
                    xmlWriter.writeCharacters(prefix + ":" +
1082
                        org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
1083
                            qname));
1084
                } else {
1085
                    // i.e this is the default namespace
1086
                    xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
1087
                            qname));
1088
                }
1089
            } else {
1090
                xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
1091
                        qname));
1092
            }
1093
        }
1094
 
1095
        private void writeQNames(javax.xml.namespace.QName[] qnames,
1096
            javax.xml.stream.XMLStreamWriter xmlWriter)
1097
            throws javax.xml.stream.XMLStreamException {
1098
            if (qnames != null) {
1099
                // we have to store this data until last moment since it is not possible to write any
1100
                // namespace data after writing the charactor data
1101
                java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer();
1102
                java.lang.String namespaceURI = null;
1103
                java.lang.String prefix = null;
1104
 
1105
                for (int i = 0; i < qnames.length; i++) {
1106
                    if (i > 0) {
1107
                        stringToWrite.append(" ");
1108
                    }
1109
 
1110
                    namespaceURI = qnames[i].getNamespaceURI();
1111
 
1112
                    if (namespaceURI != null) {
1113
                        prefix = xmlWriter.getPrefix(namespaceURI);
1114
 
1115
                        if ((prefix == null) || (prefix.length() == 0)) {
1116
                            prefix = generatePrefix(namespaceURI);
1117
                            xmlWriter.writeNamespace(prefix, namespaceURI);
1118
                            xmlWriter.setPrefix(prefix, namespaceURI);
1119
                        }
1120
 
1121
                        if (prefix.trim().length() > 0) {
1122
                            stringToWrite.append(prefix).append(":")
1123
                                         .append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
1124
                                    qnames[i]));
1125
                        } else {
1126
                            stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
1127
                                    qnames[i]));
1128
                        }
1129
                    } else {
1130
                        stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
1131
                                qnames[i]));
1132
                    }
1133
                }
1134
 
1135
                xmlWriter.writeCharacters(stringToWrite.toString());
1136
            }
1137
        }
1138
 
1139
        /**
1140
         * Register a namespace prefix
1141
         */
1142
        private java.lang.String registerPrefix(
1143
            javax.xml.stream.XMLStreamWriter xmlWriter,
1144
            java.lang.String namespace)
1145
            throws javax.xml.stream.XMLStreamException {
1146
            java.lang.String prefix = xmlWriter.getPrefix(namespace);
1147
 
1148
            if (prefix == null) {
1149
                prefix = generatePrefix(namespace);
1150
 
1151
                javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
1152
 
1153
                while (true) {
1154
                    java.lang.String uri = nsContext.getNamespaceURI(prefix);
1155
 
1156
                    if ((uri == null) || (uri.length() == 0)) {
1157
                        break;
1158
                    }
1159
 
1160
                    prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
1161
                }
1162
 
1163
                xmlWriter.writeNamespace(prefix, namespace);
1164
                xmlWriter.setPrefix(prefix, namespace);
1165
            }
1166
 
1167
            return prefix;
1168
        }
1169
 
1170
        /**
1171
         *  Factory class that keeps the parse method
1172
         */
1173
        public static class Factory {
1174
            private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class);
1175
 
1176
            /**
1177
             * static method to create the object
1178
             * Precondition:  If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
1179
             *                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
1180
             * Postcondition: If this object is an element, the reader is positioned at its end element
1181
             *                If this object is a complex type, the reader is positioned at the end element of its outer element
1182
             */
1183
            public static NfeResultMsg parse(
1184
                javax.xml.stream.XMLStreamReader reader)
1185
                throws java.lang.Exception {
1186
                NfeResultMsg object = new NfeResultMsg();
1187
 
1188
                int event;
1189
                javax.xml.namespace.QName currentQName = null;
1190
                java.lang.String nillableValue = null;
1191
                java.lang.String prefix = "";
1192
                java.lang.String namespaceuri = "";
1193
 
1194
                try {
1195
                    while (!reader.isStartElement() && !reader.isEndElement())
1196
                        reader.next();
1197
 
1198
                    currentQName = reader.getName();
1199
 
1200
                    if (reader.getAttributeValue(
1201
                                "http://www.w3.org/2001/XMLSchema-instance",
1202
                                "type") != null) {
1203
                        java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
1204
                                "type");
1205
 
1206
                        if (fullTypeName != null) {
1207
                            java.lang.String nsPrefix = null;
1208
 
1209
                            if (fullTypeName.indexOf(":") > -1) {
1210
                                nsPrefix = fullTypeName.substring(0,
1211
                                        fullTypeName.indexOf(":"));
1212
                            }
1213
 
1214
                            nsPrefix = (nsPrefix == null) ? "" : nsPrefix;
1215
 
1216
                            java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(
1217
                                        ":") + 1);
1218
 
1219
                            if (!"nfeResultMsg".equals(type)) {
1220
                                //find namespace for the prefix
1221
                                java.lang.String nsUri = reader.getNamespaceContext()
1222
                                                               .getNamespaceURI(nsPrefix);
1223
 
1224
                                return (NfeResultMsg) ExtensionMapper.getTypeObject(nsUri,
1225
                                    type, reader);
1226
                            }
1227
                        }
1228
                    }
1229
 
1230
                    // Note all attributes that were handled. Used to differ normal attributes
1231
                    // from anyAttributes.
1232
                    java.util.Vector handledAttributes = new java.util.Vector();
1233
 
1234
                    reader.next();
1235
 
1236
                    while (!reader.isStartElement() && !reader.isEndElement())
1237
                        reader.next();
1238
 
1239
                    if (reader.isStartElement()) {
1240
                        //use the QName from the parser as the name for the builder
1241
                        javax.xml.namespace.QName startQname1 = reader.getName();
1242
 
1243
                        // We need to wrap the reader so that it produces a fake START_DOCUMENT event
1244
                        // this is needed by the builder classes
1245
                        org.apache.axis2.databinding.utils.NamedStaxOMBuilder builder1 =
1246
                            new org.apache.axis2.databinding.utils.NamedStaxOMBuilder(new org.apache.axis2.util.StreamWrapper(
1247
                                    reader), startQname1);
1248
                        object.setExtraElement(builder1.getOMElement());
1249
 
1250
                        reader.next();
1251
                    } // End of if for expected property start element
1252
 
1253
                    else {
1254
                        // 1 - A start element we are not expecting indicates an invalid parameter was passed
1255
                        throw new org.apache.axis2.databinding.ADBException(
1256
                            "Unexpected subelement " + reader.getName());
1257
                    }
1258
 
1259
                    while (!reader.isStartElement() && !reader.isEndElement())
1260
                        reader.next();
1261
 
1262
                    if (reader.isStartElement()) {
1263
                        // 2 - A start element we are not expecting indicates a trailing invalid property
1264
                        throw new org.apache.axis2.databinding.ADBException(
1265
                            "Unexpected subelement " + reader.getName());
1266
                    }
1267
                } catch (javax.xml.stream.XMLStreamException e) {
1268
                    throw new java.lang.Exception(e);
1269
                }
1270
 
1271
                return object;
1272
            }
1273
        } //end of factory class
1274
    }
1275
}