Author Archives: Admin

Rest API call using curl always throwing error in PA server? properly working in local server.

Below error getting in  PA Server.

Execution of configuration script for instance with id 5767 of service with id Create Account of instance with id 3654 of application with id 4199 failed – returned value:
‘ errors: ‘* About to connect() to 198.–.–.– port 8080
* Trying 198.–.–.–… * connected
* Connected to 198.–.–.– (198.–.–.–) port 8080
> POST /account/ HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
Host: 198.–.–.–:8080
Content-Type: application/xml
Accept:application/json
Content-Length: 652

< HTTP/1.1 201 Created
< Cache-Control: private
< Location: —-
< Server: Microsoft-IIS/7.5
< X-AspNet-Version: 4.0.30319
< X-Powered-By: ASP.NET
< Date: Tue, 05 Nov 2013 06:25:54 GMT
< Content-Length: 0
* Connection #0 to host 198.–.–.– left intact
* Closing connection #0

To Fix the above error you can use the following curl method.

$curl = curl_init();
curl_setopt($curl,CURLOPT_HTTPHEADER,array(“Content-Type: application/xml”,”Accept:application/json”));
curl_setopt($curl, CURLOPT_POST, true); // Do a regular HTTP POST
curl_setopt($curl, CURLOPT_POSTFIELDS, $inputdata); // Set POST data
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_USERAGENT, “Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)”);
curl_setopt($curl, CURLOPT_VERBOSE, FALSE);
curl_setopt($curl, CURLOPT_HEADER, 1); // return HTTP headers with response
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_URL, $service_url);

Error Displaying in APS Package or validating an entered field

Sample code

$str = “<?xml version=’1.0′ encoding=’UTF-8′?>”;
$str.= ‘<output xmlns=”http://apstandard.com/ns/1/configure-output”><settings>’;
$errorMessages=”mydoubts.in already exists”;
$errsetting=’domainname’;
$str .= ‘<errors>’;
$str .= ‘<error id=”‘.$errsetting.'” setting-id=”‘.$errsetting.'”>’;
$str .= ‘<message>’.$errorMessages.'</message><system>’.$errorMessages.'</system></error>’;
$str .= ‘</errors>’;
$str .= ‘</settings>’;

echo $str;

Storing a value into the settings variable in aps package.

Below sample code will execute through verification script will work

sample code to load a country dropdownbox.

$str = “<?xml version=’1.0′ encoding=’UTF-8′?>”;
$str .= ‘<output xmlns=”http://apstandard.com/ns/1/configure-output”><settings><setting id=”country”>’;
foreach () {

$str .=    ‘<choice id=”‘.$id.'”><name>’.htmlspecialchars($cname).'</name></choice>’;
}
$str .= ‘</setting></settings>’;

echo $str;

Validation for a fieldname in APS package.

For Validation you can use specified class name for example for email field use the

class “email” in eclipse then it will automatically validate.

second method is for some fields inculding email we can use  the Regex validation . in

eclipse we will get one field adding option for regex. enter the apropriate regex in the

box

Third method is using verification script. in verification script we can add the validation

using php code and it can be displayed into the settings variable as an error message.

Sample Rest aPi call in php using curl

$service_url = ‘http://mydoubts.com’;
$inputdata='<?xml version=”1.0″ encoding=”utf-8″?>
<username>mydoubts</username>
<domain>mydoubts.in</domain>
<email>contact@mydoubts.in</email>’;

curl_setopt($curl, CURLOPT_HTTPHEADER, array(“Content-Type: application/xml”));
curl_setopt($curl, CURLOPT_POST, true); // Do a regular HTTP POST
curl_setopt($curl, CURLOPT_POSTFIELDS, $inputdata); // Set POST data
curl_setopt($curl, CURLOPT_URL, $service_url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_HEADER, 1); // return HTTP headers with response
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);

How to list only a single item in a storefront(Display only single companys product).

Create Store in PBA using the following steps

Go to PBA
click on product director-Online store manager-Stores

click on add new store

After creating new store click on the store you created

then make it active using activate button,click on setdefault and if needed do the

settemplate button also

After doing this do the other process like creating screens,usage scenario adding service

plan to screens-catogories etc step