Consuming webservice from php or java???


Anyone have idea how to consume webservice HP Service Manager from PHP or use another client???

We want to create records of incidents happening and we have the wsdl parameters configured but do not know how to create a client to consume the wsdl.

We you can help?


We are looking for some example

Thank you!
  • This code creates a incident in HPSM. The return is not nicely defined but it will create the incident.


        try {
            $wsdl_url = 'localhost:13080/.../IncidentManagement.wsdl';
            $client = new SOAPClient($wsdl_url, array('login' => "falcon", 'password' => "password11"));
            //$client = new SOAPClient($wsdl_url);
            //$client->setCredentials("falcon", "password11");
            $params = array(
                'model' => array(
                  'keys' => array(),
                  'instance' => array(
                     'Title' => 'This is a test 1',
                     'Category' => 'incident',
                     'AssignmentGroup' => 'Service Manager',
                     'AffectedCI' => 'Service Manager',
                     'Assignee' => 'Problem.Coordinator',
                     'Contact' => 'falcon',
                     'Area' => 'data',
                     'Subarea' => 'data or file incorrect',
                     'Service' => 'Service Management',
                     'Impact' => '4',
                     'Urgency' => '2',
                     'Description' => array('TESTSTSTSTSTS')

            $return = $client->CreateIncident($params);

            $return_inc = array();

            foreach ($return as $key => $value) {
                $return_inc[$key] = $value;
            //echo "incident:" . $return_inc[IncidentID];
            echo $return.toString();
        } catch (Exception $e) {
            echo "Exception occured: " . $e;



  • Hi Lauren,


    Did  you use any SOAP library for this in PHP like NuSOAP or other??




    Abhijit K

  • Hi Lauren,


    Did  you use any SOAP library for this in PHP like NuSOAP or other??




    Abhijit K

  • Hi,


    I did not use any library.






  • Very good solution, I have problems with the return and I could not configure it to show me the number of the incident.

    I have another question, if I run php repeatedly different sessions are created with the user "falcon".

    Is there any way to use the same session?


  • This is the message I returned to run the php more than 4 times.

    In Service Manager will create 4 sessions with user "falcon"



    Exception: SoapFault exception: [HTTP] Unauthorized in C:\xampp\htdocs\sm\sm.php:32 Stack trace: #0 [internal function]: SoapClient->__doRequest('__call('CreateIncident', Array) #2 C:\xampp\htdocs\sm\sm.php(32): SoapClient->CreateIncident(Array) #3 {main}


  • any idea how close the session or maintain the same session??

  • Hi ,


    Thanks for this post. It worked for me.


    Howerver I am facing issue in tetriving the Incident number and I am unable to modify this code to uplad attachments.


    Please guide me on how to retrive Incident number and upload attachment using php for IncidentManagement.wsdl ( HPSM 9.3x )

  • Hello Lorens


    I follow your explanation but I have this error:


    Error!!! = : SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from '' : failed to load external entity "" in C:\Users\NOTEBOOKHP\PhpProjects\AuDex\audere\letstart.php:59 Stack trace: #0 C:\Users\NOTEBOOKHP\PhpProjects\AuDex\audere\letstart.php(59): SoapClient->SoapClient('https://200.51....', Array) #1 {main}



    Can you help me??


    Thanks  in advance