Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

SOAP based XML webservice with .p12 certificate and key phrase authentication

Hemachandra
6 - Meteoroid

Hello All,

 

I have a requirement to download files like .doc, .ppt. .xls and .pdf type files via SOAP based XML web service which uses .p12 certificate based authentication. I was able to successfully test the service using SOAP UI by including the ".p12" certificate file at "Keystore :" path and "Keystore password". when i tried to automate this using Alteryx designer - the download tool doesn't have this authentication mechanism.

 

Please let me know how can we achieve this using Alteryx designer ?

 

Thank you,

Hemachandra

 

 

7 REPLIES 7
BrandonB
Alteryx
Alteryx

Aside from building the call in the R or Python tool, there have been some partners that have built custom tools. Teknion has a "Rest API with Certificate" tool: https://www.teknionusa.com/teknion-toolkit-macro

 

I'm not sure if you can just leverage the download tool because I think the certificate needs to be extracted. 

Hemachandra
6 - Meteoroid

Hi Brandon,

 

Is there any certificate authentication example with Python or R tool ?

tried Teknion "REST API with Certification"  tool (attached picture) but unfortunately it didn't work, as the service I am trying is not REST based.

 

Thanks for your reply..!

BrandonB
Alteryx
Alteryx

Apologies, I wasn't implying that the REST tool would work for a SOAP API call, but I wanted to highlight that they have figured out how to leverage a p12 certificate

BrandonB
Alteryx
Alteryx

The actual Python code itself is a bit out of the scope of an Alteryx forum, but it looks like you need to do something like this to decrypt the key to use it in the request: https://gist.github.com/erikbern/756b1d8df2d1487497d29b90e81f8068

 

Alternatively, you may be able to contact Teknion and see if they have a SOAP equivalent tool. The main difference with the two API types is you will likely have to create a XML payload. 

Hemachandra
6 - Meteoroid

Thank you Brandon,

 

I will try this approach and see if this works. 

 

Best regards

Hemachandra

Hemachandra
6 - Meteoroid

Hi Brandon,

 

I tried multiple methods including Zee client etc. but the simplest solution which worked for me is

 

1. Constructed a SOAP xml request string using "formula tool" and passed it to Python tool

2. Python tool code

 

import io
import requests
import pandas as pd
from ayx import Alteryx
from requests import Session

df = Alteryx.read("#1")
xml =df.iloc[0, df.columns.get_loc('xml_request')]

 

df = Alteryx.read("#1")
xml =df.iloc[0, df.columns.get_loc('xml_request')]

 

headers = {'Content-Type': 'text/xml'} # set what your server accepts
response = requests.post('https://yourendpoint.com?WSDL', data=xml, headers=headers, cert=('cert.pem','key.pem'),verify=True)

 

data = io.StringIO(response.text)
df2 =pd.read_csv(data, header=None)

 

Alteryx.write(df2,1)

 

3. Get the xml response out and parse the xml msg using "XML parsing tool"

 

BrandonB
Alteryx
Alteryx

@Hemachandra thank you very much for sharing. This will be very helpful for others attempting to leverage p12 certificates in their API calls!

Labels