How to create/get the root item in a new document/module via Web Services using Python ?

Description
akamentz
Posts: 2
Joined: Tue May 03, 2016 11:22 am

How to create/get the root item in a new document/module via Web Services using Python ?

Postby akamentz » Wed May 18, 2016 7:20 am

I am using Python with suds SOAP client to access Polarion Web Services and read/write live documents in a project.
Everything works fine, except for one problem being serious to me.
I can create a new document using the CreateDocument(...) function of Tracker Service. But it seems impossible to start filling it with items so long as you don't have the URI of the root item (title) created in it.
The Tracker Service method creating work items in a document:
createWorkItemInModule(ns5:SubterraURI moduleURI, ns5:SubterraURI parentWorkItemURI, ns4:WorkItem workItem)
requires the URI of the parent item, which does not exist for the root item (title) of a new document.
The Java WS client version of the same function allows for passing a null instead of parentWorkItemURI in order to create the top work item.
However, when calling the same method using SOAP client and passing empty or null value in parentWorkItemURI element, the server responds with an error: "null is not Subterra". It seems there is no way to create the top work item in a document with this method.

How can I pass a "real" NULL to Web Service server using SOAP?

The same problem appears when trying to read work items from a document without the knowledge of the root (top) item URI. Again, the client methods
getModuleWorkItems(...) or getModuleWorkItemUris(...)
always require the parent's URI, what is understandable - but cannot be fulfilled for the top/root element. In the Java version you can always pass NULL as parent's URI, but not when calling with a SOAP client from Python.

How to retrieve/create the top document items in such cases?

eways
Posts: 2
Joined: Tue Dec 20, 2016 5:05 pm

Re: How to create/get the root item in a new document/module via Web Services using Python ?

Postby eways » Tue Dec 20, 2016 5:10 pm

I am facing the same issues...so I need to reopen this topic again.
Are there any proceedings with the SOAP interface and passing a null value in expected subterra format?

eways
Posts: 2
Joined: Tue Dec 20, 2016 5:05 pm

Re: How to create/get the root item in a new document/module via Web Services using Python ?

Postby eways » Tue Dec 20, 2016 7:35 pm

Good news,
I actually found the issue: The problem is that the parameter in the TrackerWebService-wsdl is not marked with the attribute nillable="true". The most python libraries convert a None parameter only to an xsi:nil when this parameter is set.
I verified this issue by manipulating the python-tracker bindings and setting the parameter to nillable which produces a correct request without subterra-scheme argument exceptions. I used the getModuleWorkItemUris service but I think the issue also relates to getModuleWorkItems.

Here the request without nillable="true":

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header>
<ns1:sessionID xmlns:ns1="http://ws.polarion.com/session" soap-env:actor="http://schemas.xmlsoap.org/soap/actor/next" soap-env:mustUnderstand="0">5566755965596323076</ns1:sessionID>
</soap-env:Header>
<soap-env:Body>
<ns0:getModuleWorkItemUris xmlns:ns0="http://ws.polarion.com/TrackerWebService-impl">
<ns0:moduleURI>subterra:data-service:objects:/default/PUCC${Module}{moduleFolder}16 Solution Planning and Implementation#1 SSS Software Module Specification Firmware PUCC</ns0:moduleURI>
<ns0:parentWorkItemURI/>
<ns0:deep>true</ns0:deep>
</ns0:getModuleWorkItemUris>
</soap-env:Body>
</soap-env:Envelope>

and here the working request with the nillable option set to true:

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header>
<ns1:sessionID xmlns:ns1="http://ws.polarion.com/session" soap-env:actor="http://schemas.xmlsoap.org/soap/actor/next" soap-env:mustUnderstand="0">-5084028189503748481</ns1:sessionID>
</soap-env:Header>
<soap-env:Body>
<ns0:getModuleWorkItemUris xmlns:ns0="http://ws.polarion.com/TrackerWebService-impl">
<ns0:moduleURI>subterra:data-service:objects:/default/PUCC${Module}{moduleFolder}16 Solution Planning and Implementation#1 SSS Software Module Specification Firmware PUCC</ns0:moduleURI>
<ns0:parentWorkItemURI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<ns0:deep>true</ns0:deep>
</ns0:getModuleWorkItemUris>
</soap-env:Body>
</soap-env:Envelope>

So now the question: How can the wsdl-description be fixed? Can this be done locally or does it need an update?

fginfrance
Posts: 2
Joined: Thu Jul 11, 2019 1:44 pm

Re: How to create/get the root item in a new document/module via Web Services using Python ?

Postby fginfrance » Thu Jul 11, 2019 2:17 pm

It seems that 3 years later the problem has not been fixed, yet.
I just had the exact same problem while trying to fill a document from scratch with Python via the TrackerWebservice, using moveWorkItemToDocument()
Can anybody help me, either

1. with a formal way to request a patch of the webservice specification in Polarion
2. details where/how to patch the python-binding as described by eways before
3. another workaround, I cannot imagine that I am the only one who tries to create and fill and document via webservice API

Thank you in advance

fginfrance
Posts: 2
Joined: Thu Jul 11, 2019 1:44 pm

Re: How to create/get the root item in a new document/module via Web Services using Python ?

Postby fginfrance » Thu Jul 11, 2019 3:03 pm

Seems 3 years later the bug is still not fixed in the TrackerWebService, so I bring up again the thread.

I have the exactly same issue when using moveWorkItemToDocument() to fill a document from scratch.

Can anybody help me by either:

1. pointing me to a procedure to request a formal correction from Siemens
2. having some details on the patch in the python webservice-bindings that is mentioned by eways
3. having a different workaround for the issue,
please.

I cannot imagine that I am the only one who has this problem?


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: No registered users and 11 guests