Highlighted
New Member.
2924 views

Consuming webservice from php or java???

Hello,

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!

HP 9.30 Patch 5
0 Likes
9 Replies
Highlighted
Established Member..
Established Member..

Re: Consuming webservice from php or java???

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

 

<?php
    try {
        $wsdl_url = 'http://localhost:13080/sc62server/PWS/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;
    }
?>

 

Regards

If my post helps you, please mark it as an accepted solution. Thank you in advance.
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Consuming webservice from php or java???

Hi Lauren,

 

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

 

 

Regards,

Abhijit K

0 Likes
Highlighted
Established Member..
Established Member..

Re: Consuming webservice from php or java???

Hi,

 

I did not use any library.

 

Regards,

 

Laurens

 

If my post helps you, please mark it as an accepted solution. Thank you in advance.
0 Likes
Highlighted
New Member.

Re: Consuming webservice from php or java???

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?

thanks

HP 9.30 Patch 5
0 Likes
Highlighted
New Member.

Re: Consuming webservice from php or java???

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}

 

HP 9.30 Patch 5
0 Likes
Highlighted
New Member.

Re: Consuming webservice from php or java???

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

HP 9.30 Patch 5
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Consuming webservice from php or java???

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 )

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Consuming webservice from php or java???

Hello Lorens

 

I follow your explanation but I have this error:

 

Error!!! = : SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://200.51.172.30/services/IncidentManagement?wsdl' : failed to load external entity "https://200.51.172.30/services/IncidentManagement?wsdl" 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

 

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: Consuming webservice from php or java???

any solution ?

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.