2

-cURL code snippet

curl --location --request POST 'http://smartdoc-apac-documentservices-dk1174-b.uku1f.paas.intranet.db.com/fn/createCaseMgmtDocument'
--form 'file=@"RCH_15CA.pdf"'
--form 'docServiceInputJson="{ "strMimeType": "APPLICATION/PDF", "strTenantAppId": "SDAPAC_INTERIM_TECH", "objFilenetMetadata": "{'''dbDocumentClass''':['''DB90602_DBSMARTDOCAPAC'''],'''dbTitle''':[RCH_15CA.pdf'''],'''dbJurisdiction''':['''IN'''],'''dbAuthor''':['''gtb-smartdoc-int@db.com'''],'''dbLegalEntity''':['''0784'''],'''dbRecordCode''':['''PRC-06-B023-01'''],'''dbLanguage''':['''en'''],'''dbClassification''':['''3'''],'''dbBusiness''':['''G_7717''']}", "strWriteDocumentGroup": "smtdoc_fn_users", "strEnrichFNMetadataFlag": "N", "objAppMetadata": { "DB90602_apacJurisdiction": "IN", "DB90602_apacDbBusiness": "G_7717", "DB90602_apacRecordCode": "PRC-06-B023-01", "DB90602_apacLegalEntity": "0784", "DB90602_apacClassification": "3", "DB90602_apacDocumentClass": "DB90602_DBSMARTDOCAPAC", "DB90602_apacLanguage": "en" }, "strReadDocumentGroup": "smtdoc_fn_users" } "'

  • yes, multi-part and upload can be very hard to get right. this is one of the things that is impossible to diagnose remotely (please note screenshots are not recommended on stack-overflow: https://stackoverflow.com/help/how-to-ask) - so the only suggestion I have is to go through this thread. it is not easy, and it will take some time and R&D, but I'm sorry I don't see any other option for you: https://github.com/intuit/karate/issues/1645#issuecomment-862502881 – Peter Thomas Mar 15 '23 at 17:53

1 Answers1

0

Based on the error message maybe you should just make this change:

* mutipart file file = ...

Read the docs carefully once: https://github.com/karatelabs/karate#multipart-file

Else, please look at my comment under your question.

EDIT - based on the cURL your provided, this is my guess. You can try using text instead of def:

* def data = 
"""
{
  "strMimeType": "APPLICATION/PDF",
  "strTenantAppId": "SDAPAC_INTERIM_TECH",
  "objFilenetMetadata": "{'''dbDocumentClass''':['''DB90602_DBSMARTDOCAPAC'''],'''dbTitle''':[RCH_15CA.pdf'''],'''dbJurisdiction''':['''IN'''],'''dbAuthor''':['''gtb-smartdoc-int@db.com'''],'''dbLegalEntity''':['''0784'''],'''dbRecordCode''':['''PRC-06-B023-01'''],'''dbLanguage''':['''en'''],'''dbClassification''':['''3'''],'''dbBusiness''':['''G_7717''']}",
  "strWriteDocumentGroup": "smtdoc_fn_users",
  "strEnrichFNMetadataFlag": "N",
  "objAppMetadata": {
    "DB90602_apacJurisdiction": "IN",
    "DB90602_apacDbBusiness": "G_7717",
    "DB90602_apacRecordCode": "PRC-06-B023-01",
    "DB90602_apacLegalEntity": "0784",
    "DB90602_apacClassification": "3",
    "DB90602_apacDocumentClass": "DB90602_DBSMARTDOCAPAC",
    "DB90602_apacLanguage": "en"
  },
  "strReadDocumentGroup": "smtdoc_fn_users"
}
"""

* url 'https://httpbin.org/anything'
* multipart file file = { read: 'test.pdf' }
* multipart field docServiceInputJson = data
* method post
Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • Hi Peter updated the code in text format – santosh biswal Mar 15 '23 at 18:33
  • @santoshbiswal really sorry I have nothing to add. read the comment under your question please. maybe someone else can help, but I consider that extremely unlikely – Peter Thomas Mar 15 '23 at 18:38
  • Thanks Peter!! is this the limitation of karate tool or i am doing it in a wrong way? – santosh biswal Mar 15 '23 at 18:54
  • @santoshbiswal you need to understand what the server expects and then write the karate test to match. maybe if you spend some time working with the server-side team, you can get this sorted in no time. since you mention postman works, can you edit your question to include a cURL export ? then we might be able to figure out what you are doing wrong – Peter Thomas Mar 15 '23 at 19:02
  • Hi Peter i have modified the question and added the cURL code snippet. – santosh biswal Mar 16 '23 at 03:48