Parameter "xy" is not optional

Asked by azurit on 2011-09-24


i have problems with running simple SOAP function using two clients:
 - standard PHP SOAP client
 - Python ZSI version 1.7

Result is the same in both cases:
interface name: soap
service name: test
Parameter "first" is not optional

from ladon.ladonizer import ladonize

class test(object):

 def test(self, first, second):
  return first

client Python
from ZSI.client import Binding
from ZSI import TC

bind = Binding(host="", port=8080, url="/test/soap")
result = bind.RPC(None, "test", ("aaa", "bbb"), TC.Any(), requesttypecode=TC.Any("test"))

client PHP
$sck = new SoapClient(null, array("location" => "", "uri" => ""));
$result = $sck->__soapCall("test", array("aaa", "bb"));

XML from python client
<?xml version="1.0" encoding="utf-8"?>
  SOAP-ENV:encodingStyle="" >
<element id="ob77fdf20" xsi:type="xsd:string">aaa</element>
<element id="ob77fdf38" xsi:type="xsd:string">bbb</element>

Date: Sat, 24 Sep 2011 14:10:18 GMT
Server: WSGIServer/0.1 Python/2.7.1+
Content-Type: text/plain; charset=utf-8
Content-Length: 775

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/ladon-0.6.3-py2.7.egg/ladon/server/", line 355, in __call__
    response_part = dispatcher.dispatch_request(request_data,environ)
  File "/usr/local/lib/python2.7/dist-packages/ladon-0.6.3-py2.7.egg/ladon/server/", line 157, in dispatch_request
    result = self.call_method(method,req_dict,tc,export_dict)
  File "/usr/local/lib/python2.7/dist-packages/ladon-0.6.3-py2.7.egg/ladon/server/", line 50, in call_method
    raise UndefinedServiceMethod(self.iface._interface_name(),self.sinst.servicename,'Parameter "%s" is not optional' % arg['name'])
interface name: soap
service name: test
Parameter "first" is not optional

Python 2.7.1
PHP 5.3.5

Any ideas ?

Thank you !

Question information

English Edit question
ladon Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
azurit (azurit) said : #1

Ladon version 0.6.3

json client from is working fine

jsgaarde (jakob-simon-gaarde) said : #2

Hi Azurit.

How do you run the service? and what is the name of the python module where you have implemented your service class "test".

Best Regards
Jakob Simon-Gaarde

azurit (azurit) said : #3


i'm running it via Ladon test server. I find out that only kayword arguments are working in Ladon (so i need to specify also argument name, even it's not keyword argument). Is this an intended bahavior ?

jsgaarde (jakob-simon-gaarde) said : #4

I have no problem running your example with suds.

jsgaarde (jakob-simon-gaarde) said : #5

Is the name of your service module by any chance

azurit (azurit) said : #6

File is ''. What version of SUDS are you using ? Mine is 0.4 . As i said, the same problem is with PHP unless i make arguments as keyword:
$result = $sck->testf(new SoapParam("aaa", "first"), new SoapParam("bbb", "second"));

azurit (azurit) said : #7

As, sorry, i didn't tried this one with SUDS :) SUDS was in other question. Anyway, Ladon seems to not handle the positional arguments and needs argument names in XML.

Best jsgaarde (jakob-simon-gaarde) said : #8

Hi Azurit.

The Ladon SOAP interface is my implementation of the SOAP 1.1 protocol. I can't find anything (specification wise) that suggests that positional arguments are supported in SOAP 1.1, but I might have missed it. That's why only named arguments are supported. This does not mean that Ladon can't support positional arguments - it can - cause not only does Ladon store information about parameter names, it also stores the position, default value and doc - strings.

You are more than welcome to write a SOAP 1.2 interface for Ladon. All you have to do is write one new module with 4 classes that inherit: ServiceDescriptor, BaseRequestHandler, BaseResponseHandler and BaseInterface.

You can easilly add a new interface to Ladon - for example like this:
1. copy the ladon/interfaces/ module to ie. ladon/interfaces/
2. edit ladon/interfaces/ and in the bottom change the classname SOAPInterface to MYSOAPInterface and make the static method _interface_name() return "mysoap"
3. edit ladon/interfaces/ add "import ladon.interfaces.mysoap" in the bottom of the file

If you choose to do so, I will review it and add it as a contribution.

/ Jakob

jsgaarde (jakob-simon-gaarde) said : #9

Btw. my version of suds us 0.4 (0.4.1-2) too. Your service-example works with gSOAP too.

azurit (azurit) said : #10

0.4 or 0.4.1 ? i'm using 0.4 cos this is the last _stable_ version (0.4.1 si beta).

jsgaarde (jakob-simon-gaarde) said : #11

What's the status on this one?

azurit (azurit) said : #12

it's 'fixed' if ladon is not supposed to suppoer positional arguments. closing it

azurit (azurit) said : #13

Thanks jsgaarde, that solved my question.