calling a web service from without visual studio

Posted on 2004-08-12
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!
Question by:k3n51mm
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

Expert Comment

ID: 11785203
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 page.



Author Comment

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.

<System.Diagnostics.DebuggerStepThroughAttribute(),  _
 System.ComponentModel.DesignerCategoryAttribute("code"),  _
 System.Web.Services.WebServiceBindingAttribute(Name:="SampleLocationSoapQueryServerSoapBinding", [Namespace]:="")>  _
Public Class SampleLocationSoapQueryServerService
    Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
    Public Sub New()
        Me.Url = ""
    End Sub
    <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]:="")> ByVal getMaps1 As Object) As <System.Xml.Serialization.XmlElementAttribute("getMapsReturn", [Namespace]:="")> Object
        Dim results() As Object = Me.Invoke("getMaps", New Object() {getMaps1})
        Return CType(results(0),Object)
    End Function
    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
    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

Author Comment

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 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
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.

Accepted Solution

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

E-E Admin

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
RLDC Reporting in Visual studio 11 45
C# MVC Insert Multiple Row into DB 2 65
Testing of the web services 1 52
Data organization issue 7 39
In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

730 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