Hi,
I'm working on a project that integrates Python and Blue Prism together, we'd like to be able to utilize Blue Prism's work queue system to share work data between the Python script and Blue Prism. We are having trouble handling serialization between Python and Blue Prism's Work Queue Item XML format.
Couple of separate parts to this,
1. Is there any documentation that explains how Blue Prism de-serializes it's XML format into a collection and vice-versa?
2. How should de-serialization of nested objects (e.g. class that has a class as a member) be handled? I don't see any way of handling something nested like that so Blue Prism could handle de-serializing it into a collection
3. How should null values be handled? For example if we have a Optional[int] type in Python that is set to None, how could we represent that in Blue Prism's XML format?
What we've got working so far is serialization for a single level class, like
class PythonTestObject:
def __init__(self, name, number, flag) -> None:
self.name = name
self.number = number
self.flag = flag
self.created_on = datetime.now()
Will be serialized to
<collection>
<row>
<field name="name" type="text" value="Test"/>
<field name="number" type="number" value="3"/>
<field name="flag" type="flag" value="True"/>
<field name="client_name" type="text" value="test"/>
</row>
</collection>
Thanks for any insight into any of these questions!
Edit:
@EricWilson1 can't seem to reply to your post...
We are trying to write directly to the BP database so that we can share data between the script and blue prism.
New Edit:
@ewilsonThanks! Seems like that would work to serialize nested classes - does blue prism have any concept of a null type in the WorkQueueItem data? I don't see any example of that in our instance
Last Edit:
Here is what I ended up doing, nested class objects end up as a collection in a collection.
class PythonTestObject:
def __init__(self, name, number, flag) -> None:
self.name = name
self.number = number
self.flag = flag
self.engagement = EngagementEnum.FIRST
self.client: Optional[Client] = None
class Client:
def __init__(self, client_name) -> None:
self.client_name = client_name
class EngagementEnum(Enum):
FIRST = 1
Ends up as
<collection>
<row>
<field name="name" type="text" value="Test"/>
<field name="number" type="number" value="1"/>
<field name="flag" type="flag" value="False"/>
<field name="engagement" type="number" value="1"/>
<field name="client" type="collection">
<row>
<field name="client_name" type="text" value="MyClient"/>
</row>
</field>
</row>
</collection>
Handling null types by just not inserting the <field></field> in the xml, so if for example 'client' is None in Python it ends up as
<collection>
<row>
<field name="name" type="text" value="Test"/>
<field name="number" type="number" value="1"/>
<field name="flag" type="flag" value="False"/>
<field name="engagement" type="number" value="1"/>
</row>
</collection>
Blue prism seems fine with that, we just have to remember to check for the field existing in Blue Prism before it is used