Call "Web Service" from "Windows Service" in ASP.NET3.5 using VB.NET

Hello all developers,

I'm creating a ew website using Viasual Studio 2008(coding in VB.NET) and Sql Server 2005  for my Client which he asked me to build automated Email alerts or reminder for hs Users...,really I'm getting crazy now as I for 7 days a week try to build that "Windows Service" to call my "Web Service" to run sending regular Email to website users in a regular time.

for last week days I read many articles,now I decided to create a "Windows Service " to call the "Web Service" from my Web application,not it not works with me ,when I debugged the "Windows Service" raises error that "Not refer to an object",Please any one help me in that

my codes as follows:

Web Service:

<WebMethod()> _

Public Shared Function AddNewItem() As Integer

Using con As New SqlConnection(ConfigurationManager.ConnectionStrings("NamesDB").ToString)Dim cmd As New SqlCommand("INSERT INTO MyName (Fname,Lname) values ('Shaymaa','Hafez')", con)

con.Open()

Dim i As Integer = cmd.ExecuteNonQuery()

Return i

con.Close()

End Using

End Function

 

Windows Service:

Imports JobNowWS

Public Class Service1

Protected Overrides Sub OnStart(ByVal args() As String)

' Add code here to start your service. This method should set things

' in motion so your service can do its work.

Timer1.Enabled = True

Timer1.Start()

End Sub

Protected Overrides Sub OnStop()

' Add code here to perform any tear-down necessary to stop your service.

Timer1.Enabled = False

Timer1.Stop()

End Sub

Private Sub Timer1_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Disposed

Try

Dim obj As JobNowWS = New JobNowWS

'Return obj.AddNewItem()

Call AddNewItem()

Catch ex As Exception

''

End Try

End Sub

End Class

please answer me ASAP,my Client asked me to finish soon Crying


hoby333
0
hoby333
12/16/2008 6:17:48 PM
asp.net.xml-web-services 7071 articles. 0 followers. Follow

5 Replies
2708 Views

Similar Articles

[PageSpeed] 39

Please provide the full details of the exception, including any InnerException instances. Also, please remove the Try/Catch/End Try, as it simply hides any exceptions.

Finally, how did you add the web service to the Windows Service? Did you use "Add Reference"? If so, please remove that reference. You need to use "Add Web Reference".


John Saunders | MVP – Connected System Developer
0
johnwsaunders3
12/17/2008 3:54:33 AM

Hello John,

Thanx for Ur interest in my problem I face with "Web service", as I see U advise me to make reference with "Add Web Reference" which I not see it in Visual Studio 2008, please notify me wherer I can find this "Add Web Reference", and then I can continue debug and send U all result I g'll get.


hoby333
0
hoby333
12/18/2008 10:50:41 AM

Hi,

   You can follow these steps:

1. Open the solution in VS 2008

2. Right Click on the Project (Which is just below the Solution Name)

3. Select Add Web Reference

4. Provide the complete path of the Web Service URL in the window which is prompted.

If needed, you have to provide the credentials to access the web service (if web service requires authentication).


-Sri
-------------------------------------------------
If this post was useful to you, please mark it as answer. Thank you!
0
ksridharbabuus
12/22/2008 8:30:06 AM

Sorry, I thought I had replied. "Add Web Reference" is hidden in VS2008 because they want to encourage you to use WCF.

  1. Right-click the project and choose "Add Service Reference"
  2. Click the "Advanced" button
  3. On the "Advanced" dialog that appears, click the "Add Web Reference" button at the bottom
  4. Enter the URL and a namespace for the proxy classes and click ok. You may need to provide credentials for the web service.

John Saunders | MVP – Connected System Developer
0
johnwsaunders3
12/22/2008 2:56:57 PM
Thanx Contributor,it works well now Smile
hoby333
0
hoby333
12/22/2008 4:03:02 PM
Reply:

Similar Artilces:

Please compare "web service" and "remote services"
Somebody, please tell me the different beetween "web services" and "remote services". So, "web services" and "remote services" which one is better? Please tell me This might provide some insight. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/dotnetremotearch.asp The really question at hand is what kind of project? Frank ...

"Dynamic" Web Services, "Dynamic" Parameters
This is a follow-up discussion from http://forums.asp.net/t/1332722.aspx?PageIndex=2. I noticed we stopped talking about Peter's problem some time ago. The discussion had become one of passing "XML strings" to a web service in order to permit optional parameters, a dynamic web service, and things like that. My contention is that this is a solution without a requirement. It is something that we can do, which does not imply that anyone needs us to do it. First of all, if you need to send XML, then send XML. Do not send a string that happens to have XML embedded in it. ASM...

What is "Web Service" (Begineer of .NET)
I have started few days before .NET.Earlier I am working on ASP. So I have decided to learn ASP.NET. I heard about the great thing Web Service on diiferenet site.But couldnt understand. How it can work.What is the purpose. From which refernce sites I can learn. Plz I need ur Assistance. See my article in below link, I did this for beginners, probably it will helps you! http://www.w3coder.com/ws/WSGWBook/WebServGW-01.XMLSreedharhttp://www.w3coder.orgweblog http://weblogs.asp.net/skoganti...

"□" character is not taken by the XML web service in .net framework??
Dear all, I am developing a simple smart device application using XML web services for Oracle database connection with smart devices.In this application I am simply taking the data from the textbox in the mobile,encrypting it & finally sending it to the oracle database using XML web services.i am using .net framework for the whole.But the problem is that as I am trying to send the data to the oracle database after encryption of some strings/characters,one special character "□" is not taken by the XML format in the web service.It is giving error by saying that it is invalid character for...

Programatically build Web Service proxies independent of the "Web Reference" in VS.Net?
Can anyone detail for me how to build a proxy for a webservice from its .wsdl without using a "web reference"? Or point me to a hotw-to somewhere? I assume there is an API for this in the Framework, I just cannot find it... Thanks.Thanks,B You have to use WSDL.eXE you can see info on it @ http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/html/cpgrfWebServicesDescriptionLanguageToolWsdlexe.asp Hope it helps!Sreedharhttp://www.w3coder.orgweblog http://weblogs.asp.net/skoganti For complete programmatic use of dynamic Web services by simply feedi...

It is showing invalid character "□" by the XML web services in .net framework
 Hi, I am developing an smart device application where I am taking some data through mobile device,encrypting it & finally trying to insert it to the Oracle database by using XML web services.But my problem is that after encrypting the data & taking ASCII encoding of that data,I am getting one special symbol "□" which is not taken by the XML web services by showing the error that its invalid character for the XML format.SO as a result I am not able to insert the encrypted data into the Oracle Database. Can anyone give any solution of this problem? Waiting for your r...

"Add Web Reference" -vs- "Add Service Reference"
I've noticed that in VS 2008 I can add a reference to a web service through "Add Service Reference..." or "Add Web Reference".  It appears that either of these approaches works but there are some differences in the naming of the client-side proxy that's generated.. Does "Add Service Reference" take advantage of the 3.5 framework?  Does this approach gain any efficiencies if I'm still adding the reference for an asmx web service rather than a WCF service?  Or does "Add Service Reference" for an asmx web service just pr...

adding web reference, remote web service. "unable to download service.asmx?wsdl"
Hello having a problem with this web service. VS [2005]  The message we get when we try and add the web reference is "unable download following files http://10.0.1.7/codered/service.asmx?wsdl". Which is using the internal ip address of the web server. We have check the IIS where the web service has been published to. But could not see why it is using the internal ip and not the external ip address. The actual url is http://83.100.199.125/codered/service.asmx Here is the service description sample, maybe someone can check this, as this has the internal ip address at the bottom. wsdl:definitions targetNamespace="http://tempuri.org/" wsdl:types> s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/" wsdl:binding wsdl:service name="Service" wsdl:port name="ServiceSoap" binding="tns:ServiceSoap" soap:address location="http://10.0.1.7/codered/service.asmx"/ wsdl:port wsdl:port name="ServiceSoap12" binding="tns:ServiceSoap12" soap12:address location="http://10.0.1.7/codered/service.asmx" wsdl:port wsdl:service wsdl:definitions I am really hopping someone can help me with this problem. Many thanks if you can, Steve When you add your web reference, use xxxxx/service.asmx?WSDLNow, for some reason, your wsdl referneces your internal address, so in the client web.config, you need to change the appsetting governing the location.The easy fix to the problem is to generate the wsdl document using visua...

Web Service Strange Error "Service Description altering attributes cannot be specified on service implementation. "
G'day folks;I built a web service based on a given XLM request message and XML response message following the guidelines provided by Yasser Shohoud in his article "Place XML Message Design Ahead of Schema Planning to Improve Web Service Interoperability"  I used given response and request documents provided by a user manual for an Air Force web service that returns weather imagery.  The web service built correctly.  There was some confusion at first because Yasser used C# and I used vbNet.  The wsdl.exe created a stub file with an interface called IWeatherSe...

