[ptt-users] [TestMaker 4.4] SOAP Protocol Authentication

Ðavîd Låndïs dlandis at gmail.com
Thu Feb 8 10:56:40 PST 2007


Hi,

I am trying to test a SOAP over HTTP service that uses Basic authentication.
The URL requires a username and password. (If you browse to the URL, you are
prompted with a simple authentication box.)

I have modified the "SOAP_Message_Example.py" script to work with my service
when authentication is turned off, but now how do I send the
username/password? I have tried:

............
self.protocol = ProtocolHandler.getProtocol("soap")
self.protocol.setBody(self.body)
self.protocol.setUrl("http://localhost:8080/services/DataService")
self.protocol.setUsername("user")
self.protocol.setPassword("password")
..........

but the server does not accept this (HTTP error 401). When coding a client
in Java I set the user/pass inside the SOAP stub header. So I have also
tried to mirror that:

.....
self.header = SOAPHeader()
self.header.set("javax.xml.rpc.security.auth.username", "user")
self.header.set("javax.xml.rpc.security.auth.password", "pass")
self.protocol.setHeader(self.header)
........

but then there is a client error (server never accessed):

java.lang.NullPointerException
    at com.pushtotest.tool.protocolhandler.SOAPProtocol.soapDocCall(
SOAPProtocol.java:467)
    at com.pushtotest.tool.protocolhandler.SOAPProtocol.connect(
SOAPProtocol.java:253)
    at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java
)
    at org.python.core.PyMethod.__call__(PyMethod.java)
    at org.python.core.PyObject.__call__(PyObject.java:258)
    at org.python.core.PyInstance.invoke(PyInstance.java)
    at org.python.pycode._pyx137.runTest$4(<string>:71)
    at org.python.pycode._pyx137.call_function(<string>)
    at org.python.core.PyTableCode.call(PyTableCode.java)
    at org.python.core.PyTableCode.call(PyTableCode.java)
    at org.python.core.PyFunction.__call__(PyFunction.java)
    at org.python.core.PyInstance.invoke(PyInstance.java)
    at org.python.pycode._pyx137.f$0(<string>:120)
    at org.python.pycode._pyx137.call_function(<string>)
    at org.python.core.PyTableCode.call(PyTableCode.java)
    at org.python.core.PyCode.call(PyCode.java)
    at org.python.core.Py.runCode(Py.java)
    at org.python.core.Py.exec(Py.java)
    at org.python.util.PythonInterpreter.exec(PythonInterpreter.java)
    at com.pushtotest.testmaker.gui.AgentRunner.run(Unknown Source)

java.lang.NullPointerException: java.lang.NullPointerException
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cake.pushtotest.com/pipermail/users/attachments/20070208/0ce3f105/attachment.htm


More information about the Users mailing list