Changeset 836 for vanHelsing/trunk


Ignore:
Timestamp:
Mar 12, 2010, 2:28:51 PM (15 years ago)
Author:
slederer
Message:

Funktionierender SOAP-Server mit einer Methode

Location:
vanHelsing/trunk/src
Files:
2 edited
1 moved

Legend:

Unmodified
Added
Removed
  • vanHelsing/trunk/src/VanHelsingServer.py

    r826 r836  
    22from ZSI.schema import LocalElementDeclaration, ElementDeclaration, TypeDefinition, GTD, GED
    33from VanHelsing_server import VanHelsing
     4from VanHelsing_types import ns0
     5import VanHelsingWrapper
     6import sys
    47
    58ResourceInfo= GTD("http://www.dass-it.de/VanHelsing/", "ResourceInfo")(None).pyclass()
    6 print ResourceInfo
     9listResourcesType= GTD("http://www.dass-it.de/VanHelsing/", "listResourcesType")(None).pyclass()
     10#print dir(ResourceInfo)
    711
    812class VanSOAPRequestHandler(SOAPRequestHandler):
     
    2327    def soap_listResources(self, ps, **kw):
    2428        request,response=VanHelsing.soap_listResources(self,ps)
    25         resInf=ResourceInfo()
    26         response._resourceList=[ resInf ]
    2729
    28         print response._resourceList
     30        resType=request.get_element_resourceType()
     31        resDirector=request.get_element_director()
     32       
     33        result=VanHelsingWrapper.getResources(resDirector,resType)
     34
     35        rList=[]
     36
     37        for rid,name in result:
     38
     39            resInf=response.new_resourceList()
     40            resInf.set_element_director(resDirector)
     41            resInf.set_element_resId(rid)
     42            resInf.set_element_resType(resType)
     43            resInf.set_element_resName(name)
     44            rList.append(resInf)
     45
     46        response.set_element_resourceList(rList)
     47
    2948        return request,response
    3049
    3150if 1:
     51    if len(sys.argv) < 2:
     52        filename="test.conf"
     53    else:
     54        filename=sys.argv[1]   
     55
     56    VanHelsingWrapper.loadDirectorConfig(filename)
     57
    3258    AsServer(port=8080,services=[ RealVanHelsing() ], RequestHandlerClass=VanSOAPRequestHandler)
    3359
  • vanHelsing/trunk/src/VanHelsingWrapper.py

    r835 r836  
    55import directive
    66import ResourceInfo
    7 
    8 import ZSI
    9 import ZSI.dispatch
    107
    118import sys
     
    8582    return dirdcfg.getRoot().getByName(name,resType)[0]   
    8683
    87 def listResources(listResourcesType):
    88     print listResourcesType
    89     return [ r1,r2 ]
    90 
    9184# main
    9285if __name__ == "__main__":
     
    10093    print getResources("bacula-dir","Client")
    10194
    102     ZSI.dispatch.AsServer(port=8080,docstyle=True)
  • vanHelsing/trunk/src/bcfg.py

    r835 r836  
    159159#
    160160# nur zum Testen
    161 from VanHelsingSOAP import *
     161from VanHelsingWrapper import *
    162162
    163163if __name__ == "__main__":
Note: See TracChangeset for help on using the changeset viewer.