Iain Hodgen
asked on
Convert vb .NET webservice to C~
I have the following function to retrieve an xml string from a web service (which works fine).
Does anyone know how to do the c# equivalent - new to c# and stuck!!
Cheers,
Iain
Does anyone know how to do the c# equivalent - new to c# and stuck!!
Public Function apwGetCHS() As String
Dim serviceURL As String = "https://mywebsite.com/provider/proxy/caseExport/"
Dim paramsSB As New StringBuilder
Dim ReturnString As String = ""
'create the parameterised string for the URL
paramsSB.Append("CHSUserName=myusername")
paramsSB.Append("&CHSOrganisationID=org")
paramsSB.Append("&CHSPassword=password")
paramsSB.Append("&CHSCRN=crn")
Dim params As String = paramsSB.ToString
Dim xmldoc As Object
Dim oxmlHttp As Object
oxmlHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
oxmlHttp.Open("POST", serviceURL, False)
oxmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
oxmlHttp.send(params)
'msgbox "ok"
If oxmlHttp.status = 200 Then
' icmd = "alert('" & oxmlHTTP.statusText & "')"
'
xmldoc = CreateObject("Microsoft.XMLDOM")
xmldoc.loadXML(oxmlHttp.responseText)
Try
If FilePath(23) = "" Then
Else
xmldoc.Save("testxml.xml")
End If
Catch ex As Exception
End Try
Else
'log the error
End If
Return ReturnString
End Function
Cheers,
Iain
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi Author,
Is this done :) ?
Regards,
Pawan
Is this done :) ?
Regards,
Pawan
Hi Iain;
Still waiting a response from my last post. Did that resolve the issue?
Still waiting a response from my last post. Did that resolve the issue?
ASKER