Commander
Commander
561 views

Update requirement properties using the Web Services

Hello,

How can I access the Property Value class by using the requirement service (python)? I only have access to the class Requirements Service by using the web service /Services1.0/jaxws/requirements?wsdl.

I need this in order to update a requirement property based on its children properties

0 Likes
2 Replies
Micro Focus Expert
Micro Focus Expert

 

Hi @LauraMariaB,

 

You can use these methods from the requirements service:

 

getCustomProperties: get all custom properties in a project, includes the id

 

getProperty: get the property value (by id) for a requirement

 

updateProperty: change the property value

 

 

Regards,

Hubert

0 Likes
Commander
Commander

Hello,

As I said, I am using the Python language and I need to create a PropertyValue object in order to update an existing property. What I did not know is that there is no need to have access to the PropertyValue class. I just need to create a dictionary with the same arguments that the Property Value classes defines.

This is different from Java where you have to import all the needed classes.

So, for anyone that might want to do something similar to this, to update a requirement property in Python you need to:

1. Instantiate the requirement service

    self.req_client = zeep.Client(wsdl="http://IP:PORT/Services1.0/jaxws/requirements?wsdl)

1. Create the Property Object like a dictionary structure:

    property_to_set = {"propertyId": prop_id, "requirementId": req_id,   "value": "COVERAGE", "type": zeep.xsd.SkipValue, "modifyCounter": zeep.xsd.SkipValue }

2. Update the property:

    self.req_client.service.updateProperty(project.session, req_id, property_to_set)

 

Note: Even if you do not need the "modifyCounter" or the "type" variable, you have to send them when calling the function, otherwise you will get an exception saying that the call misses an argument. Not sure why this is needed. Instead of "zeep.xsd.SkipValue" , you can send also an empty string and it will work.

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.