What product/components do you use and which version/fix level are you on? I am using webMethods 10.7
Is your question related to the free trial, or to a production (customer) instance? No
What are you trying to achieve? Please describe it in detail.
I am building a package that will bring data in, map it to a webMethods document which mirrors what the output json string should look like. Inside the document there are document lists defined. For all of the time, the input coming in will only have one ‘set’ of data, which is changing the document list to a document. I’m looking for a way to have the document lists stay as document lists even though there’s just one ‘set’ of data in them.
The input gets mapped to a webMethods document that looks like this:
transaction (defined as document)
transactionCode (defined as string)
party (defined as document)
person (defined as document
DOB (defined as String)
firstName (defined as String)
lastName (defined as String)
testArray (defined as a Document List)
item1 (defined as a String)
item2 (defined as a String)
testArray2 (defined as Docuemnt List)
code (defined as String)
After the document has been populated, it then gets translated to a json string using pub.json:documentToJSONString
The output json string is in this format:
{ “transaction” :
{ “transactionCode”: “NAME_DOB_SSN”
},
“party”:{
“person”:{
“birthDate”:“1900-01-01”
},
“firstName”:“John”,
“lastName”:“Smith”,
“partyIdentities”: [ {
“typeCode”: “SSN”,
“typeId”: “111222333”
}], “partyRoles”: [{
“roleCode”:“test”
}]
},
“lineOfBusinesses”: [{
“lineOfBusinessCode”:“test1”
},{
“lineOfBusinessCode”:“test2”
}]
}
Do you get any error messages? Please provide a full error message screenshot and log file. No.
Have you installed all the latest fixes for the products and systems you are using? Yes.
but I’m getting the result of partyIdentities as an Object with only one occurance of SSN info, even through I defined partyIdentities as a Document List in my flow:
“partyIdentities”: {
“typeCode”: “SSN”,
“typeId”: “111222333”
},
I’m loading input data into a webMethods document that looks like this:
then I’m doing
pub.json:documentToJSONString to create the JSON string the API I’m calling needs.
Can you share more detail about these steps? The symptom you’re describing sounds very much like what happens when parsing XML without a defined doc type, or arrays input in the xmlNodeToDocument call, that identifies what should be arrays.
Mine has only 1 element just like yours. I took your data and tried it with jsonStringToDocument and it worked perfectly.
How did you generate the document type ?
Did you create it manually or programatically ?
Are you referencing a document type in the input ‘jsonDocumentTypeName’ to jsonStringToDocument ?
I would recommend that you do not specify a document type as input to the jsonStringToDocument service.