[ptt-users] [TestMaker 4.4] SOAP Protocol Authentication
Ðavîd Låndïs
dlandis at gmail.com
Wed Feb 21 11:27:29 PST 2007
Hi Frank,
Thanks for your help. I have used the setUsername and setPassword methods
like so:
=================================================
self.protocol = ProtocolHandler.getProtocol("soap")
self.body = SOAPBody()
self.protocol.setBody(self.body)
self.protocol.setUrl("
http://localhost:8081/opv/services/SimpleDataService")
self.protocol.setUsername("user")
self.protocol.setPassword("pass")
===================================================
Using the network monitor as you suggested, I have included the saved
content at the bottom of the mail.
I need an additional header like the last line I added in bold which is not
there in the saved content:
DESIRED HEADER:
POST /opv/services/SimpleDataService HTTP/1.0
Host: 127.0.0.1
Content-Type: text/xml;charset=utf-8
Content-Length: 350
SOAPAction: ""
Accept-Encoding: gzip
Authorization: Basic dGVzdGVkaXRvcjpUZXN0MTI=
NETWORK MONITOR OUTPUT:
==============
Listen Port: 8081
Target Host: 127.0.0.1
Target Port: 8080
==== Request ====
POST /opv/services/SimpleDataService HTTP/1.0
Host: 127.0.0.1
Content-Type: text/xml;charset=utf-8
Content-Length: 350
SOAPAction: ""
Accept-Encoding: gzip
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="
http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<getEvent xmlns="
http://localhost:8080/opv/services/SimpleDataService"/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
==== Response ====
HTTP/1.1 401 No authentication information provided.
Set-Cookie: JSESSIONID=01063607E05B0FB04D3F20E3FFBF67B6; Path=/opv
WWW-Authenticate: Basic realm="Contacts Realm"
Content-Type: text/html;charset=utf-8
Content-Length: 1071
Date: Wed, 21 Feb 2007 19:19:35 GMT
Server: Apache-Coyote/1.1
Connection: close
<html>
<head>
<title>Apache Tomcat/5.0.28 - Error report</title>
<style>
<!--H1
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
H2
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}
H3
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}
BODY
{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
P
{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A
{color : black;}A.name {color : black;}HR {color : #525D76;}--></style>
</head>
<body>
<h1>HTTP Status 401 - No authentication information provided.</h1>
<HR size="1" noshade="noshade">
<p>
<b>type</b> Status report
</p>
<p>
<b>message</b>
<u>No authentication information provided.</u>
</p>
<p>
<b>description</b>
<u>This request requires HTTP authentication (No
authentication information provided.).</u>
</p>
<HR size="1" noshade="noshade">
<h3>Apache Tomcat/5.0.28</h3>
</body>
</html>
==============
On 2/20/07, Frank Cohen <fcohen at pushtotest.com> wrote:
>
> Hi David: The self.protocol.setUsername and setPassword methods are
> the correct way to use SOAP basic authentication. Perhaps there is
> something else wrong. Is the SOAP service available over the public
> Internet? If so, please send it and I will look into it. Otherwise,
> use the Network Monitor and send me a trace of the network
> conversation between TestMaker and the service. Thanks. -Frank
>
>
>
>
> On Feb 8, 2007, at 10:56 AM, Ðavîd Låndïs wrote:
>
> > 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
> >
> >
> >
> >
> >
> > _______________________________________________
> > Users mailing list
> > Users at lists.pushtotest.com
> > http://lists.pushtotest.com/mailman/listinfo/users
>
>
>
> --
> Frank Cohen, PushToTest, http://www.PushToTest.com, phone 408 374 7426
> TestMaker: The open-source SOA test automation tool
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.pushtotest.com
> http://lists.pushtotest.com/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cake.pushtotest.com/pipermail/users/attachments/20070221/eda8af51/attachment-0001.htm
More information about the Users
mailing list