Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过高级rest客户端在openbravo中发布json_Json_Openbravo - Fatal编程技术网

通过高级rest客户端在openbravo中发布json

通过高级rest客户端在openbravo中发布json,json,openbravo,Json,Openbravo,我试图通过高级rest客户端在openbravo中插入新记录,但我遇到了以下错误:更新业务伙伴时异常(空) 对于POST,我使用以下URL: http://173.230.148.65/openbravo/org.openbravo.service.json.jsonrest/BusinessPartner 我的键/值数据如下所示: { data : { _identifier: "carsss", _entityName: "BusinessPartner", $ref: "Busin

我试图通过高级rest客户端在
openbravo
中插入新记录,但我遇到了以下错误:
更新业务伙伴时异常(空)

对于
POST
,我使用以下URL:

  http://173.230.148.65/openbravo/org.openbravo.service.json.jsonrest/BusinessPartner
我的键/值数据如下所示:

{
data : 
{
_identifier: "carsss",
_entityName: "BusinessPartner",
$ref: "BusinessPartner/6C8417D0C2FA4B8B858CBF51C742F65B",
id: "6C8417D0C2FA4B8B858CBF51C742F65B",
client: "D5B4A1DF0C194F65930BB8945A8B3082",
client$_identifier: "DemoClient",
organization: "DC280AA41A5E479AB663B1D4DB6158C0",
organization$_identifier: "Purchase",
active: true,
creationDate: "2013-12-06T07:24:04+00:00",
createdBy: "E1A6A414BED14417B7235CBFDF00977C",
createdBy$_identifier: "DemoClient",
updated: "2013-12-19T04:32:17+00:00",
updatedBy: "E1A6A414BED14417B7235CBFDF00977C",
updatedBy$_identifier: "DemoClient",
searchKey: "customer",
name: "carsss",
name2: "carsss",
description: "This is cars",
summaryLevel: false,
businessPartnerCategory: "0109E0660DD349D6B00D96BF0CEAE6E2",
businessPartnerCategory$_identifier: "Customer",
oneTimeTransaction: false,
potentialCustomer: false,
vendor: false,
customer: true,
employee: false,
isSalesRepresentative: false,
referenceNo: null,
dUNS: null,
uRL: null,
language: "en_US",
language$_identifier: "English (USA)",
taxID: null,
taxExempt: false,
invoiceSchedule: null,
valuation: null,
volumeOfSales: null,
noOfEmployees: null,
nAICSSIC: null,
dateOfFirstSale: null,
acquisitionCost: 0,
expectedLifetimeRevenue: 0,
lifetimeRevenueToDate: 0,
share: null,
formOfPayment: null,
creditLimit: 1000,
creditUsed: 0,
paymentTerms: "A182B5EC1898407FA386ED4775ED6DDA",
paymentTerms$_identifier: "Immediate",
priceList: "DA10C6659DBE408B9789A01AF3CA7015",
priceList$_identifier: "Sales Price List",
printDiscount: false,
orderDescription: null,
orderReference: null,
pOFormOfPayment: null,
purchasePricelist: null,
pOPaymentTerms: null,
numberOfCopies: null,
greeting: null,
invoiceTerms: "I",
deliveryTerms: null,
deliveryMethod: null,
salesRepresentative: null,
partnerParent: null,
creditStatus: "O",
forcedOrg: null,
pricesShownInOrder: true,
invoiceGrouping: "000000000000000",
maturityDate1: null,
maturityDate2: null,
maturityDate3: null,
operator: false,
uPCEAN: null,
salaryCategory: null,
invoicePrintformat: null,
consumptionDays: 1000,
bankAccount: null,
taxCategory: null,
pOMaturityDate1: null,
pOMaturityDate2: null,
pOMaturityDate3: null,
transactionalBankAccount: null,
sOBPTaxCategory: null,
fiscalcode: null,
isofiscalcode: null,
incotermsPO: null,
incotermsSO: null,
paymentMethod: "8A18E79688DD4A179F2FDC14FBECED55",
paymentMethod$_identifier: "Check",
pOPaymentMethod: null,
account: "91E5EB8BECBF49BAA3391942D6328640",
account$_identifier: "BOA",
pOFinancialAccount: null,
customerBlocking: true,
vendorBlocking: false,
paymentIn: false,
paymentOut: true,
salesInvoice: true,
purchaseInvoice: true,
salesOrder: true,
purchaseOrder: true,
goodsShipment: true,
goodsReceipt: false,
recordTime: 1393321917803
}
}

有人能帮我解决这个问题吗?

首先确保输入的Json是正确的。您可以使用任何在线Json格式化程序来验证输入Json

这是一个可以用来验证您输入的json字符串。我尝试了你在这里发布的JSON,它有很多语法错误

高级Rest客户端:

  • 设置内容类型:application/json
  • 方法:post
附加可能帮助您解决此错误的文件。

