Wednesday 16 March 2011

Siebel WebService Call - From - PHP

This blog will explain how to call Siebel Web Service from PHP.

This will also shows, how to handle the Siebel complex XML structure in PHP.

Here I am using following WSDL file, I am also giving the Request and Response for the same.

WSDL --> SSO_Service.WSDL (This file is physically located in the PHP code folder)

Note : Please test your Webservice from SOAP Client before you start coding in PHP, so that it will be easy to code.

SOAP Request :

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:zeb="http://siebel.com/SOService">
<soapenv:Header/>
<soapenv:Body>
<ns:SSO_spcService_Get_spcUser_spcInfo_Input>
<!--Optional:-->
<ns:User_spcId>SADMIN</ns:User_spcId>
</ns:SSO_spcService_Get_spcUser_spcInfo_Input>
</soapenv:Body>
</soapenv:Envelope>
SOAP Response :


<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns:SSO_spcService_Get_spcUser_spcInfo_Output xmlns:ns="http://siebel.com/SSOService">
<ns:NumOutputObjects>1</ns:NumOutputObjects>
<ListOfSsoContact xmlns="http://www.siebel.com/xml/SSOContact">
<Contact>
<EmailAddress>sadmin@company.com</EmailAddress>
<FirstName>Siebel</FirstName>
<LastName>Administrator</LastName>
<LoginName>SADMIN</LoginName>
<Status/>
<Id>0-1</Id>
<ListOfAccount/>
<ListOfResponsibility>
<Responsibility>
<Name>Siebel Administrator</Name>
</Responsibility>
<Responsibility>
<Name>Marketing Analytics Super User</Name>
</Responsibility>
</ListOfResponsibility>
</Contact>
</ListOfSsoContact>
</ns:_spcSSO_spcService_Get_spcUser_spcInfo_Output>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


PHP Code to Handle above SOAP Method :

$soapClient = new SoapClient("SSO_Service.WSDL"); 
$inputParam = array('User_spcId' => 'SADMIN'); 
try  
{   
$info = $soapClient->__call("Get_spcUser_spcInfo", array($inputParam));  
}
catch (SoapFault $fault) { 
echo ' ************ Error ***********' . $fault->faultcode; 
echo ' *************** Error ************' . $fault->faultstring . '
'; 
}

 //NumOutputObjects is Immediate Output 
 echo "
<p> # of Records : " . $info->NumOutputObjects . "</p>";  

$ListOfSsoContact = $info->ListOfSsoContact;
 //Pick the first Contact 
$Contact = $ListOfSsoContact->Contact;
echo '<p> Email Address : ' .$Contact->EmailAddress . ' </p>'; 
echo '<p> First Name : ' .$Contact->FirstName . ' </p>'; 
echo ' <p> Last Name : ' .$Contact->LastName . ' </p>';
?>

Please post your questions if you need more information.... 

4 comments:

  1. Hi Srikanth,

    I have WSDL file from Siebel and I am using XAMPP in Windows C:\xampp. So where should i keep these WSDL files, I mean which folder under xampp directory?

    Thanks In Advance

    Regards
    Mohan

    ReplyDelete
  2. Hi Mohan, I am sorry, I am not following the blog very actively. Did you find the answer or you are still looking for ?

    ReplyDelete
  3. Hi,
    i want to the answer to the above question and also what are the setting done in local server,i mean xampp

    ReplyDelete
  4. Hi
    when i call the siebel web service i get internal server error, in error log its saying authentication is missing.I have wsse security header in my request.I tried various options but still didnt help.Is there any way to do it?

    ReplyDelete