Old SOAP client uses new SOAP service with the
redirection to the new endpoint and transformation
on the server side
555623
public void useNewSOAPServiceWithOldClientAndRedirection() throws Exception {
        URL wsdlURL = getClass().getResource("/CustomerService.wsdl");
        com.example.customerservice.CustomerServiceService service = 
            new com.example.customerservice.CustomerServiceService(wsdlURL);
        
        com.example.customerservice.CustomerService customerService = 
            service.getCustomerServiceRedirectPort();

        System.out.println("Using new SOAP CustomerService with old client and the redirection");
        
        customer.v1.Customer customer = createOldCustomer("Barry Old to New SOAP With Redirection");
        customerService.updateCustomer(customer);
        customer = customerService.getCustomerByName("Barry Old to New SOAP With Redirection");
        printOldCustomerDetails(customer);
    }
1237717
def get_soap_object(self, client):
        
        record_data = super().get_soap_object(client)
        record_data.records = [Record(r).get_soap_object(client) for r in record_data.records]
        return record_data
1345466
public function __soapCall($methodName, $arguments, $options = null, $inputHeaders = null, &$outputHeaders = null)
    {
        if ($this->isFinancialMethod($methodName, $arguments)) {
            $usedMethod = $methodName;

            if ($methodName === 'AccountManagement') {
                $usedMethod .= $arguments[0]->getAction();
            }

            $operationNum = time();
            $financeToken = $this->user->createFinanceToken($usedMethod, $operationNum);

            if (!is_array($inputHeaders)) {
                $inputHeaders = [];
            }

            $inputHeaders[] = new \SoapHeader('API', 'finance_token', $financeToken);
            $inputHeaders[] = new \SoapHeader('API', 'operation_num', $operationNum);
        }

        return parent::__soapCall($methodName, $arguments, $options, $inputHeaders, $outputHeaders);
    }
614535
def fromWSDL(self, wsdl):
        '''
        '''
        assert isinstance(wsdl, WSDLTools.WSDL), 'expecting WSDL instance'

        if len(wsdl.services) == 0:
            raise WsdlGeneratorError, 'No service defined'
            
        self.reset() 
        self.wsdl = wsdl
        self.setUpHeader()
        self.setUpImports()
                
        for service in wsdl.services:
            sd = self._service_class(service.name)
            self._services[service.name] = sd

            for port in service.ports:
                desc = BindingDescription(wsdl=wsdl)
                try:
                    desc.setUp(port.getBinding())
                except Wsdl2PythonError, ex:
                    continue
                
                for soc in desc.operations:
                    if not soc.hasInput(): continue
                    
                    self.messages.append(MessageWriter())
                    self.messages[-1].setUp(soc, port, input=True)
                    if soc.hasOutput():
                        self.messages.append(MessageWriter())
                        self.messages[-1].setUp(soc, port, input=False)
                
                for e in port.extensions:
                    if isinstance(e, WSDLTools.SoapAddressBinding):
                        sd.location = e.location

                self.setUpMethods(port)

            self.setUpClassDef(service)
            self.setUpInitDef(service)
244916
public void useOldRESTServiceWithNewClient() throws Exception {
        List<Object> providers = createJAXRSProviders();

        org.customer.service.CustomerService customerService = JAXRSClientFactory
            .createFromModel("http://localhost:" + port + "/examples/direct/rest", 
                             org.customer.service.CustomerService.class,
                             "classpath:/model/CustomerService-jaxrs.xml", 
                             providers, 
                             null);
        
        // The outgoing new Customer data needs to be transformed for 
        // the old service to understand it and the response from the old service
        // needs to be transformed for this new client to understand it.
        ClientConfiguration config = WebClient.getConfig(customerService);
        addTransformInterceptors(config.getInInterceptors(),
                                 config.getOutInterceptors(),
                                 true);
        
        
        System.out.println("Using old RESTful CustomerService with new client");

        customer.v2.Customer customer = createNewCustomer("Smith New to Old REST");
        customerService.updateCustomer(customer);
        customer = customerService.getCustomerByName("Smith New to Old REST");
        printNewCustomerDetails(customer);
    }
