1

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
        }
    ]
    }
2
  • 1
    my experience is that this sort of error is often a data type problem. Check whether you have a field defined as Integer when it should be a Decimal etc. The Line Item Discount "your text" bit looks weird too Commented Jun 4, 2024 at 12:18
  • If you use the latest version of RestSharp, you should not set content type, accept, and content length headers. Commented Jun 5, 2024 at 14:31

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.