Jump to content

arkus

Members
  • Posts

    3
  • Joined

  • Last visited

arkus's Achievements

I ordered some spaghetti with marinara sauce and I got egg noodles and ketchup. I'm an average nobody.

I ordered some spaghetti with marinara sauce and I got egg noodles and ketchup. I'm an average nobody. (2/54)

0

Reputation

  1. Hi eAi, Alas, I'd like to contribute a patch but my C/C++ is severely lacking (as in I wouldn't know where to start!). Sit me down in front of C#, on the other hand, and I'm quite at home! I understand your argument that multiple arguments can be passed by using an array, but additionally could these also form an anonymous class (i.e. one with no signature) like is being returned in my second signature above? This resulting object could be passed back as the parameter into the callback and then allow the use of property accessors to get at each of the properties returned by the remote service.
  2. Hi eAi, Thanks for your response. I can certainly look into adding [] around my response (but this is a WCF service which is serializing the response automatically, I think I'll have a job on). Is this, however, a bug in MTA? I am returning a valid JSON object tree which MTA cannot parse because it is expecting an array back. Is there scope here for a bug fix? Daniel EDIT: I've made my WCF service return a List<> containing my response object which, as you would expect, is serialized to JSON as an array. MTA can parse this correctly, which suggests a bug in that MTA cannot accept a single object as a response from a remote server but can accept an array. I expect the same is also true as MTA always sends the arguments to a remote call as an array. Whilst it's not "wrong", it's not ideal - I'd be interested to find out if this can be resolved. I'm prepared to provide access to a WCF service to assist, if required.
  3. Hi all, I've got a pretty unique situation but hear me out! I'm using .NET's WCF to host a web service that accepts and responds to calls wrapped in JSON. For security reasons I can't give you the address of the server (it doesn't respond to requests from off-box) but suffice to say I can send it a string of JSON (using callRemote), it does some work and it returns a JSON object (not an array of objects - this is where I think the problem may lie). I'm sending in a string which looks like this: [ { "someField": "ab", "someOtherField": "ab", "anotherField": "{5B4904C9-4D95-465B-A23C-A79349323DA2}" } ] The service does some work server side and populates an instance of a simple class with a few string, Guid and string array values, which are then serialized as JSON and passed back to MTA. An example response looks like this: {"fieldA":0,"arrayField":["someValue", "someOtherValue"],"uniqueKey":"yetAnotherValue"} This is, according to various sources, a valid JSON string - indeed, it passes validation at JSONlint.com - but it doesn't seem to be passed back to my callback method correctly. I'm wondering if this is because it's not an array, like MTA sends it's requests in, but rather a single object. The only response I seem to get is that result==nil. The method I'm using to hit the WCF service is as follows: function doCallRemote(entry) callRemote("http://someaddress/", myCallbackFunction, entry ) end function myCallbackFunction(result) if result and result ~="ERROR" then --all good elseif result and result == "ERROR" then outputChatBox(result.." , "..errorcode) elseif result == nil then outputChatBox("result: nil") end end Can anyone spot any obvious omissions, errors or lack of knowledge as to why I can't get my JSON object result passed back to my callback function? Any help would be gratefully received. Daniel
×
×
  • Create New...