13 Replies Latest reply on Jan 11, 2018 8:49 AM by Mariusz.Maniak

    Cool WebService connector examples

    Jamie Cannon ITSMMVPGroup

      Just thought I'd start a thread to see what really cool stuff people have done with WebServices.  We all know the usual "connect to LPM for automation" but I want to know some other things people have done.  I don't typically see much posted about webservices at all so maybe this is a good thing.

       

      Just for starters I've been able to create a connector into a currency conversion (per a note from StuMcneill) that will allow you to enter a "From Country" to a "To Country" and do a conversion for you.  I've created the From and To as referenced attributes from a "Country Codes" reference list which I populated from this site: CurrencyConvertor Web Service.  Then all I do is pass in the From and the To and save and the webservice does the rest.

       

      Now it's your turn.... GO!

        • 1. Re: Cool WebService connector examples
          Mariusz.Maniak Expert

          Hi Jamie!

           

          I.m using webservices to integrate my customer's LDSD with other ticketing systems. We have connections to BMC Remedy, and other one, I can't remember name

          But this is done with calculations - due to error solved in last version of LDSD (LDSD is adding "?wsdl" on end of webservice address),

          Also one of my customer use webservices to integrate HR system with LDSD - there are some requests created in HR (grant access to resources, and so on) and by WS HR system creates request in LDSD, then if request is resolved - LDSD by WS sending confirmation to HR. This is done by console WS, because HR system admin was able to reconfigure his webservice to bypass error...

           

          Regards

          Mariusz

          • 2. Re: Cool WebService connector examples
            Mariusz.Maniak Expert

            Nobody is using Webservices??

            Can't belive...

            • 3. Re: Cool WebService connector examples
              Fabian Schmidt Expert

              One of our customers uses webservices quiet a lot:

              1. For internal actions of processes from different modules.

              2. Trigger an external webservice that communicates to different tools in use like Management Suite, Airwatch, SAP etc.

               

              That's quiet a lot they use.

              • 4. Re: Cool WebService connector examples
                ProServices

                Here's an example of using the google maps web service.  I created an HTML attribute called IncidentMap and its plotting the location of the user in this case on a map in the Incident window.

                 

                [CODE]

                import System

                static def GetAttributeValue(Incident):

                Value = ''

                Value += """"<img src="https://maps.googleapis.com/maps/api/staticmap?center="""+Incident.RaiseUser._Location._Location+"""&zoom=13&size=900x300&maptype=roadmap&markers=color:blue%7Clabel:Incident%7C"""+Incident.RaiseUser._Location._Location+"""  "height='300px' width='600px'>"""

                return Value

                [/CODE]

                 

                I know there are some people out there using the web service behavior on objects to send SMS txt messages for outages, assignments, etc...

                1 of 1 people found this helpful
                • 5. Re: Cool WebService connector examples
                  Andrew Swindells SupportEmployee

                  I'm using Web Services to all for the resetting of the password for all users of a selected user type. This is a DR piece of functionality to be used in the event of Shibboleth single sign on failure. An administrator logs into an Explicit instance of LDSD raises a new ticket (change in this instance) and selects the user type and enters a password.

                   

                  This then calls an LPM work flow which executes a SQL script to call a function in the database to encrypt the password and apply it to all users of the selected class type.

                   

                  Once all passwords are completed an email is sent to all users of the selected type with the URL of the Explicit instance of LDSD along to with the password. Event Manager is then used to close the change record.

                   

                  If the script should fail a separate email is sent to an administrators group. An incident is also raised (linked to the change)in LDSD (using Event Manager) to investigate as to why the script has failed.

                  • 6. Re: Cool WebService connector examples
                    djs Apprentice

                    Andrew,

                    Could you share your function in the database to encrypt the password? Thanks

                    • 7. Re: Cool WebService connector examples
                      Jamie Cannon ITSMMVPGroup

                      This is really cool.  I like the map idea on the ticket itself.

                      • 8. Re: Cool WebService connector examples
                        Darren.Bradshaw Expert

                        Hi Mariusz, Can you please give us some pointer on how you achieved the link to BMC Remedy, what did you do with regards to the process in Service Desk.  Did Remedy send any information back to Service Desk. Any process diagrams etc would be great. We are looking to do something similar and would like some ideas. Thanks.

                        • 9. Re: Cool WebService connector examples
                          Julian Wigman ITSMMVPGroup

                          I have used for bulk actions on a process with a good use-case being to allow bulk asset refreshes.  ie

                           

                          1. I have a windowed action “Swap CI” at the “Subscribed” Request status which simply prompts dropdown for new CI and they has automatic actions to unlink previous CI and link new.  This action can be used manually for example when an Incident for the CI causes it to need to be replaced but the subscribed Request/Service also updated. once this is working...
                          2. I created a new process (actually i put in a new module called “Utility” to group with others) called ”Bulk CI Refresh”.  The process is a simple OPEN -> AUTOMATIC ACTION -> CLOSED lifecycle (With precondition to for auto move on from open). The key here is the automatic action is a collection linked to a web service which points to the Event Manager “integration source“ webservice url. I pass/valuetype 4 fields into this action; process ID, process GUID, old CI, new CI which I have also created on the main lifecycle object as well for step (4).
                          3. In Event Manager i setup to link to my Request process and add an action for my “Swap CI” ie action mapping the fields passed.
                          4. Finally I setup a data import that points at my utility process and a spreadsheet in known format ie ID, GUID, OLD CI, NEW CI columns.

                           

                          To use, users can create a querytool query of CI’s they want to refresh and include ID, GUID, OLD CI columns. Run and export to Excel.

                           

                          You can then in Excel add the New CI column and data for an existing CI that each user will get as a replacement and save to location of your standard import.

                           

                          Finally run the import. Forveach row it’ll create a utility lifecycle, immediately invoke a web service event and that event will do the CI swap in the Request lifecycles required.

                           

                          These are the building blocks for a bulk refresh via spreadsheet but you can develop other use cases around these concepts. The key here is that I’m using the integration event source which everyone is licensed for plus then passing it the GUID of the process i want to update and its parameters.

                           

                          Works well.

                           

                          Julian

                          MarXtar Ltd

                          • 10. Re: Cool WebService connector examples
                            Mariusz.Maniak Expert

                            Darren,

                            Connection to external system is quite simple. In process we have "with 3rd party" action, after that automatic action "ws act", where with calculation we building string with data, and using .net sending to external web service:

                             

                            "ws ok?" condition is checking if webservice connection was ok, task is created, and so on, if not - incident is going back to "in progress",

                             

                            Calculation in WS act is:

                             

                            import System
                            import System.Net
                            import System.IO
                            import System.Text
                            static def GetAttributeValue(Incident):
                                try:
                                          
                                    L0= '<?xml version="1.0" encoding="utf-16"?>'
                                    L1= '<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">'
                                    L2= '<soap:Body>'
                                    L3= '<CreateIncident xmlns="http://test_ws.org/test/">'
                                    L5='<id xmlns="">1234</id>'
                                    L6=''
                                    if Incident.Category!= null:
                                        if Incident.Category.Title!= null:
                                            L6='<Category xmlns="">' + Incident.Category.Title + '</Category>'
                                    L7='</CreateIncident>'
                                    L8='</soap:Body>'
                                    L9='</soap:Envelope>'
                                  
                                    Soap = L0+L1+L2+L3+L5+L6+L7+L8+L9
                                  
                                    Strlenght = Soap.Length
                                  
                                    WS = WebRequest.Create('http://test_ws.org/test/')
                                    WS.Headers.Add("SOAPAction", '"http://test_ws.org/test/CreateIncident"')
                                    WS.Method = "POST"
                                    WS.ContentType = "text/xml; charset=utf-8"
                                    WS.Credentials = CredentialCache.DefaultCredentials
                                  
                                    Stm as Stream = WS.GetRequestStream()
                                  
                                    Stmw as StreamWriter = StreamWriter(Stm)
                                  
                                    Stmw.Write(Soap,0,Strlenght)
                                    Stmw.Close()
                                    Response as WebResponse = WS.GetResponse()
                                    Stm2 as Stream = Response.GetResponseStream()
                                  
                                    reader as StreamReader = StreamReader(Stm2, Encoding.UTF8)
                                  
                                    Result = reader.ReadToEnd()
                                    if Result!=null:
                                        pos = Result.IndexOf('<result>')
                                        Code = Result.Substring (pos+8, 1)
                                        if Code == '0':
                                            pos = Result.IndexOf('<Id>')
                                            Value = Result.Substring (pos+2, 5)
                                        elif Code == '1':
                                            Value = ' err 1 '
                                      
                                        elif Code == '2':
                                            Value = ' err 2 '
                                    return Value
                                except e:
                                    raise String.Format('Error on {0}: {1}', e.StackTrace.Substring(e.StackTrace.LastIndexOf(':') + 1), e.Message)      
                                  

                             

                            if result code is 0 - communication was ok, calculation as a result is sending ID in external system. In case of other result codes - error description.

                            Condition "WS ok?" is checking value returned by calculation, if it is id in external system - taks is created.

                             

                            Calculation in example is "censored" - data structure depends from target system, but idea is to put all bricks (L1, L2, L3) together, and send outside

                            Off course, You can use XMLbuilder function, to prepare soap data in better way, and read response as xml, but this example works for me

                            Hope this will be usefull

                            1 of 1 people found this helpful
                            • 11. Re: Cool WebService connector examples
                              Julian Wigman ITSMMVPGroup

                              Connect to MarXtar Enterprise Notifer; exciting stuff!  

                               

                              Julian

                              Marxtar Ltd

                              • 12. Re: Cool WebService connector examples
                                Darren.Bradshaw Expert

                                This might be me being stupid but how did you get the calculation into the Action?

                                • 13. Re: Cool WebService connector examples
                                  Mariusz.Maniak Expert

                                   

                                  It is a string attribute, -1, in incident object. Green "WS act" is created as "associated with window", so you can set up calculation on this attribute in process.

                                  On user window it's called as External id - because as result calculation returning id in external system. In case of failure, error message is displayed (ie. cannot connect to external system, or incorrect category).

                                  As in "production" proces we have lots of conditions before "WS act" so usually only "cannot connect" errors occures - if there is a problem with VPN to external system.