Check the UDDI service status yourself

Ever run into problems that you 'think' may be related to not being able to access the UDDI service? I wrote a script that should help you (and me) determine if the UDDI service is up or down.

Here is the source. Again, use at your own risk, make sure that if you are copying and pasting that you check the longer strings to make sure they haven't newlined on you...and of course, add some error checking. It continues to amaze me how poor my formatting, commenting, and coding skills are. I only write this stuff for me usually, so I don't care if it's not formatted correctly, or if there are 'better' ways to do it. My goal is to write as little code as possible to get what I need. ;)

'********************************************************
' RMS UDDI Checker - Jason Tyler
' Date: uhhh...night time
'******************************************************** 

strURL = "https://uddi.microsoft.com/inquire"

retval =  GetUDDIInfo(strURL,vbnullstring)
Wscript.Echo GetUDDIInfo(strURL,retval)

Function GetUDDIInfo(strURL,strKey)
 Set XMLHTTP = CreateObject("MSXML2.XMLHTTP")

 If strKey = vbnullstring Then
  strSType = "ServiceInfo"
  strEnrollment = "uuid:d3bf98c5-dea7-4503-80f1-99758c4486f4"
  strBody = "<find_service generic='2.0' xmlns='urn:uddi-org:api_v2' businessKey=''><tModelBag><tModelKey>" & strEnrollment & "</tModelKey></tModelBag></find_service>"
 Else
  strSType = "ServiceDetail"
  strEnrollment = strKey
  strBody = "<get_serviceDetail generic='2.0' xmlns='urn:uddi-org:api_v2'><serviceKey>" & strEnrollment & "</serviceKey></get_serviceDetail>"
 End If
 
 
 
 strEnvelope = "<soap:Envelope xmlns:soap='https://schemas.xmlsoap.org/soap/envelope/'><soap:Body>" & strBody & "</soap:Body></soap:Envelope>"
 strRequest = "<?xml version='1.0' encoding='utf-8'?>" & strEnvelope

 With XMLHTTP
  .Open "POST", strURL, False
  .setRequestHeader "content-type", "text/xml; charset=utf-8"
  .setRequestHeader "SOAPAction", """"""
  .send strRequest
  'Wscript.Echo .responseXML.xml   'Uncomment this line to see the actual XML
  If .Status = 200 Then
   Set oDOM = .responseXML.documentElement
   Select Case strSType
   Case "ServiceInfo"
    Wscript.Echo "UDDI Service is up. Querying for enrollment URL..."
    Set sKeys = oDOM.getElementsbyTagName("serviceInfos")
   Case "ServiceDetail"
    Wscript.Echo "Enrollment URL is:"
    Set sKeys = oDOM.getElementsbyTagName("accessPoint")
   End Select
    For each obj in sKeys
     Select Case strSType
     Case "ServiceInfo"
     strReturn = obj.firstChild.nextSibling.nextSibling.attributes(0).value
     Case "ServiceDetail"
     strReturn = obj.FirstChild.NodeValue
     End Select
    Next
  Else
   Wscript.Echo "Cannot Connect to UDDI service. Error Code is: " & .Status
  End If
 
  Set XMLHTTP = Nothing
  GetUDDIInfo = strReturn

End With
 
End Function

 -Jason