How to test GSOAP webservice call

We have all had that issue with the Repository or the Orchestration Engine being unable to get to the gsoap web service URL.  And, this is with all SBM components installed on the same server.  Why can't it get to itself?  Or in the case orchestrations, maybe we cannot figure out why the OE is unable to reach a third party web service.

 

The following VB Script will mimic the process of making a web service call.  It then writes the result of the call to a file, so that we can see what is happening in the connection.

  • Copy the following script to a text file and name the file testGsoapCall.vbs.
function ReadXML
 strFile = "request.xml"
 strRequest ="" 

 Set objFSO=CreateObject("Scripting.FileSystemObject")
 Set objFile = objFSO.OpenTextFile(strFile)
 Do Until objFile.AtEndOfStream
  strRequest= strRequest + objFile.ReadLine
 Loop
 objFile.Close

 objFSO = nil
 ReadXML = strRequest
end function

Dim XMLHttp 
dim strUrl 
dim strRequest
dim outFile, objFile, objFSO
 
REM  Set the strUrl variable to be your hostname URL
strUrl = "http://ORL-SUP-SBM11DG.serena.com/gsoap/gsoap_ssl.dll?sbmappservices72"
'strRequest = ReadXML
strRequest = "" &_
    "" &_
    "" &_
    "" &_
    "" &_
    "" 

Set objFSO=CreateObject("Scripting.FileSystemObject")
outFile="output.txt"
Set objFile = objFSO.CreateTextFile(outFile,True)

set XMLHttp=createObject("Microsoft.xmlhttp")
XMLHttp.open "POST",strUrl,false
XMLHttp.setRequestHeader "Content-Type","text/xml;charset=UTF-8"

   objFile.Write "REQUEST URL:     " & strUrl & vbCrLf
   objFile.Write "REQUEST:         " & strRequest & vbCrLf
   XMLHttp.send strRequest

   objFile.Write "RESPONSE Status: " & XMLHttp.Status & vbCrLf
   objFile.Write "RESPONSE ERR:    " & XMLHttp.statusText & vbCrLf
   objFile.Write "RESPONSE TEXT:   " & vbCrLf & XMLHttp.responseText & vbCrLf
   objFile.Write "RESPONSE XML:    " & vbCrLf & XMLHttp.responseXML.xml & vbCrLf

   Set xmlDoc = CreateObject("Microsoft.XMLDOM") 
   xmlDoc.SetProperty "ServerHTTPRequest", False
   xmlDoc.setProperty "SelectionLanguage", "XPath"
   xmlDoc.setProperty "SelectionNamespaces", "xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'"
   xmlDoc.async = False
   xmlDoc.loadXML(XMLHttp.responseXML.xml)
   if xmlDoc.parseError.errorcode=0 then
     objFile.Write "XML ELEMENTS:" & vbCrLf
     For Each x In xmlDoc.documentElement.childNodes
         objFile.Write x.nodename & ": " & x.text & vbCrLf
     Next
  set strResponse = xmlDoc.documentElement.selectSingleNode("//env:Body")

  '  objFile.Write  vbCrLf
  '  objFile.Write "XML BODY MSG: " & strResponse.text
   Else
     objFile.Write  vbCrLf
   End if

objFile.Close

 

  • Modify the URL on the line after "REM  Set the strUrl variable to be your hostname URL". This should point to your SBM server.
  • Place the VBS file on the desktop of your server.
  • Execute the file by double-clicking it.  View the file output.txt to see the results of the query. The query just tries to get the version of SBM.

 Test a web service to a third party end point

  • Edit the file on your desktop
  • Set strURL to the web service endpoint.
  • Uncomment the line 'strRequest = ReadXML
  • Comment these lines by putting an apostrophe in front of each line
'strRequest = "" &_
'    "" &_
'    "" &_
'    "" &_
'    "" &_
'    "" 
  •  SBM web services requires a POST.  If the third party web service requires a GET then modify this line

XMLHttp.open "POST",strUrl,false

as such

XMLHttp.open "GET",strUrl,false

  • Create a file on your desktop called request.xml
  • Place the XML code that represents your SOAP web service call.
Dimensions Make
"Form action definition is out of date" Simple fix

Related Posts

Comments

 
No comments yet

Recent Tweets