Re: WinForms and WebServices



Cor,

The OP wants to create a WebService and a WebForms application to
access the WebService.

He will then send the WebService and WebForms application to other
people, who will install the WebService on their Web servers. Those
people will then want to run the WebForms application against the
WebService that is installed on their server. These other people are
perfectly capable of installing IIS and getting the WebService to run
on their servers.

Since the OP has no control over where the WebService is installed, he
needs a way for the other people to configure the WebForms application
to access the WebService running on their server. Presumably these
other people do not have Visual Studio.

On Sat, 9 May 2009 19:12:10 +0200, "Cor Ligthert[MVP]"
<Notmyfirstname@xxxxxxxxx> wrote:

You seems to keep the idea that I don't understand you, but there is nothing
that you wrote that I did not understand.

What you don't understand is that the webservice need to be installed in
IIS. That is a job which mostly is done as it is not your own system by a
systemadmin.

When that is installed your program can reference to that. At debug or
release time in Visual Studio a special for Visual Studio made Internet
Information Server is used. The one which is then used is some derived from
Cassini, which itself is derived from the Personal Webserver from Windows
98.

Cor

"Johnny J." <johnny@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:uCV5nSK0JHA.1432@xxxxxxxxxxxxxxxxxxxxxxx
Thank you, Cor - but you still don't answer my question I'm afraid. You're
still focusing on the wrong issues.

I'm aware of the security problems that can arise with this kind of an
arrangement, but I can assure you that a web service IS needed for the
purpose. How else do you imagine having programs on multiple computers all
over the world - not connected to the same network - access the same
database? This is however the discussion I do not wish to get into because
it's wasting my time and not solving my problems.

My problems is not at all as abstract as that - it's quite
straightforward. If I write in app my code:

Dim myWebservice as new MyWebServiceReference
myWebservice.InvokeMyMethod(byval PassThisParameter as Integer)

then it won't compile - because I don't have a reference to the web
service in my project - thus VS doesn't know what MyWebServiceReference is
and that a method called InvokeMyMethod (just an example) even exists.

So you say that I can change the web service URL in the config file at run
time... OK, That's one thing. That's an answer I can actually use, but
it's not answer enough...

I might even be able to ADD the service name in the config file at
runtime? (Because don't forget: at design time I don't have any reference
to add to the project)

But that doesn't answer my question of how I write the code and compile
the app when the compiler has no reference to "consult".

/Johnny J.




"Cor Ligthert[MVP]" <Notmyfirstname@xxxxxxxxx> skrev i meddelandet
news:%23pUsLcJ0JHA.3476@xxxxxxxxxxxxxxxxxxxxxxx
That was what I understood,

But you need to make yourself a program (you can set it in you windows
program but then you need probably roles as you have more users), which
change the configfile with the correct Url and Connection String.

That can be used as the web service are installed.
Like you told that you cannot controlled that, then you should not try to
do that.

As the web service (the same is with a normal service by the way) not
needed in your situation, then try to avoid it, therefore the advice from
the others this is not simply loading a dll, the web service is normally
open for the whole world as it is not done well.

This problem is for everybody the same, you can make a lot to make it
easier, but in the real world you cannot go around security (settings),
which is controlled by a system administrator.

Cor

"Johnny J." <johnny@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:u0pxD0H0JHA.4632@xxxxxxxxxxxxxxxxxxxxxxx
Sorry Cor, I appreciate you taking the time to review my question and
answers but you're focusing on the wrong thing and completely missing
the point.

The WHY is not the problem it is the HOW, and I explained that in my
original post. For some reason people are missing the point. I'll try to
elaborate again:

Let us say like this: I have programmed the webservice. It's done and
ready to be installed. I don't know where it will be installed and I
don't have the URL (even if I had it would be no help as the service is
not installed there yet).

