question

Upvotes
Accepted
3 0 0 2

Unable to successfully login to DACS Station SOAP API via Python Suds 1.4.5

I am trying to use the DACS Station Soap API on DACS 7.7. This DACS has been running fine with our RTDS for some time, and I now want to try automate our usage of DACS using Python on Linux. I have looked at the code examples, but when logging in, I get the following error:

from suds.client import Client
url = 'http://localhost:8080/DacsWS/DacsWebServiceService?wsdl'
client = Client(url

l = client.factory.create("dacsAdministratorLogin")
l.aAdministratorName.mAdministratorName = "reuter"
l.aAdministratorPassword.mAdministratorPassword = "<redacted>"
client.service.getDacsAdministratorDefinition(l)

output is

2024-03-19 09:59:24,805 ERROR [suds.client] <?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://dacsWebService.rfa.reuters.com/" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header/>
   <ns1:Body>
      <ns0:getDacsAdministratorDefinition>
         <loginAttribute>
            <aAdministratorName>
               <mAdministratorName>reuter</mAdministratorName>
            </aAdministratorName>
            <aAdministratorPassword>
               <mAdministratorPassword>p_reuter</mAdministratorPassword>
            </aAdministratorPassword>
         </loginAttribute>
      </ns0:getDacsAdministratorDefinition>
   </ns1:Body>
</SOAP-ENV:Envelope>
.
.
.
WebFault: b"Server raised fault: 'java.lang.NullPointerException'"

I also tried


l = client.factory.create("dacsAdministratorLogin")
l.aAdministratorName = "reuter"
l.aAdministratorPassword = "<redacted>"
client.service.getDacsAdministratorDefinition(l).aResult.mErrorText

which gets further as we don't get a 500, but we this returns `Invalid Administrator Name`


I made sure that within DACS, that I have checked the "Enable Web Service Usage" (see attached screenshot).

Does anyone have any pointers on how I can get this working? I am using Suds 1.4.5 on Python 3.8. Thanks in advance.


reuter-permissioning.png

python#technologyDACSsoap-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi @charlie.smith ,

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?
If so please can you click the 'Accept' text next to the appropriate reply? This will guide all community members who have a similar question.

Thanks,
AHS

Upvotes
Accepted
79.2k 251 52 74

@charlie.smith

Thank you for reaching out to us.

I checked the DACS Web Sevices Programmer's Guide and found that the getDacsAdministratorDefinition method requires two parameters.

1710905561486.png

The code should look like this:

_dl = client.factory.create('dacsAdministratorLogin')
_dl.aAdministratorName.mAdministratorName         = dacsLogin
_dl.aAdministratorPassword.mAdministratorPassword = dacsPasswd


_dn = client.factory.create('dacsAdministratorName')
_dn.mAdministratorName = "reuter"
_adminDef = client.service.getDacsAdministratorDefinition(_dl, _dn)
print(_adminDef)

1710905561486.png (68.4 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
3 0 0 2

Thanks @Jirapongse. I have updated my code but I am still getting the same NullPointerException error. The transmitted XML is:


2024-03-20 08:34:16,983 ERROR [suds.client] <?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://dacsWebService.rfa.reuters.com/" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header/>
   <ns1:Body>
      <ns0:getDacsAdministratorDefinition>
         <loginAttribute>
            <aAdministratorName>
               <mAdministratorName>reuter</mAdministratorName>
            </aAdministratorName>
            <aAdministratorPassword>
               <mAdministratorPassword>redacted</mAdministratorPassword>
            </aAdministratorPassword>
         </loginAttribute>
         <adminName>
            <mAdministratorName>reuter</mAdministratorName>
         </adminName>
      </ns0:getDacsAdministratorDefinition>
   </ns1:Body>
</SOAP-ENV:Envelope>
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
79.2k 251 52 74

@charlie.smith

I tested the request on SOAP UI and it works fine.

1710926200478.png

You can contact the DACS support team directly to verify if the DACS WS is working properly.


1710926200478.png (45.3 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.