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?

  • 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.

     

     

     

  • 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-

  • 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

  • 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!

  • 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

    localhost:8081/.../select OR (docbody_fr:test) OR (adlearn:test) OR (adlearn_fr:test)))&fl=VLang,View_URL,category,docbody,doctype,id,kmsearchcategory,kmstatus,status,title,score,sysmodtime&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

    localhost:8081/.../select OR (docbody_fr:test) OR (adlearn:test) OR (adlearn_fr:test)))&fl=VLang,View_URL,category,docbody,doctype,id,kmsearchcategory,kmstatus,status,title,score,sysmodtime&start=0&rows=200&sort=score desc&wt=xml&fq=

    localhost:8081/.../select OR (docbody_fr:test) OR (adlearn:test) OR (adlearn_fr:test)))&fl=VLang,View_URL,category,docbody,doctype,id,kmsearchcategory,kmstatus,status,title,score,sysmodtime&start=0&rows=200&sort=score desc&wt=xml&fq=

    Hope this helps,

    LPP

  • 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!

  • 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.