> For the complete documentation index, see [llms.txt](https://docs.afipsdk.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.afipsdk.com/recursos/otros-metodos-utiles.md).

# Otros métodos útiles

## Obtener XML de la ultima solicitud realizada

Hay momentos en los cuales obtenemos un error y no sabemos como resolverlo, lo que podemos hacer es enviar un correo a **<sri@arca.gob.ar>** explicando el problema y adjuntarles el XML de solicitud y respuesta que te dio el web service para que te den una respuesta. Con ese método obtenés dicho XML.

Recordá utilizar a este método luego de llamar al web service y no antes porque lo que te devuelve es el XML ultima solicitud.

{% tabs %}
{% tab title="Node" %}

```javascript
const res = await afip.getLastRequestXML();

console.log(res);
```

{% endtab %}

{% tab title="PHP" %}

```php
$res = $afip->GetLastRequestXML();

var_dump($res);
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
res = afip.getLastRequestXML

puts res
```

{% endtab %}

{% tab title="Python" %}

```python
res = afip.getLastRequestXML()

print(res)
```

{% endtab %}

{% tab title=".NET" %}

```csharp
var res = await afip.GetLastRequestXmlAsync();

Console.WriteLine(JsonSerializer.Serialize(res));
```

{% endtab %}

{% tab title="Java" %}

```java
GetLastRequestXmlResponse res = afip.getLastRequestXml();

System.out.println(res);
```

{% endtab %}

{% tab title="API" %}
**Endpoint**

<mark style="color:blue;">`GET`</mark> `https://app.afipsdk.com/api/v1/afip/requests/last-xml`

**Response**

<mark style="color:green;">`STATUS`</mark> `200`

```json
{
    "request": "<?xml version=\"1.0\" encoding...",
    "response": "<soap:Envelope xmlns:soap=..."
}
```

{% endtab %}
{% endtabs %}

## Forzar la solicitud de un nuevo TA

{% hint style="info" %}
Los **TA (token authorization)** **son archivos de ARCA,** manejados automáticamente por la Afip SDK, que contienen la información para poder comunicarse con los web services.
{% endhint %}

El TA dura 12hs y queda cacheado para no solicitarlo todo el tiempo, pero hay momentos en los cuales obtenemos un error y la forma de solucionarlo es descartando el TA actual. Con este método podes forzar a que se renueve.

{% tabs %}
{% tab title="Node" %}
En cualquier web service podes llamar al método `getTokenAuthorization(true);` . El parámetro `true` fuerza la renovación. Por ej:

```javascript
const ta = await afip.ElectronicBilling.getTokenAuthorization(true);

console.log(ta);
```

{% endtab %}

{% tab title="PHP" %}
En cualquier web service podes llamar al método `GetTokenAuthorization(TRUE);` . El parámetro `true` fuerza la renovación. Por ej:

```javascript
$ta = $afip->ElectronicBilling->getTokenAuthorization(TRUE);

var_dump($ta);
```

{% endtab %}

{% tab title="Ruby" %}
En cualquier web service podes llamar al método `getTokenAuthorization(true)` . El parámetro `true` fuerza la renovación. Por ej:

```ruby
ta = afip.ElectronicBilling.getTokenAuthorization(true)

puts ta
```

{% endtab %}

{% tab title="Python" %}
En cualquier web service podes llamar al método `getTokenAuthorization(True)` . El parámetro `true` fuerza la renovación. Por ej:

```python
ta = afip.ElectronicBilling.getTokenAuthorization(True)

print(ta)
```

{% endtab %}

{% tab title=".NET" %}
En cualquier web service podes llamar al método `GetTokenAuthorizationAsync(true)` . El parámetro `true` fuerza la renovación. Por ej:

```csharp
var ta = await afip.ElectronicBilling.GetTokenAuthorizationAsync(true);

Console.WriteLine(JsonSerializer.Serialize(ta));
```

{% endtab %}

{% tab title="Java" %}
En cualquier web service podes llamar al método `getTokenAuthorization(true)`. El parámetro `true` fuerza la renovación. Por ej:

```java
GetServiceTAResponse ta = afip.electronicBilling().getTokenAuthorization(true);

System.out.println(ta);
```

{% endtab %}

{% tab title="API" %}
Al pedir la autorización debemos poner el parámetro `force_create: true`

**Endpoint**

<mark style="color:blue;">`POST`</mark> `https://app.afipsdk.com/api/v1/afip/auth`

**Ejemplo**

```json
{
    "environment": "dev",
    "tax_id": "20409378472",
    "wsid": "wsfe",
    "force_create": true
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.afipsdk.com/recursos/otros-metodos-utiles.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
