Clarity PPM

XOG : SOAP : .NET

  • 1.  XOG : SOAP : .NET

    Posted 02-20-2019 08:12 AM

    Heres a sample of a SOAP XOG in VB.NET

     

    Private Function CallWebService(ByVal SOAP As String) As XmlDocument
       Using wcConnect As New WebClient()
          Dim xdResponse As New XmlDocument()
          wcConnect.Headers.Add("Content-Type", "application/soap+xml; charset=utf-8")
          xdResponse.LoadXml(wcConnect.UploadString(pUrl, SOAP))
          Return xdResponse
       End Using
    End Function

     

    Private Sub clarityLogin()
       Dim xdResponse As New XmlDocument()
       Dim xnmNsMgr As New XmlNamespaceManager(xdResponse.NameTable)
       xnmNsMgr.AddNamespace("soapenv", "http://schemas.xmlsoap.org/soap/envelope/")
       xnmNsMgr.AddNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance")
       xnmNsMgr.AddNamespace("", "http://www.niku.com/xog")
       Dim strSoap As String = "<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:tns='http://www.niku.com/xog'><soap:Header/><soap:Body><tns:Login><tns:Username>" & pUserName & "   </tns:Username><tns:Password>" & pPassword & "</tns:Password></tns:Login></soap:Body></soap:Envelope>"
       xdResponse = CallWebService(strSoap)
       pSessionId = xdResponse.SelectSingleNode("//soapenv:Envelope", xnmNsMgr).InnerText
    End Sub

     

    Private Sub clarityLogout()
       Dim strSoap As String = "<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:tns='http://www.niku.com/xog'><soap:Header/><soap:Body><tns:Logout><tns:SessionID>" & strSessionId & "    </tns:SessionID></tns:Logout></soap:Body></soap:Envelope>"
       CallWebService(strSoap)
    End Sub