Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 277
  • Last Modified:

Calling a Web Service in VB.NET

Afternoon All,

PLEASE can someone help me before I go stir crazy in trying to figure this out. I am a SQL DBA that has self taught myself some VB.NET to interact with the SQL databases we have in-house for data input etc.

I have a web service that I am trying to build a 'Loader' for as the provided Java based one the company in question gave us cannot deal with multiple files and can only deal with one file at a time.

https://openinterchange.openecommerce.co.uk/OpenInterchange/OpenInterchange?wsdl

This is the URL of the WSDL. I have some automation software that has an inbuilt WebService/WCF Executer, while this is great to look at and does the job it doesn't work with my .NET so I am having to do this myself manually.

Essentially I need to fire some XML using a particular FUNCTION from the above WSDL to return a response to my application.

Now according to the automation program it uses the 'OpenInterchange' Class and then uses the OpenInterchange.XStreamMessage(x,x,x,x,1) METHOD to return the information.

I ended up with something along the lines of

        Dim MyService As New XstreamUAT.xStreamMessageRequest(brokreftxtbx.Text, bnumtxtbx.Text, lickeytxtbx.Text, "This", 30)

        Dim MyResult As New XstreamUAT.xStreamMessageResponse(MyService.ToString)

        MsgBox(MyResult)

Open in new window


But I'm getting nothing, I am obviously completely missing the point. I can't give you details to login to their WSDL but with the link I think there is enough information there to point me in the right direction.

All help appreciated.
0
Lynchie435
Asked:
Lynchie435
  • 5
  • 4
1 Solution
 
it_saigeDeveloperCommented:
Have you already added a Service Reference to your project or used the wsdl utility to generate the service proxy class?

-saige-
0
 
Lynchie435Author Commented:
I have already added a Service Reference. :)
0
 
it_saigeDeveloperCommented:
Have you created the OpenInterchangeClient?

Example -
Sub Main()
	Dim client As New ServiceReference1.OpenInterchangeClient("There needs to be something here", "And possibly something here") ' Depended upon your constructor usage.
	Dim return = client.xStreamMessage(brokreftxtbx.Text, bnumtxtbx.Text, lickeytxtbx.Text, "This", 30)
End Sub

Open in new window


-saige-
0
Cyber Threats to Small Businesses (Part 1)

This past May, Webroot surveyed more than 600 IT decision-makers at medium-sized companies to see how these small businesses perceived new threats facing their organizations.  Read what Webroot CISO, Gary Hayslip, has to say about the survey in part 1 of this 2-part blog series.

 
Lynchie435Author Commented:
Hi Saige,

I tried

        Dim client As New XstreamUAT.OpenInterchangeClient("XstreamUAT", "https://www.openinterchange.co.uk/OpenInterchange/OpenInterchange?wsdl") ' Depended upon your constructor usage.
        Dim strresult = client.xStreamMessage(brokreftxtbx.Text, bnumtxtbx.Text, lickeytxtbx.Text, "This", 30)

Open in new window


But it returned :

Could not find endpoint element with name 'XstreamUAT' and contract 'XstreamUAT.OpenInterchange' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this name could be found in the client element.
0
 
Lynchie435Author Commented:
Saige - you put me in the right ballpark.

2 Lines of code is all it took!

        Dim client As New XstreamUAT.OpenInterchangeClient()
        XMLResponseTxtBx.Text = client.xStreamMessage(brokreftxtbx.Text, bnumtxtbx.Text, lickeytxtbx.Text, "This", 10)

Open in new window

0
 
Lynchie435Author Commented:
Put me in the right ballpark!
0
 
it_saigeDeveloperCommented:
This might be closer to what you are looking for:
Imports System.ServiceModel

Module Module1
	Sub Main()
		'Specify the binding to be used for the client.
		Dim binding As New BasicHttpBinding(BasicHttpSecurityMode.Transport)

		'Specify the address to be used for the client.
		Dim address As New EndpointAddress("https://openinterchange.openecommerce.co.uk:443/OpenInterchange/OpenInterchange")

		' Create a client that is configured with this address and binding.
		Dim client As New ServiceReference1.OpenInterchangeClient(binding, address)
		Dim [return] As String = client.xStreamMessage("test1", "test2", "unlicensed", "This", 30)
		Console.WriteLine([return])
		Console.ReadLine()
	End Sub
End Module

Open in new window


Produces the following output for me:Capture.JPG
Which we know is invalid for your use, but proves that I am getting a response from the service.

-saige-
0
 
Lynchie435Author Commented:
Saige - you are a gentleman and a scholar :)
0
 
it_saigeDeveloperCommented:
Not a problem.  Glad I was able to assist.  ;)

-saige-
0

Featured Post

2017 Webroot Threat Report

MSPs: Get the facts you need to protect your clients.
The 2017 Webroot Threat Report provides a uniquely insightful global view into the analysis and discoveries made by the Webroot® Threat Intelligence Platform to provide insights on key trends and risks as seen by our users.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now