Esempio n. 1
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