Welcome Serena Central users!
The migration of the Serena Central community is happening today. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Abhijit K Acclaimed Contributor.
Acclaimed Contributor.
4504 views

Send request to IM wsdl through java script..

Jump to solution

Hi All,

 

Check the following Javascript which uses doSOAPRequest():

 

var url = "http://172.25.2.5:13080/SM/7/IncidentManagement.wsdl";
var action = "http://172.25.2.5:13080/SM/7/RetrieveIncident";
var xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xmime=\"http://www.w3.org/2005/05/xmlmime\" xmlns:ns=\"http://schemas.hp.com/SM/7\" xmlns:cmn=\"http://schemas.hp.com/SM/7/Common\"><soap:Body><ns:RetrieveIncidentRequest ignoreEmptyElements=\"true\"><ns:model><ns:keys/><ns:instance query=\"\" uniquequery=\"\" recordid=\"\"><ns:IncidentID type=\"\" mandatory=\"\" readonly=\"\">IM10181</ns:IncidentID></ns:instance><ns:messages/></ns:model></ns:RetrieveIncidentRequest></soap:Body></soap:Envelope>";

 //print ("The return value for xml: " + xml);

var uid ="falcon";
var pass ="falcon";
var attachments = new Array();
var quote = doSOAPRequest( url, action, xml, uid, pass, 10, 10, 10, attachments );
print( "The return value is: " + quote );

 

 

but it's not working i guess error with XML parsing kindly advice.

 

Kinldy advice on this..

 

re,

abhijit

0 Likes
1 Solution

Accepted Solutions
Absent Member.. hge Absent Member..
Absent Member..

Re: Send request to IM wsdl through java script..

Jump to solution
  var uid = "falcon";
   var pas = null;
   var att = null;

   var url = "http://comp.xx.yy.uk:27388/SM/7";  // fully qualified !
   var act = "Retrieve";      
          
   var xml = "<?xml version='1.0' encoding='UTF-8'?>"+ 
             "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">"+      
             "<soapenv:Body>"+         
             "<RetrieveIncidentRequest xmlns=\"http://schemas.hp.com/SM/7\" attachmentData=\"false\" attachmentInfo=\"true\" ignoreEmptyElements=\"true\">"+            
             "<model>"+               
             "<keys>"+                  
             "<IncidentID>IM10193</IncidentID>"+               
             "</keys>"+               
             "<instance />"+            
             "</model>"+         
             "</RetrieveIncidentRequest>"+      
             "</soapenv:Body>"+   
             "</soapenv:Envelope>";
          

  var quote = doSOAPRequest( url, act, xml, uid, pas, 5, 5, 5, att).toString();
  print( "quote = "+ quote);

 just did this test from servicecenter 6 -> servicemanager 9 oob.

give it a try.  you have to adjust IncidentId !!

16 Replies
Abhijit K Acclaimed Contributor.
Acclaimed Contributor.

Re: Send request to IM wsdl through java script..

Jump to solution

sorry wrong file attched.

 

 

0 Likes
Abhijit K Acclaimed Contributor.
Acclaimed Contributor.

Re: Send request to IM wsdl through java script..

Jump to solution
Hi All,

Kindly suggest anything...

re,
abhijit
0 Likes
Abhijit K Acclaimed Contributor.
Acclaimed Contributor.

Re: Send request to IM wsdl through java script..

Jump to solution
Hi,

Kindly advice on this issue.

re,
abhijit
0 Likes
Absent Member.. hge Absent Member..
Absent Member..

Re: Send request to IM wsdl through java script..

Jump to solution
<?xml version='1.0' encoding='UTF-8'?>   
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">      
      <soapenv:Body>         
         <RetrieveIncidentRequest xmlns="http://schemas.hp.com/SM/7/ws" attachmentData="false" attachmentInfo="true" ignoreEmptyElements="true">            
            <model>               
               <keys>                  
                  <IncidentID>IM3956365</IncidentID>               
               </keys>               
               <instance />            
            </model>         
         </RetrieveIncidentRequest>      
      </soapenv:Body>   
   </soapenv:Envelope>

 

this soap-envelope is working. 

 

0 Likes
Absent Member.. hge Absent Member..
Absent Member..

Re: Send request to IM wsdl through java script..

Jump to solution

never tried to consume servicemanager webservice/s from inside servicemanager, only from outside

 

