This content has been marked as final. Show 8 replies
The Flex code looks ok, except when working with XML, ALWAYS use toXMLString(), never toString()... that may be your main error, toString is a method, not a property, but still, always use toXMLString().
Try that fix first.
For future reference, flex currently only supports the methods, GET and POST, and not the other REST methods.
Thanks for the quick response.
I've made the code changes, (my typo on the method / property mix up.)
But it still returns the same error, the weird thing is that it doesn't seem to hit the rest service. I've got it running in debug on the server side and I don't see any activity.
is there any debug infomation I can look at as the error is not very clear.
Interestingly enough it looks like the Flex client doesn’t ever call the POST service, I’ve just put in a GET handler in the server and it’s this service it tries to use. I’ve modified my flex code to this:
dataflowRequest.url = " http://localhost:8080/sdmxRegistry3/restInterface";
dataflowRequest.method = "post";
dataFlowQuery.QueryStructureRequest.registry::DataflowRef.registry::URN = URN;
dataflowRequest.request = dataFlowQuery.toXMLString();
I've also changed the mxml to have a POST attribute but it still uses the GET
<mx:HTTPService id="dataflowRequest" resultFormat="e4x" useProxy="false" method="POST" ></mx:HTTPService>
Strange I'm at a loss to know why the post service isn't being called.
Any feedback would be great.
So it looks like you need to set a contentType for it send the post request.
No, that is not necessary.
But if the post body is empty, Flex automatically uses GET. Could that be your issue? Could dataFlowQuery be empty? Hard code something to test it.
well I'm 99% sure it is happening in my case, take the contentType off goes uses GET service, add it and it uses POST no other changes.
For what reasons I don’t know but I’m as sure as I can be that this is happening in my case.
I’ve now got it working by adding a handler into the POST service on the server for contentType application/text, if I use application/xml from Flex it escapes all my tags and I need it to go through as straight text. Seems to work ok.
Yes, setting contentType can cause some problems. I leave it the default, which is the normal multipart/form-data, and POST xml strings as the value side of a name=value pair.
But if you have it working and are comfortable, then that is fine.