Changeset 1696


Ignore:
Timestamp:
14/11/06 13:02:01 (13 years ago)
Author:
pjkersha
Message:

Working test code for ZSI Web Service using Twisted:

  • for server, used wsdl2dispatch - but make sure to edit the return types

in AttAuthority_services_server server class stubs to return request, response
tuple as required by Twisted interface. Created .tac file which loads a
sub class of the wsdl2dispatch generated class.

  • tested with standard ZSI client using stubs generated from wsdl2py. Also

tested with Twisted client - stubs generated with wsdl2py including the -w
option.

Location:
TI12-security/trunk/python/Tests
Files:
12 added
6 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/python/Tests/Echo/EchoClient.py

    r1664 r1696  
    1 #!/bin/env python 
     1#!/usr/bin/env python 
    22# 
    33# Exampe echo client, to show extended code generation in ZSI 
     
    3030        if isEchoRequest(sw): 
    3131            if self.sigHandler: 
    32                 pass#self.sigHandler.sign(sw) 
     32                self.sigHandler.sign(sw) 
    3333        else:     
    3434            if self.encrHandler: 
     
    6868         
    6969# Instantiate a client proxy object, then call it 
    70 echoSrv = EchoServerSOAP("http://192.100.78.234:9081/EchoServiceWeb/services/EchoServer", 
     70#wsURL = "http://192.100.78.234:9081/EchoServiceWeb/services/EchoServer" 
     71wsURL = "http://localhost:7100" 
     72echoSrv = EchoServerSOAP(wsURL, 
    7173                         sig_handler=wsseHandler, 
    7274                         tracefile=sys.stdout) 
  • TI12-security/trunk/python/Tests/Echo/EchoServer.py

    r1634 r1696  
    1 #!/bin/env python 
     1#!/usr/bin/env python 
    22# 
    33# How to build an echo server using the extended code generation 
     
    2121psBodyChildName = lambda ps: \ 
    2222    ps.dom.childNodes[1].childNodes[1].childNodes[0].localName 
     23 
     24priKeyPwd = None 
     25certFilePath = '../webSphereTestcert.pem' 
     26priKeyFilePath = '../webSphereTestkey.pem' 
     27 
    2328     
    2429# Create a Server implementation 
     
    5358         
    5459        self.signatureHandler = wsSecurity.SignatureHandler(\ 
    55                                     certFilePath='../Junk-cert.pem', 
    56                                     priKeyFilePath='../Junk-key.pem', 
    57                                     priKeyPwd=open('../tmp2').read().strip()) 
     60                                    certFilePath=certFilePath, 
     61                                    priKeyFilePath=priKeyFilePath, 
     62                                    priKeyPwd=priKeyPwd) 
    5863 
    5964        self.encryptionHandler = wsSecurity.EncryptionHandler(\ 
    60                                     certFilePath='../Junk-cert.pem', 
    61                                     priKeyFilePath='../Junk-key.pem', 
    62                                     priKeyPwd=open('../tmp2').read().strip()) 
     65                                    certFilePath=certFilePath, 
     66                                    priKeyFilePath=priKeyFilePath, 
     67                                    priKeyPwd=priKeyPwd) 
    6368         
    6469         
  • TI12-security/trunk/python/Tests/Echo/EchoServer_client.py

    r1664 r1696  
    1515# Locator 
    1616class EchoServerLocator: 
    17     EchoServer_address = "http://localhost:9081/EchoServiceWeb/services/EchoServer" 
     17    EchoServer_address = "http://localhost:7100" 
    1818    def getEchoServerAddress(self): 
    1919        return EchoServerLocator.EchoServer_address 
     
    3030        # no ws-addressing 
    3131 
    32     # op: <ZSI.wstools.WSDLTools.Message instance at 0xb6e8fe6c> 
     32    # op: <ZSI.wstools.WSDLTools.Message instance at 0xb77f40ec> 
    3333    def Echo(self, EchoIn): 
    3434 
     
    4444        return EchoResult 
    4545 
    46     # op: <ZSI.wstools.WSDLTools.Message instance at 0xb6e9466c> 
     46    # op: <ZSI.wstools.WSDLTools.Message instance at 0xb77f48cc> 
    4747    def EchoEncr(self, EchoIn): 
    4848 
  • TI12-security/trunk/python/Tests/Echo/EchoServer_interface.py

    r1664 r1696  
    1414<definitions targetNamespace=\"urn:ZSI:examples\" xmlns=\"http://schemas.xmlsoap.org/wsdl/\" xmlns:http=\"http://schemas.xmlsoap.org/wsdl/http/\" xmlns:soap=\"http://schemas.xmlsoap.org/wsdl/soap/\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:tns=\"urn:ZSI:examples\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"> 
    1515  <types> 
    16     <xsd:schema elementFormDefault=\"qualified\" targetNamespace=\"urn:ZSI:examples\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"> 
     16  <xsd:schema elementFormDefault=\"qualified\" targetNamespace=\"urn:ZSI:examples\"> 
    1717      <xsd:element name=\"Echo\"> 
    1818        <xsd:complexType> 
     
    4545  </xsd:schema> 
    4646  </types> 
    47   <message name=\"EchoEncrRequest\"> 
    48     <part element=\"tns:EchoEncr\" name=\"parameters\"/> 
     47 
     48  <message name=\"EchoRequest\"> 
     49    <part element=\"tns:Echo\" name=\"parameters\"/> 
    4950  </message> 
    5051  <message name=\"EchoResponse\"> 
    5152    <part element=\"tns:EchoResponse\" name=\"parameters\"/> 
    5253  </message> 
    53   <message name=\"EchoRequest\"> 
    54     <part element=\"tns:Echo\" name=\"parameters\"/> 
     54  <message name=\"EchoEncrRequest\"> 
     55    <part element=\"tns:EchoEncr\" name=\"parameters\"/> 
    5556  </message> 
    5657  <message name=\"EchoEncrResponse\"> 
    5758    <part element=\"tns:EchoEncrResponse\" name=\"parameters\"/> 
    5859  </message> 
     60 
    5961  <portType name=\"EchoServer\"> 
    6062    <operation name=\"Echo\"> 
     
    6769    </operation> 
    6870  </portType> 
     71 
    6972  <binding name=\"EchoServer\" type=\"tns:EchoServer\"> 
    7073    <soap:binding style=\"document\" transport=\"http://schemas.xmlsoap.org/soap/http\"/> 
    7174    <operation name=\"Echo\"> 
    7275      <soap:operation soapAction=\"Echo\"/> 
    73       <input> 
    74         <soap:body use=\"literal\"/> 
    75       </input> 
    76       <output> 
    77         <soap:body use=\"literal\"/> 
    78       </output> 
     76        <input> 
     77          <soap:body use=\"literal\"/>  
     78        </input> 
     79        <output> 
     80          <soap:body use=\"literal\"/>  
     81        </output> 
    7982    </operation> 
    8083    <operation name=\"EchoEncr\"> 
    8184      <soap:operation soapAction=\"EchoEncr\"/> 
    82       <input> 
    83         <soap:body use=\"literal\"/> 
    84       </input> 
    85       <output> 
    86         <soap:body use=\"literal\"/> 
    87       </output> 
     85        <input> 
     86          <soap:body use=\"literal\"/>  
     87        </input> 
     88        <output> 
     89          <soap:body use=\"literal\"/>  
     90        </output> 
    8891    </operation> 
    8992  </binding> 
     93 
    9094  <service name=\"EchoServer\"> 
    9195    <port binding=\"tns:EchoServer\" name=\"EchoServer\"> 
    92       <soap:address location=\"http://localhost:9080/EchoServiceWeb/services/EchoServer\"/> 
     96      <soap:address location=\"http://localhost:7100\"/> 
    9397    </port> 
    9498  </service> 
     99 
    95100</definitions>""" 
    96101 
    97     def __init__(self, post='/EchoServiceWeb/services/EchoServer', **kw): 
     102    def __init__(self, post='', **kw): 
    98103        ServiceSOAPBinding.__init__(self, post) 
    99104        if kw.has_key('impl'): 
  • TI12-security/trunk/python/Tests/Echo/EchoServer_services_types.py

    r1634 r1696  
    77import ZSI 
    88import ZSI.TCcompound 
    9 from ZSI.TC import ElementDeclaration,TypeDefinition 
    10 from ZSI.TC import _get_type_definition as GTD, _get_global_element_declaration as GED 
     9from ZSI.schema import LocalElementDeclaration, ElementDeclaration, TypeDefinition, GTD, GED 
    1110 
    1211############################## 
     
    1918 
    2019    class Echo(ZSI.TCcompound.ComplexType, ElementDeclaration): 
     20        literal = "Echo" 
    2121        schema = "urn:ZSI:examples" 
    22         literal = "Echo" 
    2322        def __init__(self, **kw): 
    2423            ns = urn_ZSI_examples.Echo.schema 
     
    2726            kw["aname"] = "Echo" 
    2827            self.attribute_typecode_dict = {} 
    29             ZSI.TCcompound.ComplexType.__init__(self, None, TClist, inorder=0, **kw) 
     28            ZSI.TCcompound.ComplexType.__init__(self,None,TClist,inorder=0,**kw) 
    3029            class Holder: 
    3130                typecode = self 
     
    3837 
    3938    class EchoResponse(ZSI.TCcompound.ComplexType, ElementDeclaration): 
     39        literal = "EchoResponse" 
    4040        schema = "urn:ZSI:examples" 
    41         literal = "EchoResponse" 
    4241        def __init__(self, **kw): 
    4342            ns = urn_ZSI_examples.EchoResponse.schema 
     
    4645            kw["aname"] = "EchoResponse" 
    4746            self.attribute_typecode_dict = {} 
    48             ZSI.TCcompound.ComplexType.__init__(self, None, TClist, inorder=0, **kw) 
     47            ZSI.TCcompound.ComplexType.__init__(self,None,TClist,inorder=0,**kw) 
    4948            class Holder: 
    5049                typecode = self 
     
    5756 
    5857    class EchoEncr(ZSI.TCcompound.ComplexType, ElementDeclaration): 
     58        literal = "EchoEncr" 
    5959        schema = "urn:ZSI:examples" 
    60         literal = "EchoEncr" 
    6160        def __init__(self, **kw): 
    6261            ns = urn_ZSI_examples.EchoEncr.schema 
     
    6564            kw["aname"] = "EchoEncr" 
    6665            self.attribute_typecode_dict = {} 
    67             ZSI.TCcompound.ComplexType.__init__(self, None, TClist, inorder=0, **kw) 
     66            ZSI.TCcompound.ComplexType.__init__(self,None,TClist,inorder=0,**kw) 
    6867            class Holder: 
    6968                typecode = self 
     
    7675 
    7776    class EchoEncrResponse(ZSI.TCcompound.ComplexType, ElementDeclaration): 
     77        literal = "EchoEncrResponse" 
    7878        schema = "urn:ZSI:examples" 
    79         literal = "EchoEncrResponse" 
    8079        def __init__(self, **kw): 
    8180            ns = urn_ZSI_examples.EchoEncrResponse.schema 
     
    8483            kw["aname"] = "EchoEncrResponse" 
    8584            self.attribute_typecode_dict = {} 
    86             ZSI.TCcompound.ComplexType.__init__(self, None, TClist, inorder=0, **kw) 
     85            ZSI.TCcompound.ComplexType.__init__(self,None,TClist,inorder=0,**kw) 
    8786            class Holder: 
    8887                typecode = self 
  • TI12-security/trunk/python/Tests/Echo/wsSecurity.py

    r1664 r1696  
    136136        # Signed Info - Canonicalization method 
    137137        signedInfoC14nKw = {} 
    138         signedInfoC14nKw['unsuppressedPrefixes'] = ['xsi', 'xsd', 'SOAP-ENV', 'ds', 'wsse'] 
     138        signedInfoC14nKw['unsuppressedPrefixes'] = ['xsi', 'xsd', 'SOAP-ENV', 'ds', 'wsse'] 
    139139        c14nMethodElem = signedInfoElem.createAppendElement(DSIG.BASE, 
    140140                                                    'CanonicalizationMethod') 
     
    195195        # Find references 
    196196        c14nKw = {} 
    197         c14nKw['unsuppressedPrefixes'] = ['xmlns', 'xsi', 'xsd', 'SOAP-ENV', 'wsu', 'wsse', 'ns1'] 
     197        c14nKw['unsuppressedPrefixes'] = ['xmlns', 'xsi', 'xsd', 'SOAP-ENV', 'wsu', 'wsse', 'ns1'] 
    198198        for idNode in idNodes: 
    199199             
Note: See TracChangeset for help on using the changeset viewer.