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.