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

Funktionierender SOAP-Server mit einer Methode

File:
1 edited

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
Note: See TracChangeset for help on using the changeset viewer.