0 Likes
Abhijit K Acclaimed Contributor.
Acclaimed Contributor.

Re: Send request to IM wsdl through java script..

Jump to solution

hi hge,

Thanks for sharing this.but sorry it didn't work in my case.
same error as attached in second file.

I made it work through javascript call by IncidentManagement() method.

Yes this wrong way.We are integrating HPSM with external tool using web services, so they are going to consume HPSM wsdl but before that i am trying to identify ideal SOAP request format.

 

re,

abhijit

0 Likes
Absent Member.. hge Absent Member..
Absent Member..

Re: Send request to IM wsdl through java script..

Jump to solution
  var uid = "falcon";
   var pas = null;
   var att = null;

   var url = "http://comp.xx.yy.uk:27388/SM/7";  // fully qualified !
   var act = "Retrieve";      
          
   var xml = "<?xml version='1.0' encoding='UTF-8'?>"+ 
             "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">"+      
             "<soapenv:Body>"+         
             "<RetrieveIncidentRequest xmlns=\"http://schemas.hp.com/SM/7\" attachmentData=\"false\" attachmentInfo=\"true\" ignoreEmptyElements=\"true\">"+            
             "<model>"+               
             "<keys>"+                  
             "<IncidentID>IM10193</IncidentID>"+               
             "</keys>"+               
             "<instance />"+            
             "</model>"+         
             "</RetrieveIncidentRequest>"+      
             "</soapenv:Body>"+   
             "</soapenv:Envelope>";
          

  var quote = doSOAPRequest( url, act, xml, uid, pas, 5, 5, 5, att).toString();
  print( "quote = "+ quote);

 just did this test from servicecenter 6 -> servicemanager 9 oob.

give it a try.  you have to adjust IncidentId !!

Absent Member.. hge Absent Member..
Absent Member..

Re: Send request to IM wsdl through java script..

Jump to solution
  replace
  var quote = doSOAPRequest( url, act, xml, uid, pas, 5, 5, 5, att).toString();
  with
  var quote = doSOAPRequest( url, act, xml, uid, pas, 5, 5, 5, att).toXMLString();

 

Abhijit K Acclaimed Contributor.
Acclaimed Contributor.

Re: Send request to IM wsdl through java script..

Jump to solution

hi hge,

 

It worked like Potter's MAGIC-WAND.

 

I have been also able to produce Ticket using Create method.

 

thanks for sharing and your precesious time.

 

kudos assigned.

 

thanks and regards,

abhijit

0 Likes
Absent Member.. hge Absent Member..
Absent Member..

Re: Send request to IM wsdl through java script..

Jump to solution

thank you Abhijit.  try this too:

 

   var act = "RetrieveList";      
          
   var xml = "<?xml version='1.0' encoding='UTF-8'?>"+
             "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">"+      
             "<soapenv:Body>"+         
             "<RetrieveIncidentListRequest xmlns=\"http://schemas.hp.com/SM/7\" attachmentData=\"false\" attachmentInfo=\"true\" ignoreEmptyElements=\"true\">"+            
             "<keys query=\"flag=&quot;true&quot; and OpenedBy=&quot;falcon&quot;\"/>"+                  
             "</RetrieveIncidentListRequest>"+      
             "</soapenv:Body>"+   
             "</soapenv:Envelope>";

should retrieve all open incidents opened by falcon.

bye. hge

0 Likes
Absent Member.. hge Absent Member..
Absent Member..

Re: Send request to IM wsdl through java script..

Jump to solution

if working with act="RetrieveList"

a) returns incident IM10161

b) returns all incident starting with IM1016

 

a) "<keys query=\"number=&quot;IM10161&quot;\"/>"+ 
b) "<keys query=\"number#&quot;IM1016&quot;\"/>"+  

 have fun.

0 Likes
Established Member.. madhavaks
Established Member..

Re: Send request to IM wsdl through java script..

Jump to solution

Hello Abhijit,

 

Can you please provide create incident js using webservice.

 

Thanks & Regards,

Madhava

0 Likes
Abhijit K Acclaimed Contributor.
Acclaimed Contributor.

Re: Send request to IM wsdl through java script..

Jump to solution

Hi Madhava,

 

I dont have direct JS script but have sample SOAP UI code to generate incident in hpsm. If you compare earlier script i think you can easily build it.

 

 

