Solved

Calling a Web Service in VB.NET

Posted on 2014-11-19
9
257 Views
Last Modified: 2014-11-19
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
Comment
Question by:Lynchie435
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 34

Expert Comment

by:it_saige
ID: 40452399
Have you already added a Service Reference to your project or used the wsdl utility to generate the service proxy class?

-saige-
0
 

Author Comment

by:Lynchie435
ID: 40452404
I have already added a Service Reference. :)
0
 
LVL 34

Accepted Solution

by:
it_saige earned 500 total points
ID: 40452491
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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

Author Comment

by:Lynchie435
ID: 40452534
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
 

Author Comment

by:Lynchie435
ID: 40452590
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
 

Author Closing Comment

by:Lynchie435
ID: 40452591
Put me in the right ballpark!
0
 
LVL 34

Expert Comment

by:it_saige
ID: 40452607
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
 

Author Comment

by:Lynchie435
ID: 40452615
Saige - you are a gentleman and a scholar :)
0
 
LVL 34

Expert Comment

by:it_saige
ID: 40452617
Not a problem.  Glad I was able to assist.  ;)

-saige-
0

Featured Post

Put Machine Learning to Work--Protect Your Clients

Machine learning means Smarter Cybersecurity™ Solutions.
As technology continues to advance, managing and analyzing massive data sets just can’t be accomplished by humans alone. It requires huge amounts of memory and storage, as well as the high-speed power of the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

While working on Silverlight and WCF application, I faced one issue where fault exception occurred at WCF operation contract is not getting propagated to Silverlight client. So after searching net I came to know that it was behavior by default for s…
To properly understand GitHub, let’s divide it into two words ‘Git’ and ‘Hub’. Git is basically a ‘Distribution Version Control’ (DVC) and ‘Source Code Management’ (SCM) system widely used by software programmers while Hub means the efficient centre…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question