Example in VB.net / SOAP API

Hey guys, does anybody can provide me an example how to use Bigfix Soap API in VB.net?
Unfortunaetly I only find examples written in C#!

Thanks a lot!

bifrost,
I could not find an example to share…It is surprising how little I have seen VB in the last four years. I created this example for you [here][1]. Link?

The tricky part for most would probably be adding the web reports soap API to an existing VB Visual Studio project…That is not Bigfix specific, just does not feel intuitive. To add a service reference to the project. Right click on the project, select Add, Service Reference, then input your web reports server name. Note: I used http://[ServerName]/webreports?wsdl because my web reports server runs on port 80. http://[ServerName]:[WebReportsServerPORT]/webreports?wsdl.

here is a snippet of code that will tell you the number of computers that are reporting to your IEM Web reports server.

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click 'String to define web reports server name. Dim strWebreports As String = "http://Bigfix:80/webreports?wisdl" 'String to define web reports user name. Dim strUser As String = txtUserid.Text 'String to define web reports password. Dim strPassword As String = txtPassword.Text 'WebService Object. Dim wr As New ServiceReference1.RelevancePortTypeClient("RelevancePort", strWebreports) 'hold the results. Dim ar() As String ' Session relevance string Dim strSessionRelevance As String = "number of bes computers" Try ' open da connection. wr.Open() ' get Relevance results and set ar to hold them. ar = wr.GetRelevanceResult(strSessionRelevance, strUser, strPassword) ' close da connection. wr.Close() ' show me the result MessageBox.Show(ar(0)) Catch ex As Exception MessageBox.Show("Error Number : " & ex.ToString) End Try End Sub

That should be able to get you some place. Let me know if you need more help. Happy Holidays!
-Jgo

3 Likes

Thank you a lot for your code . Just such an example I have searched in vain, until now :smile: . But i have unfortunately one big Problem, when i try to run this code, the ex.message returns: “(417) Expectation Failed”. Strangely, I can add the service reference without any problems and the services are also found from VB.net. Also the URL is correctly.
Maybe you can help me a second time? I would be very grateful.

Wish u Happy Holidays too.

Regards,
bifrost

bifrost,
every time I have seen a 417 in relation to web services it has been proxy or firewall related… Couple questions…

  1. is web reports using ssl?
  2. Are you working in a fire walled or heavy web proxy environment?
  3. Can you connect to soap through a web browser?
    Let me know some more details. …
  • jgo

Hello jgo,

thanks for your answer

1.) Web Reporst do not use SSL
2.) Yes we have a Web Proxy Enviroment.
3.) How do I connect to SOAP via Web Browser?

Thanks a lot,
Regards

IN response…

  1. No use of SSL. Good!
  2. Proxies are fun to work around. Please respond with connection results from #3.
  3. Soap Via the web browser… try this link: http://[ServerName]:[PortNumber]/webreports?wisdl

Have a great day.
-jgo

Hello jgo,

I can connect to SOAP via web browser. This way it seems connection to soap is established
without any errors… Connection via VB.net ist not possible until i manually deactivate Proxyserver in Internet Options…
So i will work for a solution in this case. Maybe i can bypass proxy during connection establishment.

Thanks a lot for your help jgo!

Regards!

Dim client
Dim result
’ Query mediante SOAP
Set client = CreateObject(“MSSOAP.SoapClient”)
client.MSSoapInit “http://WEB_REPORTS_SERVER/webreports?wsdl”
result = client.GetRelevanceResult ( “names of bes computers”,“USERNAME”, “PASSWORD”)

For Each res in result
Wscript.echo res
Next