XQUERY Transformation in OSB

31 views Asked by At

this is the backend request. { "RequestHeader": { "AppId":"***********", "AppName": "TAS" }, "PartnerName": "Coralpay test 2 Ltd", "PartnerId": "12345098", "BVN":"12334343434", "BankCode": ["1920928"] }

My request is going as below without [ ] {"RequestHeader":{"AppId":"***********","AppName":"TAS"},"PartnerId":"12345098","BankCode":"1920928","BVN":"12334343434","PartnerName":"Coralpay test 2 Ltd"}

How can I convert "BankCode": ["1920928"] in Xquery? Not able to convert the [ ] and getting the below error from backend: {"type":"https://tools.ietf.org/html/rfc7231#section-6.5.1","title":"One or more validation errors occurred.","status":400,"traceId":"00-838ce74fc427fabf58f773876eb38c72-ed9b230f7c849022-00","errors":{"model":["The model field is required."],"$.BankCode":["The JSON value could not be converted to System.Collections.Generic.List`1[System.String]. Path: $.BankCode | LineNumber: 0 | BytePositionInLine: 106."]}}

My xquery looks like ,

     {
        for $BankCode1 in $partnerOnBoardingRequest/ns1:BankCode
        return 
        <BankCode>{concat(fn:data($BankCode1),'ADDED_STRING_PADDING')}</BankCode>
    }
1

There are 1 answers

0
Debarati Das On

When I write my xquery as below,

{
  for $BankCode1 in $partnerOnBoardingRequest/ns1:bankCode
  return 
  <BankCode>[{concat(fn:data($BankCode1),'ADDED_STRING_PADDING')}]</BankCode>
}

Then I am getting the value as "BankCode": "[1920928]" but it should come as "BankCode": ["1920928"]

Please provide a solution for this.