I am currently trying to call and run Blue Prism robots using their api within python, I have exposed the robots and have access to their wsdl but I'm not able to find any information on the request structure and what the soap request requires. If anyone has had any experience doing this and can help me I'd appreciate it and would be even better if someone has tried to do this using python and has an example for me.
-
What specific functionality within the API are you trying to invoke? What have you tried so far, and where are you getting stuck? Have you done any research? There are several Python frameworks for implementing SOAP requests, like [Zeep](https://python-zeep.readthedocs.io/en/master/). – esqew Feb 20 '20 at 16:32
-
@esqew I am primarily trying to invoke run process, I am unaware of what is required within the soap request such as which credentials etc I am aware there are various frameworks its just the actual required contents and structure specific to Blue Prism I am missing – SamHedgecock Feb 24 '20 at 10:51
1 Answers
As I see you have access to WSDL. To know how the message body looks, you can use SOAPUI - https://www.soapui.org/ Using SOAPUI you can get the SOAP Message Body if you have WSDL, and you can test your service using the SOAPUI before you proceed with you coding, I have that it works for me, when I use Blue Prism Credentials.(The credential I use to login to Blue Prism) using Basic HTTPAUTH Note: You must pass Blue Prism credentials to access API.
To know how to expose a process/object as a service you can refer Blue Prism Documentation - https://community.blueprism.com/HigherLogic/System/DownloadDocumentFile.ashx?DocumentFileKey=bd78867d-5017-4b00-890b-538d03a70086
Now coming to Python As previously mentioned by others, Zeep is the most simple one to use.
pip install zeep
once you have installed zeep. One of the first things you will do if you start developing an interface to a wsdl web service is to get an overview of all available operations and their call signatures. Zeep offers a command line interface to make this easy.
python -mzeep <your wsdl location/url>
Sample python code - for a process accepting two numbers and returns sum, The user name and password that I have used is the credential that I use to login to Blue Prism Environment and it works for me, if you are using SSO based signin than the authorization would differ.
from requests import Session
from requests.auth import HTTPBasicAuth
from zeep import Client
from zeep.transports import Transport
session = Session()
session.auth = HTTPBasicAuth('username', 'passwd')
client = Client('https://localhost:8181/ws/Sum?wsdl',
transport=Transport(session=session))
response = client.service.Sum(10,10)
print(response)

- 136
- 1
- 5
-
This works well, however, there is no response until the triggered Blue Prism process has completed (which means the Python blocks for the duration of the process) -- is there a way to send the request without blocking? – micycle Dec 01 '20 at 10:14
-
Maybe you should try looking at the asyncio library: https://docs.python.org/3/library/asyncio.html – Alex Jan 04 '21 at 23:32