1. sboz
  2. osa
  3. Issues
Issue #7 resolved

ValueError: Non-nillable LoginBannerText element is nil.

Gordon NA
created an issue

Here is the relevant definition from the WSDL

<s:element minOccurs="1" maxOccurs="1" name="LoginBannerText" type="s:string" />

Here is the response from the service (censored... but this is irrelevant to the issue)

<soap:Envelope>
  <soap:Body>
    <AuthenticateUserResponse>
      <Authenticator>CENSORED AND IRRELEVANT</Authenticator>
      <LastLoginTime>CENSORED AND IRRELEVANT</LastLoginTime>
      <ClearCredential>CENSORED AND IRRELEVANT</ClearCredential>
      <LoginBannerText/>
      <PasswordExpired>CENSORED AND IRRELEVANT</PasswordExpired>
    </AuthenticateUserResponse>
  </soap:Body>
</soap:Envelope>

OSA raises the following exception:

ValueError: Non-nillable LoginBannerText element is nil.

Traceback:

Traceback (most recent call last):
  File "app.py", line 25, in <module>
    auth = client.service.AuthenticateUser(Credentials=creds)
  File "C:\path\to\osa\method.py", line 135, in __call__
    return self.output.from_xml(body)
  File "C:\path\to\osa\message.py", line 168, in from_xml
    res = p.from_xml(body)
  File "C:\path\to\osa\xmltypes.py", line 226, in from_xml
    raise ValueError("Non-nillable %s element is nil." % name)
ValueError: Non-nillable LoginBannerText element is nil.

Shouldn't the value of LoginBannerText be set to an empty string instead of raising a ValueError? The LoginBannerText is present in the response, it just has no value. In any case, I do not think it should raise a ValueError.

Comments (4)

  1. sboz repo owner

    I have fixed that. This indeed makes sense for strings, but for other classes it can be a bit weird, but I do keep it your way.

  2. Log in to comment