Summary: How to call a web service from Infor CRM
Article Type: Troubleshooting / Support
Related Product: This article relates to the following products:

  • Infor CRM (formerly Saleslogix)
 Related Articles:

Recently, a member of our technical staff needed to call a web service from Infor CRM LAN.  While researching the best way to go about this, our staff member encountered others in forums trying to do the same thing.

Below is a (modified for generalisation) vbscript code snippet that you can use to make calls to web services from within Infor CRM LAN. The handling of the response has not been shown in detail as this will vary depending on the web service being called.

It is worth noting that Infor CRM Architect knowledge is required to carry out this task

–CODE STARTS–

Sub CallWebService ()

Dim postURL, strQueryString, httpResponse

‘Set the postURL to the URL of your web service that you want to call

‘For this example, I am calling a simple Math service method (Add) that will add up two numbers passed as query parameters

postURL = “http://localhost:60369/MathService.asmx/Add”

‘Set the strQueryString to everything you would expect to see after the ? in the URL

‘These are your query parameters

‘In this example, the Add method I am calling accepts two integers (val1 and val2)

strQueryString = “val1=150&val2=250”

‘Call the HTTPPost function (shown below) to make the request to the web service

‘The response text is being stored in the variable httpResponse

httpResponse = HTTPPost(postURL, strQueryString)

‘You can use string manipulation (not shown) to retrieve specific values from the response (based on the response properties/parameters)

‘You can then build a dictionary object and store these values

‘Dim responseObj

‘Dim httpResponseValueX, httpResponseValueY

‘httpResponseValueX = “”

‘httpResponseValueY = “”

‘Set responseObj = CreateObject(“Scripting.Dictionary”)

‘responseObj.Add “responseValueX”, httpResponseValueX

‘responseObj.Add “responseValueY”, httpResponseValueY

End Sub

Function HTTPPost(sUrl, sRequest)

Dim oHTTP

set oHTTP = CreateObject(“Microsoft.XMLHTTP”)

oHTTP.open “POST”, sUrl,false

oHTTP.setRequestHeader “Content-Type”, “application/x-www-form-urlencoded”

oHTTP.setRequestHeader “Content-Length”, Len(sRequest)

oHTTP.send sRequest

HTTPPost = oHTTP.responseText

End Function

–CODE ENDS–

Related Information: