• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

CreateSite2 api

K

kbessinger

Guest
I am trying to create a site using PHP and soap, per the example in the documentation

Here is what my code looks like:


$siteService = new Utils_SoapClient($serviceUrl.'/SiteWebService.asmx?WSDL', array("trace"=>1, "exception"=>0));
$siteService->setCredentialsHeader($serviceLogin, $servicePassword);

$struct = new stdClass();
$struct->ownerId = $accountId;
$struct->siteType = 'Regular';
$struct->siteAlias = 'newdomain.com';
$struct->hostId = '66961197-e6e4-e017-15e7-087892279b4d';
$struct->publishingSettings = new stdClass();
$struct->publishingSettings->Scenario = 'Standard';
$struct->publishingSettings->Mode = 'Ftp';
$struct->publishingSettings->StandardLocation = new stdClass();
$struct->publishingSettings->StandardLocation->UserName = 'newdomain';
$struct->publishingSettings->StandardLocation->Password = 'password';
$struct->publishingSettings->StandardLocation->WorkingDirectory = '/httpdocs/';
$struct->publishingSettings->StandardLocation->WebSiteUrl = 'http://newdomain.com';
$struct->publishingSettings->StandardLocation->Address = 'ftp://newdomain.com';
$struct->publishingSettings->StandardLocation->Veid = 0;
$result = $siteService->CreateSite2(new SoapVar($struct, SOAP_ENC_OBJECT));
$siteId = $result->CreateSite2Result->Id;

And I can see that im sending up the publishingSettings, but the only one that updates is the WebSiteUrl. The rest come back as blank in the response and don't get set.

See as follows:

Request:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://swsoft.com/webservices/sb/4.0/SiteService"><SOAP-ENV:Header><ns1:CredentialsSoapHeader><ns1:Login>blah</ns1:Login><ns1:password>blah</ns1:password></ns1:CredentialsSoapHeader></SOAP-ENV:Header><SOAP-ENV:Body><ns1:CreateSite2><ownerId>162a6a09-6741-93a6-d868-42deb4bbd0b4</ownerId><siteType>Regular</siteType><siteAlias>newdomain.com</siteAlias><hostId>66961197-e6e4-e017-15e7-087892279b4d</hostId><publishingSettings><Scenario>Standard</Scenario><Mode>Ftp</Mode><StandardLocation><UserName>newdomain</UserName><Password>password</Password><WorkingDirectory>/httpdocs/</WorkingDirectory><WebSiteUrl>http://newdomain.com</WebSiteUrl><Address>ftp://newdomain.com</Address><Veid>0</Veid></StandardLocation></publishingSettings></ns1:CreateSite2></SOAP-ENV:Body></SOAP-ENV:Envelope>

Response:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://swsoft.com/webservices/sb/4.0/SiteService"><SOAP-ENV:Body><ns1:CreateSite2Response><ns1:CreateSite2Result><ns1:Id>49d1d1e8ebd1763ca2380e061f5eba42</ns1:Id><ns1:Alias>newdomain.com</ns1:Alias><ns1:OwnerId>162a6a09-6741-93a6-d868-42deb4bbd0b4</ns1:OwnerId><ns1:OwnerUserName>TestUser</ns1:OwnerUserName><ns1:IsActive>true</ns1:IsActive><ns1:publishingSettings><ns1:Id>c0ee7ed5-060f-5549-0efc-f179ab6b6059</ns1:Id><ns1:StandardLocation><ns1:Address></ns1:Address><ns1:UserName></ns1:UserName><ns1:password></ns1:password><ns1:WorkingDirectory></ns1:WorkingDirectory><ns1:WebSiteUrl>http://newdomain.com/</ns1:WebSiteUrl><ns1:IsAnonymous>false</ns1:IsAnonymous><ns1:Veid>0</ns1:Veid><ns1:VerifyStatus>Unverified</ns1:VerifyStatus><ns1:LastVerifyAttempt>1969-12-31T18:00:00-06:00</ns1:LastVerifyAttempt><ns1:FallbackIP></ns1:FallbackIP><ns1:HostId>00000000-0000-0000-0000-000000000000</ns1:HostId></ns1:StandardLocation><ns1:Mode>Ftp</ns1:Mode></ns1:publishingSettings><ns1:HostId>00000000-0000-0000-0000-000000000000</ns1:HostId><ns1:ResellerId>00000000-0000-0000-0000-000000000000</ns1:ResellerId><ns1:ResellerUserName>admin</ns1:ResellerUserName><ns1:CreationDate>2007-12-17T13:52:19-06:00</ns1:CreationDate></ns1:CreateSite2Result></ns1:CreateSite2Response></SOAP-ENV:Body></SOAP-ENV:Envelope>
 
ah never mind, didn't realize what the <Address> field was for. Once i put the ip address of the ftp server, it worked. Guess without a valid ip address, it will not save some of the other settings.
 

Similar threads

K
Replies
1
Views
4K
KemalE
K
N
Replies
3
Views
3K
NicolasR
N
J
Replies
5
Views
3K
holykim66
H
Back
Top