Пример #1
0
 def message_to_axiom(self, message):
     str_to_om = None
     if isinstance(message, str):
         str_to_om = message
     else:
         WSFC.axis2_log_error(self.env, "[wsf-python] Payload is not a string.")
         return None
     
     return WSFC.wsf_str_to_axiom_node(self.env, str_to_om, len(str_to_om))
Пример #2
0
 def axiom_to_str(self, axiom):
     str = WSFC.axiom_node_to_string(axiom, self.env)
     
     if str is None:
         WSFC.axis2_log_error(self.env, "[wsf-python] Error converting axion to string.")
         return None
     else:
         return str
     
     pass
Пример #3
0
    def get_proxy(self, service_name=None, port_name=None):
        if self.options is None:
            WSFC.axis2_log_error(self.env, "[wsf-python] Options to client cannot be NULL.")
            return None

        if self.options.has_key(WSFC.WSF_CP_WSDL):
            wsdl = self.options[WSFC.WSF_CP_WSDL]
            proxy = WSProxy(self.env, self.service_client, self.options, str(wsdl), service_name, port_name) 
            return proxy
        else:
            WSFC.axis2_log_error(self.env, "[wsf-python] WSDL is not specified.")
            return None
Пример #4
0
 def request(self, message):
     to = None
     use_soap = None
     last_fault_e = None
     
     if self.service_client is None:
         WSFC.axis2_log_error(self.env, "[wsf-python] Service client is null.")
         return None
     
     client_options = WSFC.axis2_svc_client_get_options(self.service_client, \
                         self.env)
     
     # Get the end point address from client options.
     if self.options.has_key(WSFC.WSF_MP_TO):
          to = self.options[WSFC.WSF_MP_TO]
     
     if to is None:
         WSFC.axis2_log_error(self.env, "[wsf-python] End point not specified.")
         return None
     
     to_epr = WSFC.axis2_endpoint_ref_create(self.env, to)
     WSFC.axis2_options_set_to(client_options, self.env, to_epr)
     
     request_axiom = self.message_to_axiom(message)
     if request_axiom is None:
         WSFC.axis2_log_error(self.env, "[wsf-python] Failed to create AXIOM")
         return None
     
     WSFC.axis2_options_set_xml_parser_reset(client_options, self.env, WSFC.AXIS2_FALSE)
     
     if self.options.has_key(WSFC.WSF_CP_USE_SOAP):
         use_soap = self.options[WSFC.WSF_CP_USE_SOAP].upper()
     else:
         use_soap = 'TRUE'
     
     if use_soap != 'FALSE':
         if self.options.has_key(WSFC.WSF_MP_ACTION):
             action = self.options[WSFC.WSF_MP_ACTION]
             soap_action  = WSFC.axutil_string_create(self.env, action)
             WSFC.axis2_options_set_soap_action(client_options, self.env,\
                             soap_action)
             
     response_axiom = WSFC.axis2_svc_client_send_receive(self.service_client,\
                             self.env, request_axiom)
     
     if WSFC.axis2_svc_client_get_last_response_has_fault(self.service_client,\
                             self.env) == WSFC.AXIS2_TRUE:
         last_fault_e = self.last_fault_exception() 
         if last_fault_e is None:
             raise WSFault("SOAP-FAULT-ERROR", "Malformatted SOAP fault message")
         else:
             raise last_fault_e
     else:
         if response_axiom is None:
             raise WSFault("NULL-REPLY", "No response from the server")
         else:
             return self.axiom_to_str(response_axiom)         
     pass