Search code examples
vb.netpostmanrestsharpwebapirestful-url

working in postman ,but not working from vb.net code,giving internal error


when trying to send the request through postman ,works fine . but gives the following error ,when using it direct from vb.net code we are using Lib RestSharp and version 106.15.0.0

the error messaage as flollows:

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><env:Fault><faultcode>env:Client</faultcode><faultstring>Internal Error (from client)</faultstring></env:Fault></env:Body></env:Envelope>

Headers

    request.AddHeader("Content-Type", "application/json")
    request.AddHeader("Accept", "application/json")
    request.AddHeader("X-Client-Id", "78a7babff8feb0aed964113c867288b7")
    request.AddHeader("Authorization", "Bearer xxxx")
    request.AddHeader("Connection", "keep-alive")
    request.AddHeader("Content-Length", 1420?)

Json Body

    {
    "billNumber": "R2LEH003776X",
    "internalInvoiceNumber": "6666",
    "paymentMethod": "s",
    "invoiceIssueDate": "2024-05-11",
    "invoiceDueDate": "2024-05-12",
    "invoiceDescription": "",
    "billerVATNumber": 333,
    "companyName": "",
    "companyRegistrationNumber": 1234567890,
    "consumerEmail": "[email protected]",
    "consumerMobile": "",
    "customerVATNumber": "",
    "buildingNumber": 4562,
    "additionalNumber": 7122,
    "street": "INDUSTRIAL STREET",
    "district": "",
    "postalCode": 12333,
    "city": "",
    "province": "",
    "country": "",
    "totalBeforeVAT": 1000.92,
    "totalVAT": 150.14,
    "grandTotal": 1151.06,
     "item":[
        {
          "invoiceLineSerialNo": 1,
          "itemCode": 100,
          "itemDescriptionArabic": "container BGHJ8777",
          "itemDescriptionEnglish": "",
          "unitOfMeasureArabic": "Unit",
          "unitOfMeasureEnglish": "",
          "itemPrice": 500.4586,
          "quantity": 2,
          "lineItemAmount": 1000.92,
          "lineItemDiscount": 0,``your text``
          "lineItemDiscountAmount": 0.0,
          "lineItemAmountAfterDiscount": 1000.92,
          "lineItemVAT": 15,
          "lineItemTotalVAT": 150.14,
          "lineItemTotal": 1151.06
        }
    ]
    }

Solution

  • Problem solved ,i found the problem was using old version of Restsharp.dll ,i replaced with the latest one 111.2.0