here is the sample code from SOAP UI:

 

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://schemas.hp.com/SM/7" xmlns:com="http://schemas.hp.com/SM/7/Common" xmlns:xm="http://www.w3.org/2005/05/xmlmime">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:CreateIncidentRequest attachmentInfo="False" attachmentData="False" ignoreEmptyElements="true">
         <ns:model query="">
            <ns:keys query="">
               <!--Optional:-->
               <ns:IncidentID type="String" mandatory="" readonly=""></ns:IncidentID>
            </ns:keys>
            <ns:instance query="" uniquequery="" recordid="">
               <!--Optional:-->
               <ns:IncidentID type="String" mandatory="" readonly=""></ns:IncidentID>
               <!--Optional:-->
               <ns:Category type="String" mandatory="" readonly="">incident</ns:Category>
               <!--Optional:-->
               <ns:OpenTime type="DateTime" mandatory="" readonly=""></ns:OpenTime>
               <!--Optional:-->
               <ns:OpenedBy type="String" mandatory="" readonly="">falcon</ns:OpenedBy>
               <!--Optional:-->
               <ns:Urgency type="String" mandatory="" readonly="">1</ns:Urgency>
               <!--Optional:-->
               <ns:UpdatedTime type="DateTime" mandatory="" readonly=""></ns:UpdatedTime>
               <!--Optional:-->
               <ns:AssignmentGroup type="String" mandatory="" readonly="">Application</ns:AssignmentGroup>
               <!--Optional:-->
               <ns:ClosedTime type="DateTime" mandatory="" readonly=""></ns:ClosedTime>
               <!--Optional:-->
               <ns:ClosedBy type="String" mandatory="" readonly=""></ns:ClosedBy>
               <!--Optional:-->
               <ns:ClosureCode type="String" mandatory="" readonly=""></ns:ClosureCode>
               <!--Optional:-->
               <ns:AffectedCI type="String" mandatory="" readonly="">adv-nam-desk-209</ns:AffectedCI>
               <!--Optional:-->
               <ns:Description type="Array">
                  <!--Zero or more repetitions:-->
                  <ns:Description type="String" mandatory="" readonly="">Sample from SPOAPUI</ns:Description>
               </ns:Description>
               <!--Optional:-->
               <ns:Solution type="Array">
                  <!--Zero or more repetitions:-->
                  <ns:Solution type="String" mandatory="" readonly=""></ns:Solution>
               </ns:Solution>
               <!--Optional:-->
               <ns:Assignee type="String" mandatory="" readonly="">Incident.Analyst</ns:Assignee>
               <!--Optional:-->
               <ns:Contact type="String" mandatory="" readonly="">RYAN, JULIA</ns:Contact>
               <!--Optional:-->
               <ns:JournalUpdates type="Array">
                  <!--Zero or more repetitions:-->
                  <ns:JournalUpdates type="String" mandatory="" readonly=""></ns:JournalUpdates>
               </ns:JournalUpdates>
               <!--Optional:-->
               <ns:AlertStatus type="String" mandatory="" readonly=""></ns:AlertStatus>
               <!--Optional:-->
               <ns:ContactLastName type="String" mandatory="" readonly=""></ns:ContactLastName>
               <!--Optional:-->
               <ns:ContactFirstName type="String" mandatory="" readonly=""></ns:ContactFirstName>
               <!--Optional:-->
               <ns:Company type="String" mandatory="" readonly="">advantage</ns:Company>
               <!--Optional:-->
               <ns:Title type="String" mandatory="" readonly="">Sample from SOAPUI</ns:Title>
               <!--Optional:-->
               <ns:TicketOwner type="String" mandatory="" readonly=""></ns:TicketOwner>
               <!--Optional:-->
               <ns:UpdatedBy type="String" mandatory="" readonly=""></ns:UpdatedBy>
               <!--Optional:-->
               <ns:Status type="String" mandatory="" readonly=""></ns:Status>
               <!--Optional:-->
               <ns:Area type="String" mandatory="" readonly="">access</ns:Area>
               <!--Optional:-->
               <ns:SLAAgreementID type="Decimal" mandatory="" readonly=""></ns:SLAAgreementID>
               <!--Optional:-->
               <ns:SiteCategory type="String" mandatory="" readonly=""></ns:SiteCategory>
               <!--Optional:-->
               <ns:Subarea type="String" mandatory="" readonly="">authorization error</ns:Subarea>
               <!--Optional:-->
               <ns:ProblemType type="String" mandatory="" readonly=""></ns:ProblemType>
               <!--Optional:-->
               <ns:ResolutionFixType type="String" mandatory="" readonly=""></ns:ResolutionFixType>
               <!--Optional:-->
               <ns:UserPriority type="String" mandatory="" readonly=""></ns:UserPriority>
               <!--Optional:-->
               <ns:Location type="String" mandatory="" readonly="">advantage/North America</ns:Location>
               <!--Optional:-->
               <ns:explanation type="Array">
                  <!--Zero or more repetitions:-->
                  <ns:explanation type="String" mandatory="" readonly=""></ns:explanation>
               </ns:explanation>
               <!--Optional:-->
               <ns:Impact type="String" mandatory="" readonly="">1 - Enterprise</ns:Impact>
               <!--Optional:-->
               <ns:folder type="String" mandatory="" readonly=""></ns:folder>
               <!--Optional:-->
               <ns:Service type="String" mandatory="" readonly="">Applications</ns:Service>
               <!--Optional:-->
               <ns:attachments>
                  <!--Zero or more repetitions:-->
                  <com:attachment xm:contentType="application" href="" contentId="" action="" name="" type="" len="" charset="" attachmentType=""></com:attachment>
               </ns:attachments>
            </ns:instance>
            <!--Optional:-->
            <ns:messages>
               <!--Zero or more repetitions:-->
               <com:message severity="1" module=""></com:message>
            </ns:messages>
         </ns:model>
      </ns:CreateIncidentRequest>
   </soapenv:Body>
