Exemple #1
0
            def callback(context, method_name, ob):
                """ context: pyramid config scan
                    method_name: str name of function
                    ob: function object
                """
                # Add action
                method = xsd.Method(function=ob,
                                    soapAction=_api_kw['soapAction'],
                                    input=_api_kw['input'],
                                    output=_api_kw['output'],
                                    operationName=_api_kw['operationName'])
                self.methods.append(method)

                config = context.config.with_package(info.module)

                # setup the services hash if it isn't already
                services = config.registry.setdefault('soap_services', {})
                if self.index == -1:
                    self.index = len(services)

                # define the route (and view) if it isn't already
                if self.route_pattern not in services:
                    services[self.route_pattern] = self
                    route_kw = {}
                    if self.factory is not None:
                        route_kw["factory"] = self.factory
                    elif self.acl_factory is not None:
                        route_kw["factory"] = self._make_route_factory()
                    config.add_route(self.route_name, self.route_pattern,
                                     **route_kw)

                    view_kw = _api_kw.copy()
                    for arg in _SOAP_ARGS:
                        view_kw.pop(arg, None)

                    # method decorators
                    if 'attr' in view_kw:

                        @functools.wraps(getattr(ob, kw['attr']))
                        def view(request):
                            meth = getattr(ob(request), kw['attr'])
                            return meth()

                        del view_kw['attr']
                        view = functools.partial(call_service, view,
                                                 self._api_kw)
                    else:
                        view = functools.partial(call_service, ob,
                                                 self._api_kw)

                    # set the module of the partial function
                    setattr(view, '__module__', getattr(ob, '__module__'))

                    config.add_view(view=view,
                                    route_name=self.route_name,
                                    **view_kw)
def _echo_service(handler=None, input_header=None, output_header=None):
    if handler is None:
        handler, handler_state = _echo_handler()

    EchoSchema = xsd.Schema(
        'http://soap.example/echo/types',
        elementFormDefault=xsd.ElementFormDefault.UNQUALIFIED,
        simpleTypes=(InputVersion, OutputVersion),
        complexTypes=(EchoType, InputHeader, OutputHeader),
        elements={
            'echoRequest': xsd.Element(EchoType),
            'echoResponse': xsd.Element(EchoType),
            'InputVersion': xsd.Element(InputVersion),
            'OutputVersion': xsd.Element(OutputVersion),
        },
    )
    echo_method = xsd.Method(
        function=handler,
        soapAction='echo',
        input='echoRequest',
        inputPartName='input_',
        input_header=input_header,
        output='echoResponse',
        output_header=output_header,
        outputPartName='result',
        operationName='echoOperation',
    )
    return soap.Service(
        name='TestService',
        targetNamespace='http://soap.example/echo',
        location='http://soap.example/ws',
        schema=EchoSchema,
        version=soap.SOAPVersion.SOAP11,
        methods={
            'echo': echo_method,
        },
    )
        FastaType, ResultsResponseTypeWrapper, ResultsResponseType,
        PredictorsType, PredictorType, PositionsType, PosType
    ],
    elements={
        'doSHMR': xsd.Element('FastaType'),
        'doSHMRResponse': xsd.Element('ResultsResponseTypeWrapper')
    },
)

################################################################################
# Methods

doSHMR_method = xsd.Method(
    soapAction='shmr#doSHMR',
    input='doSHMR',
    inputPartName='parameters',
    output='doSHMRResponse',
    outputPartName='parameters',
    operationName='doSHMR',
)

################################################################################
# SOAP Service

IBIVU_Port_SERVICE = soap.Service(
    name='IBIVU_Port',
    targetNamespace='shmr',
    location='%(scheme)s://%(host)s/cgi-bin/shmr_srv.pl',
    schema=Schema_4c1ac,
    version=soap.SOAPVersion.SOAP11,
    methods=[doSHMR_method],
)
Exemple #4
0
      elements={"getStockPrice": xsd.Element("GetStockPrice"),
                  "stockPrice": xsd.Element("StockPrice")}
)


def get_stock_price(request, gsp):
    print gsp.company, gsp.datetime
    sp = StockPrice(nillable=xsd.NIL)
    sp.prices.append(13.29)
    sp.prices.append(4.56)
    sp.prices.append(xsd.NIL)
    return sp

get_stock_price_method = xsd.Method(
    function=get_stock_price,
    soapAction="http://code.google.com/p/soapbox/stock/get_stock_price",
    input="getStockPrice",
    output="stockPrice",
    operationName="GetStockPrice")


