Getting Data In

Accessing a SOAP API?

mrgibbon
Contributor

Hi All, Does anyone have a working example script or other method of getting Splunk to interact with a SOAP API?
There are plenty of REST examples, but not SOAP.

Thanks in advance.

pongc
Engager

Posting here on what worked for me. In looking at https://wiki.python.org/moin/WebServices 

1. ran pip2 install --user suds  as the splunk user.

2. afterwards, copy ~/.local/lib/python2.7/site-packages/suds/ to $splunk_home/etc/apps/<my_app>/bin

3. if I now run a python script under $splunk_home/etc/apps/<my_app>/bin using the built in splunk python (ie /opt/splunk/bin/splunk cmd python), I can run these commands

>>> from suds.client import Client
>>> client=Client("http://www.dneonline.com/calculator.asmx?WSDL")
>>> print client

Suds ( https://fedorahosted.org/suds/ )  version: 0.4 GA  build: R699-20100913

Service ( Calculator ) tns="http://tempuri.org/"
   Prefixes (0)
   Ports (2):
      (CalculatorSoap)
         Methods (4):
            Add(xs:int intA, xs:int intB, )
            Divide(xs:int intA, xs:int intB, )
            Multiply(xs:int intA, xs:int intB, )
            Subtract(xs:int intA, xs:int intB, )
         Types (0):
      (CalculatorSoap12)
         Methods (4):
            Add(xs:int intA, xs:int intB, )
            Divide(xs:int intA, xs:int intB, )
            Multiply(xs:int intA, xs:int intB, )
            Subtract(xs:int intA, xs:int intB, )
         Types (0):


>>> client.service.Add(5,6)
11

I could not get this to work with zeep though.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

I've written several python scripts that function as a SOAP client. I'm not allowed to share the code, but I can offer a few tips.
REST and SOAP clients are very similar. The key difference is SOAP always uses POST requests. The body of the request is the XML specified in the API. I use the httplib library, but some prefer urllib.

---
If this reply helps you, Karma would be appreciated.

mrgibbon
Contributor

Hi Rich, I know you might not be able to share the exact code, but can you share an anonomised version of it?
Im still having issues with this. Thanks

0 Karma

tdhoang
New Member

Hi guys, I am now also facing this problem too. do you have any ideas now?

0 Karma

JasonParms
New Member
0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...