Highlighted
Acclaimed Contributor.
Acclaimed Contributor.
107 views

Querying KnowledgeBase via Web Services

I have a need to query the Service Manager Knowledge base from an outside application.  The team is wondering if there are out of the box Web Services for Knowledge. I took a look and there is a KnowledgeManager WSDL with a "RetrieveKnowledge" function, but when I tried what I thought was a simple search with it and it took longer than 30 seconds, I figured I was doing something wrong. 

My Soap request was:

<?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:RetrieveKnowledgeRequest>

<ns:model>

<ns:keys/>

<ns:instance>

<ns:question type="">Service Manager</ns:question>

</ns:instance>

</ns:model>

</ns:RetrieveKnowledgeRequest>

</soap:Body>

</soap:Envelope>

Has anyone done this or does anyone have any suggestions? I asked HP Support and they just pointed me to the Web Services guide, which wasn't very specific about querying Knowledge Management.

Thoughts?

0 Likes
7 Replies
Highlighted
Frequent Contributor.
Frequent Contributor.

Re: Querying KnowledgeBase via Web Services

Greetings.

I would like to confirm if the WSDL table you are using is kmdocument. I have been doing some testing with this table and actually it takes some time in order to give a response, and also it depends on the table because every option or table use a diferent wizard, so the requests are different.

Please confirm this information.

 

 

 

Regards,

Jhonny Castro Montero
SW Support Technical Consultant
San Jose, Costa Rica
hpe.com
Hewlett Packard Enterprise

If you find that this or any other post resolves your issue, please be sure to mark it as an accepted solution.
If you are satisfied with anyone’s response please remember to give them a KUDOS by clicking on the STAR at the bottom left of the post and show your appreciation
0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Querying KnowledgeBase via Web Services

Hi Tom,

A few years ago I worked on this and found that while you can query kmdocuments directly from the table an actual search against the search engine doesn't occur (at least it didn't then). ABack in the day the developers did not include any OOB functionality to search KM via web services. 

-B-

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: Querying KnowledgeBase via Web Services

Hi Tom,

Happy New Year !!

It is much easier to publish the KM doc externally so it can be searched easily.

Hope this helps,

Rama

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Querying KnowledgeBase via Web Services

OK, so this is a "No, there is no out of the box functionality", right?   I was hoping the Web Services would search KM and somehow utilize the SOLR engine...but I knew that was a LONG SHOT.  🙂 

Thank you guys!

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: Querying KnowledgeBase via Web Services

Hello Tom,

Since the KnowledgeBase is based on SOLR tool you can request directly the SOLR server.

I have tested on a OOB system SM 9.41 and found that you can request like that if you want to serach the word "test":

For an answer in json format use

http://localhost:8081/KMCores/Knowledge_Library/select?q=%28%28%28docbody%3Atest%29+OR+%28docbody_fr%3Atest%29+OR+%28adlearn%3Atest%29+OR+%28adlearn_fr%3Atest%29%29%29&fl=VLang%2CView_URL%2Ccategory%2Cdocbody%2Cdoctype%2Cid%2Ckmsearchcategory%2Ckmstatus%2Cstatus%2Ctitle%2Cscore%2Csysmodtime&start=0&rows=200&sort=score+desc&wt=json&fq=

For an answer in xml format and a search in the Knowledge and Incident knowledgebases

http://localhost:8081/KMCores/Knowledge_Library/select?q=%28%28%28docbody%3Atest%29+OR+%28docbody_fr%3Atest%29+OR+%28adlearn%3Atest%29+OR+%28adlearn_fr%3Atest%29%29%29&fl=VLang%2CView_URL%2Ccategory%2Cdocbody%2Cdoctype%2Cid%2Ckmsearchcategory%2Ckmstatus%2Cstatus%2Ctitle%2Cscore%2Csysmodtime&start=0&rows=200&sort=score+desc&wt=xml&fq=

http://localhost:8081/KMCores/Incident_Library/select?q=%28%28%28docbody%3Atest%29+OR+%28docbody_fr%3Atest%29+OR+%28adlearn%3Atest%29+OR+%28adlearn_fr%3Atest%29%29%29&fl=VLang%2CView_URL%2Ccategory%2Cdocbody%2Cdoctype%2Cid%2Ckmsearchcategory%2Ckmstatus%2Cstatus%2Ctitle%2Cscore%2Csysmodtime&start=0&rows=200&sort=score+desc&wt=xml&fq=

Hope this helps,

LPP

Global Support Delivery Software Support Expert

If you find that this or any other post resolves your issue, please be sure to mark it as an accepted solution.
If you are satisfied with anyone’s response please remember to give them a KUDOS by clicking on the STAR at the bottom left of the post and show your appreciation.
0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Querying KnowledgeBase via Web Services

Thanks.  Yes, I figured out that we could search the KM Index directly via SOLR.  I can get it to return the Title and ID.  We could then have the application query SM directly via the OOB Webservice to retrieve the solution via ID.  The format of the solution however is fairly ugly with the HTML formatting being brought back in the SOAP request.  Oh well. I gave it to the team who was requesting this....we'll see if they are interested in pursuing this.  Thank you all!

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Querying KnowledgeBase via Web Services

Keep in mind that while you can query SOLR directly there will be no Category Security. When you search Knowledge inside Service Manager security is active so only those knowledge documents the user is allowed to see will be in th hitlist. That security doesn't exist when querying SOLR outside of SM. So even if you're able to clean up the html/xml in the presented hitlist these users will see all of the documents that match the search term.

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.