Hi Matt,

As you know we use a lot of webservices with Razuna and one thing that
always hits me is that functions which are declared with access=remote also
requires that all parameters are being passed in. The "required" true/false
has no effect.

This is something that Adobe Coldfusion documents also point out in
"Publishing Webservices" at
http://livedocs.adobe.com/coldfusion/8/htmldocs/webservices_01.html. Point
4: The attribute setting required="false" for the cfargument tag is ignored.
ColdFusion considers all parameters as required.

Kind Regards,
Nitai

On Wed, Aug 18, 2010 at 6:52 AM, Matthew Woodward <[email protected]>wrote:

> On Mon, Aug 16, 2010 at 10:48 AM, Skellington <[email protected]> wrote:
>
>> The issue I'm running in to is once I add
>> the new cfargument and a client connects and posts data I'm getting a
>> "java.lang.NullPointerException" error in my logs.
>
>
> I don't do a lot with web services so maybe someone else will have better
> information, but I ran a quick test and think there may be a couple of
> issues.
>
> Here's my web service CFC:
> <cfcomponent output="false">
>
>     <cffunction name="foo" access="remote" output="false"
> returntype="string">
>         <cfargument name="bar" type="string" required="true" />
>         <cfargument name="baz" type="string" required="false"
> default="Here's baz!" />
>
>         <cfreturn arguments.bar & " " & arguments.baz />
>     </cffunction>
>
> </cfcomponent>
>
> Here's my calling CFML page:
> <cfinvoke webservice="http://localhost:8080/openbd/WSTest.cfc?wsdl";
> method="foo" returnvariable="wsreturn">
>     <cfinvokeargument name="bar" value="Hello from the web service!" />
>     <cfinvokeargument name="baz" value="Baz from caller." />
> </cfinvoke>
>
> <cfdump var="#wsreturn#" />
>
> Note that first I tried it with a SINGLE cfargument, meaning my initial
> test was WITHOUT the "baz" cfargument and with only one cfinvokeargument
> (bar). That worked fine.
>
> When I added the second cfargument in the CFC and left the calling page
> with a single cfinvokeargument, I get this error:
> TypeApplication DetailUnrecognized error code: Invalid web service
> operation. Cannot locate operation foo that accepts parameters: { string
> (bar) }Tag Context CFINVOKE
> (/home/mwoodward/apache-tomcat-6.0.26/webapps/openbd/wstest.cfm, Line=1,
> Column=1)
> I thought maybe I needed to add refreshwsdl to the cfinvoke call, but that
> output this on the calling page:
> true Hello from the web service!
>
> So it seems to be dumping the value of refreshwsdl, which I wouldn't have
> expected.
>
> Changing the calling page to include the second argument, I get this:
> Hello from the web service! Baz from caller.
>
> Which is expected.
>
> So it seems that if you have an optional argument in the web service,
> things get funky.
>
> I did a bit more looking and found this:
>
> http://www.talkingtree.com/blog/index.cfm/2006/7/12/cfinvokeargument-omit-attr
>
> Short version is that's a known issue all the way back to 2006 in Adobe CF
> 6.x and in CF 7 they added the omit attribute to cfinvokeargument. This
> means this is likely caused by the underlying Axis web services engine in
> combination with the CFML layer on top of it.
>
> So the trick is to add omit="true" to the second cfinvokeargument:
> <cfinvoke webservice="http://localhost:8080/openbd/WSTest.cfc?wsdl";
> method="foo" returnvariable="wsreturn">
>     <cfinvokeargument name="bar" value="Hello from the web service!" />
>     <cfinvokeargument name="baz" value="Baz from caller." omit="true" />
> </cfinvoke>
>
> <cfdump var="#wsreturn#" />
>
> That will dump "Hello from the web service!"
>
> What's odd to me is that the default value of "Here's baz!" from within the
> web service function never gets tacked on to the response no matter what you
> do.
>
> So that's the best answer I could come up with--you'll have to have the
> caller include all the arguments in order for this to work, and if the
> caller is CFML, you can add omit="true" to the arguments you don't want to
> actually pass to the web service.
>
> --
> Matthew Woodward
> [email protected]
> http://blog.mattwoodward.com
> identi.ca / Twitter: @mpwoodward
>
> Please do not send me proprietary file formats such as Word, PowerPoint,
> etc. as attachments.
> http://www.gnu.org/philosophy/no-word-attachments.html
>
> --
> Open BlueDragon Public Mailing List
> http://www.openbluedragon.org/ http://twitter.com/OpenBlueDragon
> official manual: http://www.openbluedragon.org/manual/
> Ready2Run CFML http://www.openbluedragon.org/openbdjam/
>
> mailing list - http://groups.google.com/group/openbd?hl=en
>



-- 
See for yourself how easy it is to manage files today. Join the revolution!

Razuna SaaS On-Demand - Hosted Digital Asset Management Solution
http://www.razuna.com/

Razuna - Open Source Digital Asset Management
http://www.razuna.org/

Follow us on Twitter
http://twitter.com/razunahq

-- 
Open BlueDragon Public Mailing List
 http://www.openbluedragon.org/   http://twitter.com/OpenBlueDragon
 official manual: http://www.openbluedragon.org/manual/
 Ready2Run CFML http://www.openbluedragon.org/openbdjam/

 mailing list - http://groups.google.com/group/openbd?hl=en

Reply via email to