PHP
To use PHP to invoke web services, you must create the development environment and enable:
- 
          
Soap extension by removing semi-colon (;), which is the comment character, from the line starting with
extension=php_soap.dll - 
          
SSL extension by removing semi-colon (;) from the line starting with
extension=php_openssl.dll 
Install and configure any of the available PHP development environments.
- 
          
Simple HTML form that contains a button to submit a request and a text area to display the result.
 - 
          
Processing logic that branches based on request type. A POST request calls a web service; any other request clears the value of the text area that contains the result.
 - 
          
Processing logic that creates a new instance for the soap client.
 - 
          
Construct an array structure that contains the parameters to be passed to the web service.
 - 
          
Parse the response as XML and assign to a variable that is displayed in the text area for output.
 
<?php
// Process POST requests
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
   try {
       $username ="username";
       $password ="password";
       // Create new instance for the client
       $client = new SoapClient("https://host:port/icCnSetupCreditRulesPublicService/CreditRuleService?wsdl",
                 array('trace' => 1,
                      'login' => $username,
                      'password' => $password));
       // Construct the payload to be used to invoke the service.
       $params = array(
         'findCriteria' => array(
         'fetchStart' => '0',
         'fetchSize' => '-1',
         'filter' => array(
           'group' => array(
             'upperCaseCompare' => 'false',
             'item' => array(
               'upperCaseCompare' => 'false',
               'attribute' => 'RuleId',
               'operator' => '=',
               'value' => '300000000851162')
            )
         ),
         'excludeAttribute' => 'false'
         ),
         'findControl' => array(
           'retrieveAllTranslations' => 'false')
        );
		// Invoke the service
        $response = $client->FindRule($params);
		
        // Process the response. In this example,  the content is copied to a variable that is displayed as output
        $dom = new DOMDocument;
        $dom->preserveWhiteSpace = FALSE;
        $dom->loadXML($client->__getLastResponse());
        $dom->formatOutput = TRUE;
        $dom->saveXml();
        $output = $dom->saveXml();
    } catch(Exception $e) {
      print "Exception: " . $e->getMessage();
      }
    } else {
      // For GET request, set the variable displayed as output
      $output = "";
      } 
	  ?>
    <form name="envelope" method="POST">
      <!-- Button used to start the processing -->
      <input id="invoke_service" type="submit" value="Invoke Service" />
      <!-- Text area to display the result for processing. As the result is XML, it is encoded; otherwise it is not displayed correctly -->
      <textarea name="outputpayload" wrap="off" style="width:100%;height:100%" rows=30><?php echo
      htmlentities($output);?></textarea>
    </form>