SERVICE11 = soap.Service(
    name="StockService",
    targetNamespace="http://code.google.com/p/soapbox/stock.wsdl",  # WSDL targetNamespce
    version=SOAPVersion.SOAP11,
    # The url were request should be send.
    location="http://127.0.0.1:8000/stock/soap11",
    schema=Schema,
    methods=[get_stock_price_method])


SERVICE12 = soap.Service(
Exemple #5
0
Schema = xsd.Schema(targetNamespace="http://flightdataservices.com/ops.xsd",
                    elementFormDefault="unqualified",
                    simpleTypes=[Pilot],
                    attributeGroups=[],
                    groups=[],
                    complexTypes=[Airport, Weight, Ops, Status],
                    elements={
                        "ops": xsd.Element("Ops"),
                        "status": xsd.Element("Status")
                    })

PutOps_method = xsd.Method(
    soapAction="http://polaris.flightdataservices.com/ws/ops/PutOps",
    input="ops",  # Pointer to Schema.elements
    inputPartName="body",
    output="status",  # Pointer to Schema.elements
    outputPartName="body",
    operationName="PutOps")

PutOpsPort_SERVICE = soap.Service(
    name="PutOpsPort",
    targetNamespace="http://flightdataservices.com/ops.wsdl",
    location="http://127.0.0.1:8088/mockPutOpsBinding",
    schema=Schema,
    version=soap.SOAPVersion.SOAP11,
    methods=[PutOps_method])


class PutOpsPortServiceStub(soap.Stub):
    SERVICE = PutOpsPort_SERVICE
Exemple #6
0
                return [
                    None, storageMediumID
                ], 3, 'storageMediumID %s not found! dbres: %s , why: %s' % (
                    storageMediumID, str(rows), str(why))
        else:
            return [None, 'none'], 1, str(why)


################################################################################
# Methods

storagelogistics_method = xsd.Method(
    function=storagelogistics,
    soapAction=
    'http://ESSArch_Instance.ra.se/StorageLogisticsService/storagelogistics',
    input='storagelogisticsRequest',
    inputPartName='parameters',
    output='storagelogisticsResponse',
    outputPartName='parameters',
    operationName='storagelogistics',
)

################################################################################
# SOAP Service

StorageLogisticsService_Port_SERVICE = soap.Service(
    name='StorageLogisticsService_Port',
    targetNamespace='http://ESSArch_Instance.ra.se/StorageLogisticsService',
    location='%(scheme)s://%(host)s/webservice/StorageLogisticsService',
    #location='http://ESSArch_Instance.ra.se/webservice/StorageLogisticsService',
    schema=Schema_55b49,
    version=soap.SOAPVersion.SOAP11,
Exemple #7
0
def PutOps(request, ops):
    '''
    '''
    # TODO: Put your implementation here.
    return status


################################################################################
# Methods


PutOps_method = xsd.Method(function=PutOps,
    soapAction='http://polaris.flightdataservices.com/ws/ops/PutOps',
    input='ops',
    inputPartName='body',
    output='status',
    outputPartName='body',
    operationName='PutOps',
)


################################################################################
# SOAP Service


PutOpsPort_SERVICE = soap.Service(
    name='PutOpsPort',
    targetNamespace='http://flightdataservices.com/ops.wsdl',
    location='%(scheme)s://%(host)s/ws/ops',
    schema=Schema_c8319,
    version=soap.SOAPVersion.SOAP11,
Exemple #8
0
        xsd.Element(TemporadasDisponiblesResponse()),
        'CategoriasDisponiblesXTemporada':
        xsd.Element(CategoriasDisponiblesXTemporada()),
        'CategoriasDisponiblesXTemporadaResponse':
        xsd.Element(CategoriasDisponiblesXTemporadaResponse())
    },
)

################################################################################
# Methods

TemporadasDisponibles_method = xsd.Method(
    soapAction='http://servicios.feb.es/serviciosWeb/TemporadasDisponibles',
    input='TemporadasDisponibles',
    inputPartName='parameters',
    output='TemporadasDisponiblesResponse',
    outputPartName='parameters',
    operationName='TemporadasDisponibles',
    style='document',
)

CategoriasDisponiblesXTemporada_method = xsd.Method(
    soapAction=
    'http://servicios.feb.es/serviciosWeb/CategoriasDisponiblesXTemporada',
    input='CategoriasDisponiblesXTemporada',
    inputPartName='parameters',
    output='CategoriasDisponiblesXTemporadaResponse',
    outputPartName='parameters',
    operationName='CategoriasDisponiblesXTemporada',
    style='document',
)