Questo metodo deve essere utilizzato dall’OE per effettuare l’invio di una fattura già nel formato XML secondo norme AGID, ma non ancora firmata digitalmente.
curl -X POST https://demows.fatturazioneelettronica.aruba.it/services/invoice/upload \
-H 'Accept: application/json' \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'Authorization: Bearer NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE=' \
-d '{
"dataFile" : "dGVzdA==",
"credential" : "",
"domain" : ""
}'
// Important: Don't forget to include the call to System.loadLibrary
// as shown at the bottom of this code sample.
package com.test;
import android.app.Activity;
import com.chilkatsoft.*;
import android.widget.TextView;
import android.os.Bundle;
public class SimpleActivity extends Activity {
private static final String TAG = "Chilkat";
// Called when the activity is first created.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CkRest rest = new CkRest();
boolean success;
// URL: https://demows.fatturazioneelettronica.aruba.it/services/invoice/upload
boolean bTls = true;
int port = 443;
boolean bAutoReconnect = true;
success = rest.Connect("demows.fatturazioneelettronica.aruba.it",port,bTls,bAutoReconnect);
if (success != true) {
Log.i(TAG, "ConnectFailReason: " + String.valueOf(rest.get_ConnectFailReason()));
Log.i(TAG, rest.lastErrorText());
return;
}
// See the Online Tool for Generating JSON Creation Code
CkJsonObject json = new CkJsonObject();
json.UpdateString("dataFile","dGVzdA==");
json.UpdateString("credential","");
json.UpdateString("domain","");
rest.AddHeader("Content-Type","application/json;charset=UTF-8");
rest.AddHeader("Authorization","Bearer NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE=");
rest.AddHeader("Accept","application/json");
CkStringBuilder sbRequestBody = new CkStringBuilder();
json.EmitSb(sbRequestBody);
CkStringBuilder sbResponseBody = new CkStringBuilder();
success = rest.FullRequestSb("POST","/services/invoice/upload",sbRequestBody,sbResponseBody);
if (success != true) {
Log.i(TAG, rest.lastErrorText());
return;
}
int respStatusCode = rest.get_ResponseStatusCode();
if (respStatusCode >= 400) {
Log.i(TAG, "Response Status Code = " + String.valueOf(respStatusCode));
Log.i(TAG, "Response Header:");
Log.i(TAG, rest.responseHeader());
Log.i(TAG, "Response Body:");
Log.i(TAG, sbResponseBody.getAsString());
return;
}
CkJsonObject jsonResponse = new CkJsonObject();
jsonResponse.LoadSb(sbResponseBody);
// See the Online Tool for Generating JSON Parse Code
String errorCode;
String errorDescription;
String uploadFileName;
errorCode = jsonResponse.stringOf("errorCode");
errorDescription = jsonResponse.stringOf("errorDescription");
uploadFileName = jsonResponse.stringOf("uploadFileName");
}
static {
System.loadLibrary("chilkat");
// Note: If the incorrect library name is passed to System.loadLibrary,
// then you will see the following error message at application startup:
//"The application <your-application-name> has stopped unexpectedly. Please try again."
}
}
{
"errorCode": "",
"errorDescription": "",
"uploadFileName": "IT01787589930_bkemy.xml.p7m"
}