858328
protected function initializeClient()
    {
        // Store some specific soap-client related data locally
        // so it can be injected in the SoapClient and compared
        // for changes later

        $this->wsdl          = $this->request->getLocation();
        $this->clientOptions = $this->request->getOptions();

        // store hash to make it possible to detect changes to the client
        $this->clientHash = $this->makeSoapClientHash();

        $xdebugEnabled = extension_loaded('xdebug') && xdebug_is_enabled();

        try {

            // temporarily disable xdebug to prevent PHP Fatal error
            // while constructing SoapClient

            if ($xdebugEnabled) xdebug_disable();

            $class = $this->soapClientClass;

            $this->client = $this->getSoapClientFactory()->make($class, $this->wsdl, $this->clientOptions);

            if ($xdebugEnabled) xdebug_enable();

        } catch (SoapFault $e) {

            throw new CouldNotConnectException($e->getMessage(), $e->getCode(), $e);

        } catch (Exception $e) {

            throw new CouldNotConnectException($e->getMessage(), $e->getCode(), $e);
        }
    }
328920
def on_complete(env)
      env[:body] = Nori.new(
        strip_namespaces: true,
        convert_tags_to: ->(tag) { tag.snakecase.to_sym }
      ).parse(env[:body])

      raise SOAPError, "Invalid SOAP response" if env[:body].empty?

      env[:body] = env[:body][:envelope][:body]
      env[:body] = find_key_in_hash(env[:body], @key)
    end
1098079
public void useNewRESTServiceWithOldClient() throws Exception {
        List<Object> providers = createJAXRSProviders();

        com.example.customerservice.CustomerService customerService = JAXRSClientFactory
            .createFromModel("http://localhost:" + port + "/examples/direct/new-rest", 
                             com.example.customerservice.CustomerService.class,
                             "classpath:/model/CustomerService-jaxrs.xml", 
                             providers, 
                             null);
        
        // The outgoing old Customer data needs to be transformed for 
        // the new service to understand it and the response from the new service
        // needs to be transformed for this old client to understand it.
        ClientConfiguration config = WebClient.getConfig(customerService);
        addTransformInterceptors(config.getInInterceptors(),
                                 config.getOutInterceptors(),
                                 false);
        
        
        System.out.println("Using new RESTful CustomerService with old Client");

        customer.v1.Customer customer = createOldCustomer("Smith Old to New REST");
        customerService.updateCustomer(customer);

        customer = customerService.getCustomerByName("Smith Old to New REST");
        printOldCustomerDetails(customer);
    }
585149
def obsolete_client(func):
    """"""

    @functools.wraps(func)
    def new_func(*args, **kwargs):
        raise ObsoleteException(
            "{} has been removed from this version of the library. "
            "Please refer to current documentation for guidance."
            .format(func.__name__)
        )

    return new_func
424249
public SoapClientActionBuilder client(String soapClient) {
		SoapClientActionBuilder clientAction = new SoapClientActionBuilder(action, soapClient)
				.withApplicationContext(applicationContext);
		return clientAction;
	}
920033
def replace_service(name,
                    metadata,
                    spec,
                    source,
                    template,
                    old_service,
                    saltenv,
                    namespace='default',
                    **kwargs):
    '''
    
    '''
    body = __create_object_body(
        kind='Service',
        obj_class=kubernetes.client.V1Service,
        spec_creator=__dict_to_service_spec,
        name=name,
        namespace=namespace,
        metadata=metadata,
        spec=spec,
        source=source,
        template=template,
        saltenv=saltenv)

    # Some attributes have to be preserved
    # otherwise exceptions will be thrown
    body.spec.cluster_ip = old_service['spec']['cluster_ip']
    body.metadata.resource_version = old_service['metadata']['resource_version']

    cfg = _setup_conn(**kwargs)

    try:
        api_instance = kubernetes.client.CoreV1Api()
        api_response = api_instance.replace_namespaced_service(
            name, namespace, body)

        return api_response.to_dict()
    except (ApiException, HTTPError) as exc:
        if isinstance(exc, ApiException) and exc.status == 404:
            return None
        else:
            log.exception(
                'Exception when calling '
                'CoreV1Api->replace_namespaced_service'
            )
            raise CommandExecutionError(exc)
    finally:
        _cleanup(**cfg)