Now I need to program the accompanying Winforms app. To be able to use
the methods and properties of the service I HAVE TO add a web reference
to the service in the application references and the VS guide that helps
you doing that has to be able to access the service itself to list it's
methods and properties.

This is not possible because the service is not installed live anywhere.
So I cannot add the web reference and thus I cannot create a web service
object instance and use the web service methods and properties in the
app.

That is my problem. I'm sure there's a good solution to it but if I knew
what that was, I wouldn't be asking the question.

Some thoughts that occurred to me while I wrote this answer:

1) I don't know if I could write the code anyway - I'm sure if I tried
to instanciate a web service object and use it's methods without having
the web reference, I wouldn't be able to compile the app? And I wouldn't
have any intellisense help. This method would also require that I could
set the reference later at runtime so that the winapp could actually
find the real (and by that time installed) service.

2) I don't know if I could simply reference my VS web service project
instead. This method would also require that I could set the reference
later at runtime so that the winapp could actually find the real (and by
that time installed) service.

3) I suppose I could install a "dummy" service on my own web server and
reference that. This method would also require that I could set the
reference later at runtime so that the winapp could actually find the
real (and by that time installed) service.

None of this seems like a real solution to me, so I was hoping somebody
else had had to do this before and was able to help me.

As I see it, my problem is sort of like loading a dll at runtime - only
with a web service instead.

Best regards
Johnny J.



"Cor Ligthert[MVP]" <Notmyfirstname@xxxxxxxxx> skrev i meddelandet
news:e5nhLmH0JHA.1420@xxxxxxxxxxxxxxxxxxxxxxx

As to your questions about WHY I want to do this: I'm afraid I cannot
tell you that at this point, and a discussion about the puporse is not
in the least helpful to me.

That makes help difficult, that is the same as somebody who comes to a
doctor and tells: I need to use cocaine, but I want to keep my health
all the time.

But the main standard answer is, set your variables in the
app.config.sys
(Just open the code for the web service, the url is there somewhere)

The web service it self should be installed as every other asp.net
application.

Cor






.



Relevant Pages

  • Re: WinForms and WebServices
    ... I appreciate you taking the time to review my question and answers but you're focusing on the wrong thing and completely missing the point. ... To be able to use the methods and properties of the service I HAVE TO add a web reference to the service in the application references and the VS guide that helps you doing that has to be able to access the service itself to list it's methods and properties. ... So I cannot add the web reference and thus I cannot create a web service object instance and use the web service methods and properties in the app. ... I suppose I could install a "dummy" service on my own web server and reference that. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: WinForms and WebServices
    ... The OP wants to create a WebService and a WebForms application to ... who will install the WebService on their Web servers. ... When that is installed your program can reference to that. ... So you say that I can change the web service URL in the config file at run ...
    (microsoft.public.dotnet.languages.vb)
  • Re: WinForms and WebServices
    ... When that is installed your program can reference to that. ... I'm aware of the security problems that can arise with this kind of an arrangement, but I can assure you that a web service IS needed for the purpose. ... But that doesn't answer my question of how I write the code and compile the app when the compiler has no reference to "consult". ... I suppose I could install a "dummy" service on my own web server and reference that. ...
    (microsoft.public.dotnet.languages.vb)
  • RE: WebService deployment
    ... You can change the web service to have a dynamic url and then set the value of the url during runtime after your code reads it from some configuration storage location. ... I have an ASP.NET application that having a reference to a DLL that have a reference to a WebService, ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: WinForms and WebServices
    ... I'm aware of the security problems that can arise with this kind of an arrangement, but I can assure you that a web service IS needed for the purpose. ... then it won't compile - because I don't have a reference to the web service in my project - thus VS doesn't know what MyWebServiceReference is and that a method called InvokeMyMethod even exists. ... But that doesn't answer my question of how I write the code and compile the app when the compiler has no reference to "consult". ... I suppose I could install a "dummy" service on my own web server and reference that. ...
    (microsoft.public.dotnet.languages.vb)