"Visual Web Developer Web Server" and Web Services
I like the new "Visual Web Developer Web Server" (Do you want suggestions for a longer name!) but I have an issue with using it to host a Web Service. Whenever the Web Service is recompiled and run it ends up with a different port number. Therefore, it seems that any references to that WS in other applications are invalidated and need to be re-established when it's run again. Is there a way of pinning the port number, or am I missing something? CheersNick Grattan, MSDN Regional Director, Ireland. Software Paths Limited. Hi Nick, the internal server is used for local...

"no service in WSDL file " in Web Service Proxy Wizard
I'm trying to follow the "EAServer Web Service Using PowerBuilder Component and Client" tutorial but when I get to the Select Service window(after just having entered the WSDL file name in the previous window) I get "There is no service in the WSDL file." and the Services list is empty. I found an earlier post where this problem seemed to be resolved by combining the 2 WSDL files(pb_hello.wsdl and pb_helloImpl.wsdl) into one file, but this has not worked for me. Has anyone else had this problem? ...

A "Web Application Project" for web-services ?
I was wondering if there is something analogous to the "Web Application Project" VS add-in for Web-services. By analogous I mean: 1. All the source files in a Web-services project is compiled into a single assembly, perhaps with the exceptions of the .asmx file 2. Property pages for the project in VS display all the tabs that are available in other kinds of projects - i.e., for example, ability to specify pre and post build events, the XML documentation file etc. I really appreciate any help. Cheers, Adrigo Yes, the current release supports creating an "ASP.Net Web Service Applica...

Web Service exception: "The handle is in the wrong state ..." in local net
Hi, I wrote a Web Service that works correctly in one server that has a public domain, but when I install the same Web Service under a server that has only access in the local network, the client application gets an exception that returns a message such as: The handle is in the wrong state for the requested operation. In such local network setup, instead of calling the web service from the client application giving the domain, I call it using the IP, could such a thing cause the problem ? or is there a way to get the web services requests from clients in the server side ? Thanks ...

simple web service query
Hi all, Im following the 'Using the WebService Behaviour' document from the msdn Library and am getting the message 'service unavailable' when running my page. Is there something I'm missing? thanks, Pete mWeb Design Nottingham, UK...

Using "+" or "||"
Using SQLAnywhere 5.5.04, I've gotten into the habit of using "||" in ISQL to indicate a string concatenation. I needed to paste my SQL statement into the PowerBuilder script painter for some embedded SQL, and PB didn't like the "||" very much at all. I changed it to "+" and it seems to be ok. Do these two operators indicate ~exactly~ the same thing? moin, afaik these two's are not the same! if you're using "||" and any term is NULL then in the resultstring the term will be ignored if you use "+" then the resutlstring is NULL mfg ========================== andatec gesellschaft f�r angewandte datentechnik mbh Ruwoldtweg 15 22309 hamburg --------------------------------------- Dipl.-Ing. G�nther Jungbluth gjungbluth@andatec.de ========================== "Rick Charnes" <rick.charnes@state.ma.us> schrieb im Newsbeitrag news:MPG.131a21059f288db49896ba@forums.powersoft.com... > Using SQLAnywhere 5.5.04, I've gotten into the habit of using "||" in > ISQL to indicate a string concatenation. I needed to paste my SQL > statement into the PowerBuilder script painter for some embedded SQL, and > PB didn't like the "||" very much at all. I changed it to "+" and it > seems to be ok. Do these two operators indicate ~exactly~ the same > thing? You are comparing two different "languages" here: Powe...

"Using" or "With"
Hi all Please can someone enlighten to me as regards the difference with the "Using" and "With" statement when accessing data - which is better, what are the limitations and/or any pointers. Many thanks. Regards DaveDavid WinchesterPlease mark as answer if this is the solution.  using gives you the ability to use the connection and it closes the connection directlly after you finish using it. and there is no need to try- cach - finaly. there is no limitation on using USING keywordMuhanad YOUNISMCSD.NETMy Blog || My Photos || LinkedIn I have a dataobject the re...

Problem regarding "Enlarging pushpin Size" using mappoint web service in Mobile Web Application
Problem regarding "Enlarging pushpin Size" using mappoint web service in Mobile Web Application   I'm using MapPoint web service to show maps in Mobile Web App. I'm able to show the map. But, problem is, I can not enlarge Pushpin and Pushpin label size. When I set the font size property of the map to "Largest" it doesn't make Pushpin or Pushpin label size larger.   Any body knows how to do it?...

