forked from hannonhill/Webservices-PHP-Sample-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate.php
35 lines (31 loc) · 848 Bytes
/
create.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
$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
(
'path' => array
(
'path' => '/my-xml-block'
),
'type' => 'xmlBlock'
);
$xmlBlock = array
(
'xml' => '<xml>Test</xml>',
'metadataSetPath' => '/Default',
'parentFolderPath' => '/',
'name' => 'my-xml-block'
);
$asset = array('xmlBlock' => $xmlBlock);
$createParams = array ('authentication' => $auth, 'asset' => $asset);
$reply = $client->create ($createParams);
if ($reply->createReturn->success=='true')
echo "Success. Created asset's id is " . $reply->createReturn->createdAssetId;
else
echo "Error occurred: " . $reply->createReturn->message;
?>