This topic contains 2 replies, has 2 voices, and was last updated by kimbomadsen 7 months, 2 weeks ago.
January 4, 2019 at 22:02 #53396
First of all happy 2019!
For one reason or another the body parameter in the following method is not marshalled into the TSomeTest object.
function AddSomeTest([kbmMW_Rest(‘value:”body”‘)] const ATest: TSomeTest): string;
The TSomeTest looks like this:
TSomeTest = class
property MyName: string read FMyName write FMyName;
property MyAge: integer read FMyAge write FMyAge;
I have added the following code in the initialization section
TkbmMWRTTI.EnableRTTI([TSalesInvoice, TSalesInvoiceRead, TSomeTest]);
kbmMWRegisterKnownClasses([TSalesInvoice, TSalesInvoiceRead, TSomeTest]);
When I make a http post request with Fiddler I get an invalid type cast exception.
I found out that I do have access to the body parameter, so I think that some goes wrong with marshalling. If I just marshal/unmarshal with TkbmMWJSONMarshal(m).ValueFromString etc. it does work fine.
Any suggestion what might be the cause of this exception?
I am using kbmmw 22.214.171.124
Thanks in advance.
p.s. the subject line input has a white font on a white background here in Firefox and Chrome
January 6, 2019 at 21:00 #53399
I looks like the mime type var never makes it to the UmarshalBody method in kbmMWSmartServiceUtils.
My http header looks like this:
Am I doing something wrong or is this a bug?
January 8, 2019 at 03:46 #53401
You will definitely want to use latest versions for these features, as they continue to improve.
It should work in 5.07, and it is definitely working in the 5.07.10 update that I will be releasing shortly.
// This method gets a person in the body and echoes it back again.
// Since we want the provided value echoed right back we dont want
// the framework to free the argument automatically.
// The result is freed when needed.
[kbmMW_Rest(‘method:post, path: “echoPerson”‘)]
function EchoPerson([kbmMW_Rest(‘value: “body”, free:false’)] const APerson:TPerson):TPerson;
You must be logged in to reply to this topic.