Changeset 6a8a9ec


Ignore:
Timestamp:
Feb 16, 2010 9:18:22 AM (15 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
Children:
2fdf4b3
Parents:
c3a3fe3
Message:

Put a few more escapes in here to let the code be used with non-SOAP
non-autogenerated XMLRPC services.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/remote_service.py

    rc3a3fe3 r6a8a9ec  
    270270class service_caller(remote_service_base):
    271271    def __init__(self, service_name, request_message=None,
    272             request_body_name=None, tracefile=None):
     272            request_body_name=None, tracefile=None, strict=True):
    273273        self.service_name = service_name
    274274
     
    287287                    getattr(fedd_services, request_message_name, None) or \
    288288                    getattr(fedd_internal_services, request_message_name, None)
    289             if not self.request_message:
     289            if not self.request_message and strict:
    290290                raise service_error(service_error.internal,
    291291                        "Cannot find class for %s" % request_message_name)
    292292
    293         if request_body_name: self.request_body_name = request_body_name
    294         else: self.request_body_name = "%sRequestBody" % service_name
     293        if request_body_name is not None:
     294            self.request_body_name = request_body_name
     295        else:
     296            self.request_body_name = "%sRequestBody" % service_name
    295297
    296298        self.tracefile = tracefile
     
    343345        try:
    344346            remote_method = getattr(port, self.service_name, None)
    345             resp = remote_method(self.apply_to_tags(\
    346                     { self.request_body_name: r}, self.encap_fedids))
     347            if self.request_body_name:
     348                resp = remote_method(self.apply_to_tags(\
     349                        { self.request_body_name: r}, self.encap_fedids))
     350            else:
     351                resp = remote_method(self.apply_to_tags(r, self.encap_fedids))
    347352        except socket_error, e:
    348353            raise service_error(service_error.connect,
     
    369374
    370375        tf = tracefile or self.tracefile or None
     376
     377        if not self.request_body_name:
     378            raise service_error(service_error.internal,
     379                    "Call to soap service without a configured request body");
    371380
    372381        # If a context is given, use it.  Otherwise construct one from
Note: See TracChangeset for help on using the changeset viewer.