Hi,
Can you share some more details on this with code you use to Access the service (including Authentication part)?
/Madusanka
Hello, here is the code. I hid the url and the authentication.
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://xxxxx.ifs.cloud:48080/int/ifsapplications/projection/v1/PartHandling.svc/PartCatalogSet(PartNo='LUCA')",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Content-Type:application/json',
'Authorization: Basic xxxxx==')
));
$response = curl_exec($curl);
if($response === false){
echo 'Curl error: ' . curl_error($curl);
} else {
print_r($response);
}
curl_close($curl);
?>
Thanks.
If it works in Postman and not in PHP, it could be due to CORS (Cross-Origin Resource Sharing) https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS where browser rejects accessing resources in a different domain.
If your php application is in a different domain, try bringing into the same domain as IFS to see if solves the problem.
Cheers!
Damith
To solve this issue just add a rule into the http response header.
Access-Control-Allow-Origin *
Note that, instead of the * that means everybody, you can add a list of knowed url.