0

I have created a SOAP service which has some optional method arguments. I have found some issues:

  1. While calling the web service I always need to pass all the arguments irrespective of whether they are optional or not.
  2. I found that in ColdFusion we can omit the optional arguments by adding omit=true in cfinvokeargument. But still we need to add cfinvokeargument for each argument. It doesn't solve much problem.
  3. Since a web service is meant to be accessible from any platform or language, the omit=true hack may not be available in other languages.

So my question is, how to deal with the issues. Is there any way to get rid of optional arguments while calling a web service?

Pankaj
  • 1,731
  • 1
  • 13
  • 15
  • 1
    What language/method are you using to access the webservice other than coldfusion? – Bernhard Döbler Sep 03 '15 at 21:57
  • It is intended to be used with dot net and php. – Pankaj Sep 04 '15 at 06:00
  • What happened when you tried accessing it from .net and/or php? Are you sure it applies to *all* optional arguments? Not sure about CF11, but I remember [this CF9 issue](http://www.elliottsprehn.com/cfbugs/bugs/86000) that applied to [optional numeric arguments only](http://stackoverflow.com/questions/21924722/coldfusion-wsdl-illegalargumentexception-on-cfinvokeargument). Strings, for example, can be omitted. – Leigh Sep 04 '15 at 08:45
  • @Leigh I haven't tested it on other environments yet. It was a general question. And yes, `omit=true` applies to all optional arguments in CF11. https://wikidocs.adobe.com/wiki/display/coldfusionen/cfinvokeargument. – Pankaj Sep 04 '15 at 10:24
  • It would be good to confirm it. *And yes, omit=true applies to all optional arguments in CF11* The issue was not cfinvokeargument. It was that the wsdl was generated in such a way that it allowed optional arguments of type="string" but not type="numeric". – Leigh Sep 04 '15 at 10:54
  • Do you have default values for your optional arguments? – Dan Bracuk Sep 04 '15 at 13:05
  • I played around a bit. I created a small cfc with a function with two cfarguments. One mandatory, second optional. I called it from a cfm script with cfinvoke and indeed it only worked when two cfinvokearguments were present. I didn't know that. I then did a test with PHP using the built in SoapClient. This works perfectly when only the mandatory argument is passed in. See my codes: https://gist.github.com/bardware/36385fe3abf870540f61 – Bernhard Döbler Sep 06 '15 at 11:33
  • I added a Visual Basic sample. It works when only one argument is set. – Bernhard Döbler Sep 06 '15 at 12:03

0 Answers0