附加来自rest客户端的响应。


另外,连接有效负载时,我也遇到了类似的问题,我尝试使用restsharp从xamarin执行相同的操作。这是我代码中的一个狙击手

    public void PostDataProyInf()
    {
        string urlBase = servInf + "/org.openbravo.service.json.jsonrest/cpm_daily_serv_rep";
        IRestClient clients = new RestClient(urlBase);
        clients.Authenticator = new HttpBasicAuthenticator(USname, USpass);
        IRestRequest request = new RestRequest(Method.POST);

        request.RequestFormat = DataFormat.Json;
        request.AddHeader("Content-Type", "application/json");
        //request.AddHeader("Accept", "*/*");
        DateTime date = new DateTime();
        date = DateTime.Now;
        date.ToString("yyyy-MM-ddThh:mm:ss-hh:mm");
        string workingT = Horas().ToString() + " " + "hour(s)" + "  " + Minutes().ToString() + " min(s)";

        var daily = " {    \"data\":       {        \"_identifier\":\"" + proytS.Text + "\",        \"_entityName\":\"cpm_daily_serv_rep\",  \"$ref\":\"cpm_daily_serv_rep\",    \"id\":\" \",    \"client\":\"A9D216F4A8894012A48E168268A3D6C9\",  \"client$_identifier\":\"Geosoft\",     \"organization\":\"F14745C58DC74BA38A0F0C85A3C12E74\",      \"organization$_identifier\":\"Geosoft Escencial\",     \"active\":true,        \"creationDate\":\"" + date.ToString() + "\",       \"createdBy\":\"" + IdUser + "\",       \"createdBy$_identifier\":\"" + USname + "\",       \"updated\":\"" + date.ToString() + "\",        \"updatedBy\":\"" + IdUser + "\",       \"updatedBy$_identifier\":\"" + USname + "\",       \"equipInstCctv\":" + eqCCTV.Checked + ",       \"equipInstContAcc\":" + eqContAcc.Checked + ",     \"equipInstDetSuspInc\":" + eqIncend.Checked + ",       \"equipInstTelec\":" + eqTelec.Checked + ",     \"equipInstElecGnral\":" + eqEleG.Checked + ",      \"equipInstMatGnral\":" + eqMatGen.Checked + ",     \"equipInstGnral\":" + eqGeneral.Checked + ",       \"soporteria\":" + soport.Checked + ",      \"canalizacion\":" + canal.Checked + ",     \"cableado\":" + cableado.Checked + ",      \"pruebas\":" + prueba.Checked + ",     \"etiquetado\":" + etiquet.Checked + ",     \"equipo\":" + equipo.Checked + ",      \"project\":\"" + IdTempProy + "\",     \"project$_identifier\":\"" + proytS.Text + "\",        \"actvGeofDesc\":\"" + actEmpInfo.Text + "\",       \"actvClientDesc\":\"" + actEmpInfo.Text + "\",     \"retrabajos\":\"" + retrabS.Text + "\",        \"otros\":null,     \"notasMatFalt\":\"" + matFalInfo.Text + "\",       \"tiempo\":0,       \"cantInstSop\":null,       \"cantInstCab\":null,       \"cantInstPruebas\":null,       \"cantInstEtiq\":null,      \"cantInstEquipo\":null,        \"cantInstCan\":null,       \"workArea\":\"" + areTraInfo.Text + "\",       \"currentDate\":\"" + date.ToString() + "\",        \"entryDate\":\"" + fechaIniInfo.Text + "\",        \"oUTDate\":\"" + fechaFinInfo.Text + "\",      \"entryHour\":\"" + horaIniInfo.Text + "\",     \"oUTHour\":\"" + horaFinInfo.Text + "\",       \"expenseLine\":null,       \"expenseLine$_identifier\":null,       \"activity\":\"" + activiS.Text + "\",  \"meetingClients\":" + junta.Checked + ",       \"lifting\":false,      \"supervision\":" + superv.Checked + ",     \"engineeringDevelopment\":" + desIng.Checked + ",      \"image\":null,     \"image$_identifier\":null,     \"workingTime\":\"" + workingT + "\",       \"importServicesProject\":null,     \"cuopgCreateInstallations\":null,      \"projectPhase\":null,      \"addtools\":null,      \"recordTime\":null}}" ;

        //string jsonesca = JsonConvert.SerializeObject(daily);
        request.AddParameter("application/json", daily, ParameterType.RequestBody);
        //request.AddJsonBody(daily);

        IRestResponse resp = clients.Execute(request);
        var content = resp.Content; // raw content as string  

        if (resp.StatusCode == HttpStatusCode.OK)
        {
            Toast.MakeText(this.Context, resp.Content, ToastLength.Long).Show();
        }
        else
        {
            Toast.MakeText(this.Context, "Not Conection Response!!!", ToastLength.Long).Show();
        } 

    }