I want to creat web serivice by cfc that return a string.
But the cfc return a struct.
How can I do ?
The client only accept return a string.
my web service code:
<cffunction name="wechar_tokenVerify" access="remote" returntype="string">
the client's http method is get
Looks more or less like that code would work. Can you post what the return structure looks like?
In addition to what @WolfShade said, you can also return as JSON or XML (depending on what the application consuming the web service needs).
And just to round out the discussion, in case jyjun didn't catch it, the returnformat that Wolfshade offered is indeed distinct from (and can alter) the returntype attribute which you already have.
There's history behind all this, but the bottom line is that if you are calling a CFC and a remote method via http (not as a web service), then there are these differences in what's returned by default and how that returnformat overrides it.
In fact, you can also control what format you get back in the URL that you send to request such a remote method this way, by adding a &returnformat=plain, for instance (not string, as I first wrote by mistake here).
That ability to override the format via the URL is not covered in the cfdocs page that was offered, since that's based on the CFML Reference, which only discusses the cffunction tag itself. But it is discussed in the CF Developers Guide section on the topic, and also in a blog post from Ray Camden back 10 years ago when all this was initially bubbling to the surface, if you want to better appreciate how it all came about.
Just a thot.
^ _ ^