Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

calling a web service from asp.net/vb without visual studio

Posted on 2004-08-12
5
Medium Priority
?
338 Views
Last Modified: 2006-11-17
Our online application needs to consume a web service to implement a GIS system.

We do not use Visual Studio.

Using Web Matrix, I followed the simple process of simply typing in the URL of the WSDL of the service, giving it a namespace to refer to (let's say, 'mapTest'), creating the proxy dll, dropping it into the /bin directory; then I tried to call its methods from the appropriate ASP.Net page.

However, when I attempt to call a method (the only one of interest is 'getMaps()', I always get the following error: "getMaps() is not a member of mapTest."

I've tried this with the dll, using a codebehind file of the vb source, and et cetera. I have no idea what the problem is. I guess I'm lost with all the 'Namespace' junk. There's a class defined in the vb file of course, but I'm confused as to where or how I should bring the code into being available from the aspx file. I've tried using the <%@import namespace%> directive, but I don't know what to put in there. I also tried putting an 'inherits' attribute in the page declaration and using the vb file Web Matrix generated; but after getting the syntax correct after much trial and error, I end up with the same error: 'getMaps() is not a member of mapTest'.

I was under the impression that the dll file generated by Web Matrix (or whatever compiler you use) was supposed to encapsulate the interface with the web service and simply expose the methods available. But after dropping the generated dll into /bin and calling getMaps() by itself, I get the error "getMaps() is not declared". If I qualify the getMaps() function call with the namespace I used when generating the dll - this amounts to mapTest.getMaps() - then I'm back to the original error, that getMaps is not a mamber of mapTest.

I'm obviously not getting anywhere, so any input is appreciated. I may give extra points if the solution is quick, complete and correct! Thanks in advance!
0
Comment
Question by:k3n51mm
[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
  • 2
5 Comments
 
LVL 7

Expert Comment

by:nepali
ID: 11785203
HI,
I really don't know how does web matrix works when generating proxies.. what u can try is trying generating the proxy using the wsdl utility at command prompt.. for eg.

wsdl /language:VB /out:myProxyClass.vb http://hostServer/WebserviceRoot/WebServiceName.asmx?WSDL

it will generate a .vb file for u... look at the source code and see the namespace hierarchy.. then compile the .vb to a dLL using the normal way.. and then try using it in the asp.net page.

Regards
Mahendra

0
 
LVL 1

Author Comment

by:k3n51mm
ID: 11785562
Thanks for the response,

when you say:  "look at the source code and see the namespace hierarchy.. "

I guess that's my problem. I don't know what I'm looking for. Here is what wsdl generated, which by the way I did already try, and web matrix generates exactly the same file. By seeing the namespace hierarchy in the code below, how would you 1)reference the compiled dll and 2)call the method below called getMaps()? That's what I need to know. A code example is all that I can understand at this point, since I'm not experienced enough as a web service/SOAP developer to be able to interpolate non-code comments. Thanks.

'------------------------------------------------------------------------------
' <autogenerated>
'     This code was generated by a tool.
'     Runtime Version: 1.1.4322.573
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated.
' </autogenerated>
'------------------------------------------------------------------------------

Option Strict Off
Option Explicit On

Imports System
Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Xml.Serialization

'
'This source code was auto-generated by wsdl, Version=1.1.4322.573.
'

'<remarks/>
<System.Diagnostics.DebuggerStepThroughAttribute(),  _
 System.ComponentModel.DesignerCategoryAttribute("code"),  _
 System.Web.Services.WebServiceBindingAttribute(Name:="SampleLocationSoapQueryServerSoapBinding", [Namespace]:="http://demos.latitudegeo.com/imf406_soap/services/SampleLocationSoapQueryServer")>  _
Public Class SampleLocationSoapQueryServerService
    Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
   
    '<remarks/>
    Public Sub New()
        MyBase.New
        Me.Url = "http://demos.latitudegeo.com/imf406_soap/services/SampleLocationSoapQueryServer"
    End Sub
   
    '<remarks/>
    <System.Web.Services.Protocols.SoapDocumentMethodAttribute("", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Bare)>  _
    Public Function getMaps(<System.Xml.Serialization.XmlElementAttribute("getMaps", [Namespace]:="http://sampleLocationSoapQuery.geocortex.net")> ByVal getMaps1 As Object) As <System.Xml.Serialization.XmlElementAttribute("getMapsReturn", [Namespace]:="http://demos.latitudegeo.com/imf406_soap/services/SampleLocationSoapQueryServer")> Object
        Dim results() As Object = Me.Invoke("getMaps", New Object() {getMaps1})
        Return CType(results(0),Object)
    End Function
   
    '<remarks/>
    Public Function BegingetMaps(ByVal getMaps1 As Object, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult
        Return Me.BeginInvoke("getMaps", New Object() {getMaps1}, callback, asyncState)
    End Function
   
    '<remarks/>
    Public Function EndgetMaps(ByVal asyncResult As System.IAsyncResult) As Object
        Dim results() As Object = Me.EndInvoke(asyncResult)
        Return CType(results(0),Object)
    End Function
End Class
0
 
LVL 1

Author Comment

by:k3n51mm
ID: 11790464
Okay, in case anyone comes here looking for the answer to this:

wsdl.exe is not to be trusted to provide a turnkey solution for creating a proxy dll. End of story. Use it for a template, then customize it, unless you have the most innocuous web service in town.

The first time I ran it, it assigned a datatype of String to a parameter expected in both synchronous and asynchronous SOAP messages. The second time, it did a little better: it assigned a datatype of Object. I was passing a system.data.dataset type to the service; so I had to manually recompile the dll using vbc in the Framework SDK from the command line, after making the following changes:

Add to .vb source file:    Imports system.data
Add to aspx file:            dim new instance of web service object, not just call it implicitly

change in vb source: references to the input parameter getMaps1 (listed above) to type DataSet

recompile using vbc. I also created a .rsp file and added it to the compilation command, so I'd get all the Framework libraries if needed, without having to manually type them in every time I run vbc. Google for it and you'll find it.

That's it. Microsoft adds a bunch of stuff to the outgoing SOAP message as well, so be prepared to beg your web service provider to filter it all out before it will work right for you. This stuff is still a bit of a black art, but I guess the technology's still a little immature. I earned my own 250 points this time.
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 12117258
PAQed, with points refunded (250)

Computer101
E-E Admin
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

604 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