</soapenv:Envelope>

 

 

It worked for us. Hope will work for you.

 

 

Sorry for the late reply.

 

 

Regards,

abhijit k

0 Likes
Highlighted
Abhijit K Acclaimed Contributor.
Acclaimed Contributor.

Re: Send request to IM wsdl through java script..

Jump to solution

Might be useful for someone:

 

 


function Create(temp)
{

var uid = "falcon";
var pas = null;
var att = null;

var title=temp.title;

var url = "http://10.196.16.74:13080/SM/7"; // fully qualified !
var act = "Create";

var xml = "<?xml version='1.0' encoding='UTF-8'?>"+
"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://schemas.hp.com/SM/7\" xmlns:com=\"http://schemas.hp.com/SM/7/Common\" xmlns:xm=\"http://www.w3.org/2005/05/xmlmime\">" +
"<soapenv:Header/>" +
"<soapenv:Body>" +
"<ns:CreateIncidentRequest attachmentInfo=\"False\" attachmentData=\"False\" ignoreEmptyElements=\"true\">" +
"<ns:model query=\"\">" +
"<ns:keys query=\"\">" +
"<ns:IncidentID type=\"String\" mandatory=\"\" readonly=\"\">" +"</ns:IncidentID>" +
"</ns:keys>" +
"<ns:instance query=\"\" uniquequery=\"\" recordid=\"\">" +
"<ns:IncidentID type=\"String\" mandatory=\"\" readonly=\"\">" +"</ns:IncidentID>" +
"<ns:Category type=\"String\" mandatory=\"\" readonly=\"\">" +"incident"+"</ns:Category>" +
"<ns:OpenTime type=\"DateTime\" mandatory=\"\" readonly=\"\">" +"</ns:OpenTime>" +
"<ns:OpenedBy type=\"String\" mandatory=\"\" readonly=\"\">" +"falcon"+"</ns:OpenedBy>" +
"<ns:Urgency type=\"String\" mandatory=\"\" readonly=\"\">" +"1"+"</ns:Urgency>" +
"<ns:UpdatedTime type=\"DateTime\" mandatory=\"\" readonly=\"\">" +"</ns:UpdatedTime>" +
"<ns:AssignmentGroup type=\"String\" mandatory=\"\" readonly=\"\">" +"Application"+"</ns:AssignmentGroup>" +
"<ns:ClosedTime type=\"DateTime\" mandatory=\"\" readonly=\"\">" +"</ns:ClosedTime>" +
"<ns:ClosedBy type=\"String\" mandatory=\"\" readonly=\"\">" +"</ns:ClosedBy>" +
"<ns:ClosureCode type=\"String\" mandatory=\"\" readonly=\"\">" +"</ns:ClosureCode>" +
"<ns:AffectedCI type=\"String\" mandatory=\"\" readonly=\"\">" +"adv-nam-desk-209"+"</ns:AffectedCI>" +
"<ns:Description type=\"Array\">" +"<ns:Description type=\"String\" mandatory=\"\" readonly=\"\">" +"Sample from SPOAPUI"+"</ns:Description>" +"</ns:Description>" +
"<ns:Solution type=\"Array\">" +
"<!--Zero or more repetitions:-->" +
"<ns:Solution type=\"String\" mandatory=\"\" readonly=\"\">" +"</ns:Solution>" +
"</ns:Solution>" +
"<ns:Assignee type=\"String\" mandatory=\"\" readonly=\"\">" +""+"</ns:Assignee>" +
"<ns:Contact type=\"String\" mandatory=\"\" readonly=\"\">" +"RYAN, JULIA"+"</ns:Contact>" +
"<ns:JournalUpdates type=\"Array\">" +
"<!--Zero or more repetitions:-->" +
"<ns:JournalUpdates type=\"String\" mandatory=\"\" readonly=\"\">" +"</ns:JournalUpdates>" +
"</ns:JournalUpdates>" +
"<ns:AlertStatus type=\"String\" mandatory=\"\" readonly=\"\">" +"</ns:AlertStatus>" +
"<ns:ContactLastName type=\"String\" mandatory=\"\" readonly=\"\">" +"</ns:ContactLastName>" +
"<ns:ContactFirstName type=\"String\" mandatory=\"\" readonly=\"\">" +"</ns:ContactFirstName>" +
"<ns:Company type=\"String\" mandatory=\"\" readonly=\"\">" +"advantage"+"</ns:Company>" +
"<ns:Title type=\"String\" mandatory=\"\" readonly=\"\">" +title+"</ns:Title>" +
"<ns:TicketOwner type=\"String\" mandatory=\"\" readonly=\"\">" +"</ns:TicketOwner>" +
"<ns:UpdatedBy type=\"String\" mandatory=\"\" readonly=\"\">" +"</ns:UpdatedBy>" +
"<ns:Status type=\"String\" mandatory=\"\" readonly=\"\">" +"</ns:Status>" +
"<ns:Area type=\"String\" mandatory=\"\" readonly=\"\">" +"Systems"+"</ns:Area>" +
"<ns:SLAAgreementID type=\"Decimal\" mandatory=\"\" readonly=\"\">" +"</ns:SLAAgreementID>" +
"<ns:SiteCategory type=\"String\" mandatory=\"\" readonly=\"\">" +"</ns:SiteCategory>" +
"<ns:Subarea type=\"String\" mandatory=\"\" readonly=\"\">" +"Email"+"</ns:Subarea>" +
"<ns:ProblemType type=\"String\" mandatory=\"\" readonly=\"\">" +"</ns:ProblemType>" +
"<ns:ResolutionFixType type=\"String\" mandatory=\"\" readonly=\"\">" +"</ns:ResolutionFixType>" +
"<ns:UserPriority type=\"String\" mandatory=\"\" readonly=\"\">" +"</ns:UserPriority>" +
"<ns:Location type=\"String\" mandatory=\"\" readonly=\"\">" +"advantage/North America"+"</ns:Location>" +
"<ns:explanation type=\"Array\">" +
"<ns:explanation type=\"String\" mandatory=\"\" readonly=\"\">" +"</ns:explanation>" +
"</ns:explanation>" +
"<ns:Impact type=\"String\" mandatory=\"\" readonly=\"\">" +"1 - Enterprise"+"</ns:Impact>" +
"<ns:folder type=\"String\" mandatory=\"\" readonly=\"\">" +"</ns:folder>" +
"<ns:Service type=\"String\" mandatory=\"\" readonly=\"\">" +"Applications"+"</ns:Service>" +
"<ns:attachments>" +
"<com:attachment xm:contentType=\"application\" href=\"\" contentId=\"\" action=\"\" name=\"\" type=\"\" len=\"\" charset=\"\" attachmentType=\"\">" +"</com:attachment>" +
"</ns:attachments>" +
"</ns:instance>" +
"<ns:messages>" +
"<com:message severity=\"1\" module=\"\">" +"</com:message>" +
"</ns:messages>" +
"</ns:model>" +
"</ns:CreateIncidentRequest>" +
"</soapenv:Body>" +
"</soapenv:Envelope>";

var quote = doSOAPRequest( url, act, xml, uid, pas, 5, 5, 5, att).toString();
// print( "quote = "+ quote);


}

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.