Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Calling a Web Service in VB.NET

Posted on 2014-11-19
9
Medium Priority
?
273 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 1500 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
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 

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

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.

Question has a verified solution.

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

Here I am going to explain creating proxies at runtime for WCF Service. So basically we use to generate proxies using Add Service Reference and then giving the Url of the WCF service then generate proxy files at client side. Ok, what if something ge…
New Relic recently released its Synthetics product that allows for the creation of performance monitors that periodically test a site's performance. If you wish to test an interactive workflow New Relic employs Selenium WebDriverJS to run those test…
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

664 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