I'm using the factory to create a request object, then setting an attribute property and sending the request. I get an error saying that the attribute (which is required) is missing. Looking at the logs, I see that the attribute isn't in the same namespace as its element.
Here's a snippet of the code:
ns = settings.WORKDAY_NAMESPACE
security = Security()
security.tokens.append(UsernameToken(settings.WORKDAY_USER, settings.WORKDAY_PASSWORD))
client = Client(settings.WORKDAY_URL, retxml=True, wsse=security)
request = client.factory.create("{%s}Worker_Request_ReferencesType" % ns)
worker = client.factory.create("{%s}WorkerObjectType" % ns)
worker_id = client.factory.create("{%s}WorkerObjectIDType" % ns)
worker_id.value = Property("BLAH BLAH BLAH") # working around bug in ticket #323
worker_id['_type'] = "Employee_ID"
worker.ID.append(worker_id)
request.Worker_Reference.append(worker)
result = client.service.Get_Workers(Request_References = request)
Here's the body of the request it generates:
<ns0:Get_Workers_Request>
<ns0:Request_References>
<ns0:Worker_Reference>
<ns0:ID type="Employee_ID">BLAH BLAH BLAH</ns0:ID>
</ns0:Worker_Reference>
</ns0:Request_References>
</ns0:Get_Workers_Request>
As you can see, the "type" attribute of the ID element is missing the ns0 namespace.
I'm certain it's not a problem with the WSDL since soapUI works as expected.
What am I missing?
--
Rob Speed