Subversion Repositories Integrator Subversion

Rev

Details | Last modification | View Log | RSS feed

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