<?php // Publish a page or file $soapURL = "http://localhost:8080/ws/services/AssetOperationService?wsdl"; $client = new SoapClient($soapURL, array('trace' => 1, 'location' => str_replace('?wsdl', '', $soapURL))); $auth = array('username' => 'admin', 'password' => 'admin'); $identifier = array('id' => 'Your-Page-ID-Here', 'type' => 'page'); $destinationIdentifier = array('id' => 'Your-Destination-ID-Here', 'type' => 'destination'); $publishInformation = array('identifier' => $identifier, 'destinations' => array($destinationIdentifier), 'unpublish' => false); $publishParams = array('authentication' => $auth, 'publishInformation' => $publishInformation); $reply = $client->publish($publishParams); if ($reply->publishReturn->success == 'true') { echo "Success: Published."; } else { echo "Error occurred when publishing: " . $reply->publishReturn->message; }
function publish_app_by_app_id($app_id) { // Invoke Web Services $webServiceAddress = getWebServiceAddress(); ini_set("soap.wsdl_cache_enabled", "0"); $client = new SoapClient($webServiceAddress, array('encoding' => 'UTF-8')); try { $param = array('arg0' => $app_id); $ret = $client->publish($param); //print_r($ret); if ($ret == "true") { print "publish it successfully."; } else { print "Fail to publish"; } } catch (SoapFault $exception) { print $exception; } }