Suds and Cookie Authentication
by Chris Brogan
Hi,
I have successfully managed to get suds up and running on my Plone
instance and can consume a variety of services. However, I'm having
trouble with authentication on a collection of services that seem to
be .NET-centric and aren't playing nicely.
I'll try to explain this as clearly as possible so, please, bear with
me:
Having imported suds and various libraries, the various the following
works as expected:
client = Client('http://servername/AppNet/Tools/ToolsWS/AuthenticationService.asmx?WSDL')
auth = client.service.Login(username='user',password='pass')
return auth
>>> True
Similarly,
client = Client('http://servername/AppNet/Tools/ToolsWS/AuthenticationService.asmx?WSDL')
client.service.Login(username='cms',password='123')
res = client.service.WhoAmI()
return res
>>> user
So, all is well there...I can successfully connect and log in.
Moving on to the other web services (same server), I can can
information about them via:
client = Client('http://servername/AppNet/Tools/ToolsWS/AuthenticationService.asmx?WSDL')
client.service.Login(username='cms',password='123')
client.service.WhoAmI()
client = Client('http://uservername/AppNet/Time/TimeWS/ActionService.asmx?wsdl')
return client
>>>
Suds ( https://fedorahosted.org/suds/ ) version: 0.3.6 GA build:
R526-20090624
Service ( ActionService ) tns="http://cmsopen.com/"
Prefixes (1)
ns0 = "http://cmsopen.com/"
Ports (2):
(ActionServiceSoap)
Methods (2):
Read(xs:string filter, )
ReadSingle(xs:string actionCode, )
Types (3):
ActionData
ActionDataBase
ArrayOfActionData
(ActionServiceSoap12)
Methods (2):
Read(xs:string filter, )
ReadSingle(xs:string actionCode, )
Types (3):
ActionData
ActionDataBase
ArrayOfActionData
This provides information relating to the available services and the
result is obviously the same with or without the first 3 lines of
authenticating code as nothing of any importance is being asked.
However, when I try to do something useful with the services ...eg:
client = Client('http://servername/AppNet/Tools/ToolsWS/AuthenticationService.asmx?WSDL')
client.service.Login(username='cms',password='123')
client.service.WhoAmI()
client = Client('http://servername/AppNet/Time/TimeWS/ActionService.asmx?wsdl')
result = client.service.ReadSingle('0NCHG')
return result
I get authentication errors...
Server raised fault: 'System.Web.Services.Protocols.SoapException:
Server was unable to process request. --->
System.Security.SecurityException: Request for principal permission
failed. at
System
.Security.Permissions.PrincipalPermission.ThrowSecurityException() at
System.Security.Permissions.PrincipalPermission.Demand() at
System.Security.PermissionSet.DemandNonCAS() at
Solution6.Cio.Time.ActionService.ReadSingle(String actionCode) The
action that failed was: Demand The type of the first permission that
failed was: System.Security.Permissions.PrincipalPermission The first
permission that failed was: <IPermission
class="System.Security.Permissions.PrincipalPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"> <Identity Authenticated="true" Role="ciouser"/> </
IPermission> The demand was for: <IPermission
class="System.Security.Permissions.PrincipalPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"> <Identity Authenticated="true" Role="ciouser"/> </
IPermission> The assembly or AppDomain that failed was: mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ---
End of inner exception stack trace ---'
Now, this seems to be because when the AuthenticationService.asmx
service is run in a .NET environment (which I know very little
about!), the object is attributed with a cookie using CookieContainer
which can then get passed into subsequent calls.
However, there doesn't seem to be any transparent way to grab this
cookie from the various authentication services (they tend to return
booleans) so that I can then try to get to grips with trying to pass
is to subsequent services so I'm pretty much stuck. Does anyone have
any pointers?
Chris
www.begbies-traynorgroup.com
CONFIDENTIALITY : This email and its attachments are confidential to the intended recipient. They may not be used by, disclosed to or copied in any way to anyone other than the intended recipient. If this email is received in error, please contact Begbies Traynor Group IT Department on +44 (0)161 837 1837, provide details of the sender and the address to which it has been sent and then delete it. Opinions, conclusions and other statements and information in this message that do not relate to the official business of the legal entity which sent it or any other entity within the Begbies Traynor Group shall be understood as neither given nor endorsed by them.
VIRUSES : Although we have taken steps to ensure that this email and any attachments are free from any virus, it is your responsibility to check that they are actually virus free. We do not accept any responsibility for viruses. This message has been scanned for viruses by MailControl.
14 years, 9 months
unrepentant
by Anglen
How to Make Love nad Give Yuor Woman Stunning Orgasms by Overcoming This Obstacle.www .re91.com
14 years, 9 months
commodes
by Bergh
Hxow To Do It All Night Long - Drive Her Wild And Be Absolutely Mgind Blowing.www[dot]te26[dot]com
14 years, 9 months
weirs
by seagull
How to Make Woemn Happy inn Bed - Part II.www[dot]nu26[dot]com
14 years, 9 months
breakables
by Loveless Stadel
Rjandom sex for a Chagne.www[dot]ku17[dot]net
14 years, 9 months
precompose
by Palisi Wickes
Kama Sutra sex Psoition - Enjoy The Best sex With This Positiion.www[dot]meds25[dot]com
14 years, 9 months
insecticidal
by pipal
The Single Most Stunning Way to Make Her Orgasm -- She Would Almost Scream & Cvry With Pleasure!.www[dot]shop29[dot]net
14 years, 9 months
antiproton
by soviets
AA Mcan's Guide to Buying a sex Toy.www[dot]med95[dot]net
14 years, 9 months
monozygotic
by Nading
Better sexual Satisfcation Herbs oFr Men and Women to Increase Desire and Satisfaction.www[dot]mu77[dot]net
14 years, 9 months
Array confusion
by William R. Dickson
I apologize again for what is I'm sure a very basic question.
A service (is that the right term?) is listed as wanting the following:
createEmailClient(ns1:ArrayOfInt offerIDs, xs:string emailDomain,
xs:string webmailHostname, )
This'll be my first attempt at a complex type, I guess. Although it's
asking for an array, there's only one value. I tried the following
based on some google searching:
offer_array = self.client.factory.create('ns1:ArrayOfInt')
offer_array.offer = '9999'
print offer_array
self.client.service.createEmailClient(offerIDs=offer_array,
emailDomain=domain, webmailHostname=hostname)
This results in the following:
(ArrayOfInt){
_arrayType = ""
_offset = ""
_id = ""
_href = ""
offer = "9999"
}
...followed by the following error:
File "/Users/wrd/Scripts/mailthing3/Modules/ev1.py", line 57, in
Create_Client
self.client.service.createEmailClient(offerIDs=offer_array,
emailDomain=domain, webmailHostname=hostname)
File "build/bdist.macosx-10.5-i386/egg/suds/client.py", line 240,
in __call__
File "build/bdist.macosx-10.5-i386/egg/suds/client.py", line 379,
in call
File "build/bdist.macosx-10.5-i386/egg/suds/client.py", line 240,
in __call__
File "build/bdist.macosx-10.5-i386/egg/suds/client.py", line 422,
in call
File "build/bdist.macosx-10.5-i386/egg/suds/client.py", line 480,
in invoke
File "build/bdist.macosx-10.5-i386/egg/suds/client.py", line 511,
in send
File "build/bdist.macosx-10.5-i386/egg/suds/client.py", line 562,
in failed
File "build/bdist.macosx-10.5-i386/egg/suds/bindings/binding.py",
line 227, in get_fault
suds.WebFault: Server raised fault:
'java.lang.IllegalArgumentException: argument type mismatch'
I assume I'm constructing the array incorrectly. Any suggestions would
be much appreciated.
Thanks,
-Bill
14 years, 9 months