Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
09-11-21 08:49 PM
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:
@ewilson
Thanks! 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.
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:
@ewilson
Thanks! 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
Answered! Go to Answer.
1 BEST ANSWER
Helpful Answers
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
10-11-21 03:56 PM
@JeremyFarmer,
Ok, have you tried looking directly at the table dbo.BPAWorkQueueItem using SQL Management Studio? That should give you a pretty good view of how collections are stored. Just look at the field titled data.
Create a test work queue and then throw a Collection with an embedded Collection in it into the test work queue. Then you should be able to work out the format.
Cheers,
Eric
Ok, have you tried looking directly at the table dbo.BPAWorkQueueItem using SQL Management Studio? That should give you a pretty good view of how collections are stored. Just look at the field titled data.
Create a test work queue and then throw a Collection with an embedded Collection in it into the test work queue. Then you should be able to work out the format.
Cheers,
Eric
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
10-11-21 03:38 PM
Hi @Jeremy Farmer,
Can you elaborate on what you mean when you say you're trying to integrate Python and Blue Prism? Does this mean you're exposing a Blue Prism VBO or process as a SOAP service and trying to invoke it from Python? Or are you trying to write directly to the BP database?
Cheers,
Eric
Can you elaborate on what you mean when you say you're trying to integrate Python and Blue Prism? Does this mean you're exposing a Blue Prism VBO or process as a SOAP service and trying to invoke it from Python? Or are you trying to write directly to the BP database?
Cheers,
Eric
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
10-11-21 03:56 PM
@JeremyFarmer,
Ok, have you tried looking directly at the table dbo.BPAWorkQueueItem using SQL Management Studio? That should give you a pretty good view of how collections are stored. Just look at the field titled data.
Create a test work queue and then throw a Collection with an embedded Collection in it into the test work queue. Then you should be able to work out the format.
Cheers,
Eric
Ok, have you tried looking directly at the table dbo.BPAWorkQueueItem using SQL Management Studio? That should give you a pretty good view of how collections are stored. Just look at the field titled data.
Create a test work queue and then throw a Collection with an embedded Collection in it into the test work queue. Then you should be able to work out the format.
Cheers,
Eric