1206547
def on_service_modify(self, svc_ref, old_properties):
        
        with self._lock:
            if self.reference is None:
                # A previously registered service now matches our filter
                return self.on_service_arrival(svc_ref)
            else:
                # Check if the ranking changed the service to inject
                best_ref = self._context.get_service_reference(
                    self.requirement.specification, self.requirement.filter
                )
                if best_ref is self.reference:
                    # Still the best service: notify the property modification
                    if svc_ref is self.reference:
                        # Call update only if necessary
                        self._ipopo_instance.update(
                            self, self._value, svc_ref, old_properties
                        )
                else:
                    # A new service is now the best: start a departure loop
                    self.on_service_departure(self.reference)

            return None
1315884
private function initSoapClient() {
        if ($this->soapClient === NULL) {
            $this->soapClient = new SoapClient($this->service, $this->key, $this->cert, $this->trace, $this->passphrase);
        }
    }
744597
public void onHttpClientUpgrade() throws Http2Exception {
        if (connection().isServer()) {
            throw connectionError(PROTOCOL_ERROR, "Client-side HTTP upgrade requested for a server");
        }
        if (!prefaceSent()) {
            // If the preface was not sent yet it most likely means the handler was not added to the pipeline before
            // calling this method.
            throw connectionError(INTERNAL_ERROR, "HTTP upgrade must occur after preface was sent");
        }
        if (decoder.prefaceReceived()) {
            throw connectionError(PROTOCOL_ERROR, "HTTP upgrade must occur before HTTP/2 preface is received");
        }

        // Create a local stream used for the HTTP cleartext upgrade.
        connection().local().createStream(HTTP_UPGRADE_STREAM_ID, true);
    }
576762
public function rename($old_name, $new_name)
    {
        if (null === $this->_sftp_resource) {
            throw new TransportException(sprintf('None SSH connection available.'));
        }

        $old_name = $this->_getAbsoluteRemotePath($old_name);
        $new_name = $this->_getAbsoluteRemotePath($new_name);

        if (false === @ssh2_sftp_stat($this->_sftp_resource, $old_name)) {
            return $this->_trigger_error(sprintf('Could not open remote file: %s.', $old_name));
        }

        if (false !== @ssh2_sftp_stat($this->_sftp_resource, $new_name)) {
            return $this->_trigger_error(sprintf('Remote file already exists: %s.', $new_name));
        }

        if (false === @ssh2_sftp_rename($this->_sftp_resource, $old_name, $new_name)) {
            return $this->_trigger_error(sprintf('Unable to rename %s to %s', $old_name, $new_name));
        }

        return true;
    }
523903
def rename(client, old, new, force):
    """"""
    from renku.models.refs import LinkReference
    LinkReference(client=client, name=_ref(old)).rename(_ref(new), force=force)
628706
function processSOAPNode(node, msgParams, msg) {
    // Handle simple generic SOAP. TBD: Handle multiple types of SOAP security and other params
    // TBD: Test Security features
    // TBD: Implement soap listen

    let options = {};
    console.log('Processing Node .......... ');
    console.log(JSON.stringify(node));
    let params = processValuesFromContext(node, msgParams, msg, [
      {name: 'url', type: 'urlType'},
      {name: 'method', type: 'methodType'},
      {name: 'parameters', type: 'parametersType'},
      {name: 'headers', type: 'headersType'},
    ]);
    console.log(params);


    soap.createClient(params.url, options, function(err, client) {
      if (err) {
        let errInvalidSOAP = util.format('Error while creating soap client - %s', err);
        msg.error = getError(node, errInvalidSOAP);
        node.error(errInvalidSOAP, msg);
        return;
      }
      try {
        let method = eval('client' + params.method);
        // let method = client['GetHolidaysAvailable'];
        // let requestArgs = {"countryCode": "UnitedStates"};
        method(params.parameters, function(err, result, envelope, soapHeader) {
          if (err) {
            let errInvalidSOAP = util.format('Error while calling soap service - %s', err);
            msg.error = getError(node, errInvalidSOAP);
            node.error(errInvalidSOAP, msg);
            return;
          }
          // response envelope
          console.log('Response Envelope: \n' + envelope);
          // 'result' is the response body
          console.log('Result: \n' + JSON.stringify(result));
          console.log(JSON.stringify(result));
          msg.payload = JSON.stringify(result);
          node.send(msg);
          return;
        });
      } catch (error) {
        let errInvalidSOAP = util.format('Error while calling soap service - %s', error);
        msg.error = getError(node, errInvalidSOAP);
        node.error(errInvalidSOAP, msg);
        return;
      }
    });
  }