"Private" web service
Hi I’d like to create a web service as part of a web site. I don’t want the web service to be exposed to the internet, And that only pages inside the site would be able to access and use the web service.  Is it possible to do it?   Thanks Z  Hi there,              yes it is possible, take a look at this link http://msdn2.microsoft.com/en-us/library/Aa480545.aspx                I think you will have to implement a Perimeter Service Router (Chapter 6)  to ...

"out" parameters in Web Service
Hello, I was wondering if it is possible to invoke a web service method that has an "out" parameter from javascript and what would be the syntax. Consider the following web method: [WebMethod][ScriptMethod]public string Echo(string text, out string val) { val = text; return text;}  Then I invoke this method in my .aspx page:  <%@ Page Language="C#" AutoEventWireup="true" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server">...

web service "is not defined"
I recently upgraded to Ajax 1.0 from ATLAS and now my web services are not working. My service references are not working, I get the "[namespace] is not defined" JS error. However, i can see that the [webservice].asmx/JSDEBUG scripts are being referenced fine. I assume the problem is with my configuration; here is the (important) contents of my Web.Config:1 2 <configuration> 3 <configSections> 4 <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutra...

.ALLCOL("%COLUMN%", " ", ", ", ", ")
Do you know anyway for me to exclude a subset of columns returned by this function. We have two columns (rec_user and rec_datetime) which are in all of our tables, but when generating triggers I want automatically generate a script which does not include those two columns but does include all other columns in that table. Bruce I should add that I am using PD 9.0.0.580. Bruce "Bruce Lamb" <lamb.bruce@mayo.edu> wrote in message news:6HgI315nCHA.155@forums.sybase.com... > Do you know anyway for me to exclude a subset of columns returned by this > function. ...

Precedence of "where" ("of", "is", "will")?
Nobody on #perl6 today could answer this one. Is: Str | Int where { $_ } the same as: (Str | Int) where { $_ } or: Str | (Int where { $_ }) ? Followup questions, Mr. President: What kind of operators are "where", "of", "is", and "will"? Is there a reason that S03 doesn't list them? What are their precedence(s)? -- Chip Salzenberg - a.k.a. - <chip@pobox.com> Open Source is not an excuse to write fun code then leave the actual work to others. Chip Salzenberg writes: &...

Using a "Set of X" in a web service? [Edit]
I am trying to use a "Set of X" in a web service. (I am using Delphi 2010) I have done some searching, but I am not finding anything that seems to say if this is legal or not. Here are some code snippits of what I am trying to do: type TAllowedConversation = (acStdConv, {1} acOptConv1, {2} acHospConv, {4} acAltKeyMapN, {8} acAltKeyMapS, {16} acAltKeyMapX, {32} ...

How to call a .net web service from another .net web service?
Hi all,I have developed two asp .net web services using visual studio .net 2003.I wish to call one web service from another web service.I tried adding a web reference of the web service in another web service and was able to do so.but i m not able to access the web methods provided by the web servicecould you please suggest a way to go about itExpecting quick replyThanxCharmy try to make sure that you reference it in the web reference and call it properly this is sample  [WebMethod()] public double CalcDistance(int x1, int y1, int x2, int y2) { Calculator.Service1 calc = new...

C#.Net "Double" and "double" When/Where to use?
Hi all     Please let me know the difference between "Double" and "double" in c#.Net (I understand that "Double" is structure      and "double" is an instance to that structure) differences if any thing else.     Also the context in which both has been used.(When/Where to use both). thanks all...      hi,my brains says Double is reference type & double is value type.regards,satishKind Attn: If a reply to your post helped you, kindly mark it as Answered.__________________________________________________Please save Animals Help World Society For Protection Of Animals, Protect these speechless creatures of GOD hi,my brain says Double is reference type & double is value type.regards,satishKind Attn: If a reply to your post helped you, kindly mark it as Answered.__________________________________________________Please save Animals Help World Society For Protection Of Animals, Protect these speechless creatures of GOD Double = double = same thing Puzzles, brain teases, riddles, enigmas: http://www.toysforthebrain.com Both are same. Have a look at thisDifference between Double and doubleThanksMark post(s) as "Answer" that helped youElectronic ScrewWebsite||Blog||Dub@i.net yea es you are right thanks man.regardssatishKind Attn: If a reply to your post helped you, kindly mark it as Answered._____________________________________...

Web resources about - Call "Web Service" from "Windows Service" in ASP.NET3.5 using VB.NET - asp.net.xml-web-services

Resources last updated: 3/4/2016 2:29:03 PM