[gold-users] Internal server error: Can't call method "toString" on an undefined value.

Karol Krizka kkrizka at gmail.com
Mon Jun 23 13:09:23 MDT 2008


Hi all,

I am trying to write a simple Python script that connects to a Gold
daemon using the SSSRMAP Protocol and runs the Quote command. The
purpose of this script is just for me to learn and test how the
SSSRMAP protocol works. The script is attached below...

When I run the script, my Gold daemon (running in debug mode) receives
the connections, it validates the digest and signature, but then it
prints out the following error:

2008-06-23 12:05:37.778 ERROR main::__ANON__ [./goldd:375]  Internal
server error: Can't call method "toString" on an undefined value.

I am not sure what could be wrong. Do you have any suggestions? The
user kka34 and the machine charm exists in the Gold DB. The only made
up part of the XML file is the jobId.

--
Cheers,
Karol Krizka

My script:

#!/usr/bin/python

import httplib
from xml.dom import minidom
from xml.dom.ext import c14n
import sha,hmac,base64


msg="""<?xml version="1.0" encoding="UTF-8"?>
<Envelope>
"""

body="""<Body actor="kka34" chunking="True">
    <Request action="Quote" object="Job" actor="kka34">
    <Object>Job</Object>
      <Data>
        <Job>
          <JobId>PBS.1234.0</JobId>
          <ProjectId>physics</ProjectId>
          <UserId>kka34</UserId>
          <MachineName>charm</MachineName>
          <Processors>2</Processors>
          <WallDuration>1234</WallDuration>
        </Job>
      </Data>
    </Request>
</Body>"""


doc=minidom.parseString(body);
body=c14n.Canonicalize(doc)

m=sha.new(body)
digest_enc=m.digest()
digest=base64.b64encode(digest_enc)

AUTH_KEY=open("/usr/local/gold/etc/auth_key")
AUTH_KEY=AUTH_KEY.readline()
AUTH_KEY=AUTH_KEY.strip()

m=hmac.new(AUTH_KEY,digest_enc,sha)
sig=m.digest()
sig=base64.b64encode(sig)

print sig

end="""
<Signature>
    <SecurityToken type="Symmetric"></SecurityToken>
    <DigestValue>"""+digest+"""</DigestValue>
        <SignatureValue>"""+sig+"""</SignatureValue>
</Signature>
</Envelope>"""


msg=msg+body+end

size=hex(len(msg))[2:]

msg=size+"\r\n"+msg+"\r\n0\r\n"

headers={"Content-Type": 'text/xml',
        "Transfer-Encoding": 'chunked' }

h1 = httplib.HTTPConnection('charm.phys.sfu.ca',7112)
h1.connect()


h1.request('POST','/SSSRMAP',msg,headers)

r1=h1.getresponse()

h1.close()


More information about the gold-users mailing list