.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Calling JSON service on remote server (server side)?

Posted By:      Posted Date: October 25, 2010    Points: 0   Category :ASP.Net

Hey guys, i am building this application on the 3.5 and i am in the need of calling the JSON web service that resides on the remote URL. This service only supports POST so it seems I cant use the "add web reference" from the 2008 studio so i guess is i need to go about connecting and retrieving data manually. I am assuming i need to build some kind of a proxy to connect with it. One last thing, it needs to be on a server side.

Can you please point me into the right direction?


View Complete Post

More Related Resource Links

calling a web service on a remote server from an ASPX page

hi, I want to call a web service on a remote server. I've done "add web reference" in my project, and VS2005 has created the .discomap and .WSDL in the App_Web_Reference folder. When I try add the namespace representing the web server (the name I created when I added the web reference) by "using XXXXX;" the code does not compile because XXXXX is not defined. Have I missed any steps? thanks, -me

calling a web service on a remote server from a ASPX page (web site project VS2005)

HI,I am maintaining a web site project in VS2005 and have to call a new web service on a remote server. I've done add web reference, and created the .wsdl and .discomap files in the app_webReference folder.  When I try to create a object representing the web service in the code ( wsnamespace.serviceName ws = new wsnamespce.serviceName(); ) the code wouldn't compile.The web site project is already calling other web services. When I right click on the type representing the web service and "go to definition" it takes me to a proxy class (derived from of course SoapHttpClientProtocol) in the metadata. I think this is what's missing for  the new web service i'm trying to call. Have I missed any steps?Thanks in advance.-me

Error calling Web Service. The remote server returned an error: (500) Internal Server Error


I am trying to extend my Sharepoing 2007 workflow using Ilove Sharepoint custom workflow actions. I have successfully installed ilove sharepoint exposing the ILOVE SHAREPOINT WORKFLOWS. the workflow however returns an error message 500 internal server error. When i try to access
the same using asp.net application it seems to work.

Web service code

using System;

using System.Collections.Generic;

using System.Linq;


Calling a Server side function from Javascript without using PageMethods

Good Day alli have used PageMethods to access the server side functions in javascript , but now my problem is that with pagemethods your controls will not go throught the full page lifecyle and these leads me to have "Object not set for an instance of an object" error. Now can someone come with a differnt approach without using pagemethods. What i want is to call a server side function , i dont want to pass any parameters to itthanks

Calling WCF Service from SQL Server 2008



        I'm facing a problem in accessing a WCF Service from a stored procedure in SQL Server 2008. The error obtained is as follows. An pointers to solve this issue wud be very helpful.

Msg 6522, Level 16, State 1, Procedure USP_CLR_ADD, Line 0
A .NET Framework error occurred during execution of user-defined routine or aggregate "USP_CLR_ADD":
System.TypeInitializationException: The type initializer for 'System.ServiceModel.ClientBase`1' threw an exception. ---> System.Security.HostProtectionException: Attempted to perform an operation that was forbidden by the CLR host.

The protected resources (only available with full trust) were: All
The demanded resources were: Synchronization, ExternalThreading

   at System.ServiceModel.DiagnosticUtility.GetUtility()
   at System.ServiceModel.DiagnosticUtility.get_Utility()
   at System.ServiceModel.ClientBase`1..cctor()
   at System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()
   at System.ServiceModel.ClientBase`1..ctor()
   at TestServiceClient..ctor()
   at Channel.ServiceChannel.GetSum()


WCF session client service reference "State" is not updated when the server side has closed


I am using vb.net (Visual Studio 2008 with framework 3.5). I have a server that exposes several services requiring sessions. I am using wsHttpBinding for all. One of my requirements is to allow non-dot net third parties to access these services. When a client connects to a service and then some time later the server goes away, the state of the connection is still reporting "open".

Currently I have implemented a "ping" function on the server. My client calls this function every 5 to 10 seconds and if the server does shutdown, I get alerted with an exception error. This works, but I was wondering if there is a way where I don't have to call my ping function?

I don't want to use a dual connection binding and I was hoping to use the connection state variable? But, I don't know how to get it to update by itself. The client user application could just wait until it goes to invoke a service method, but I was wondering if there was another way.

Thanks in advance!!


Error : Unable to connect to the remote server, When using web service in window service

Hi All,

          I want to consume a web service in windows service but in windows service I am not able to access  web service. I have tried it in windows application and web application it is working fine but in windows service  it is not accessible.


i am getting error:-   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)--->   at System.Net.HttpWebRequest.GetRequestStream()
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at Testmachone.MachWebRef.SimCardWS.ProvisionImsiCard(String MsMin, String MsEsn, String CardId, String UserId, String Password, String MscId, String BId, String NewValue, ActionTypes Command, String MDN, String COS, String MIP_KEY, String MEID, String RADIUSPassword, String IMSI, Boolean PrePaid)

 any body can help me what could be issue


Calling Javascript confirm from server-side



This normally should not be difficult but I am just starting javascript.

The case is very simple.Before I delete  the record from the gridview ,I want to call the confim windows in order to give the user the opportunity of ok oe cancel.

in the client side I do not have any reference to javascript.

The first touch with it ,it happents in the following code:

 public void grdomas_RowDataBound(Object sender, GridViewRowEventArgs e)
            if (e.Row.RowType == DataControlRowType.DataRow)
                ImageButton  l = (ImageButton)e.Row.FindControl("imgdelete");

                l.Attributes.Add("onclick","javascript:return " + "confirm('Are you sure you want to delete this record? ')");

The image button is defined in the aspx as:
<asp:ImageButton ID="imgdelete"   runat="server" ImageUrl="~/Images/DeleteNew.bmp"  Width="20px" Height="20px" ToolTip="Delete" CommandName="Delete" CommandArgument='<%# Container.DataItemIndex + 1 %>'/>

Calling a javascript function from server side, using AJAX timer



I am developing a ASP.NET ajax application.
I am using a timer:

<asp:Timer ID="Timer1" runat="server" OnTick="Timer_Tick" Interval="5000" />      

The only thing I want to do is to call a javascript function on every tick of the timer:

 protected void Timer_Tick(object sender, EventArgs e)
            ClientScript.RegisterClientScriptBlock(this.GetType(), "blink", "<script>blinkit('2');</script>");

This doesn't work.
The javascript function is being called only if I put the 'RegisterClientScriptBlock' in the Page_Load.

How can I call the javascript every couple of seconds?

Thank you

calling server side events in javascript


How to call server side event(textchanged) in javascript. When the user enters the data in text box and directly closing the page with out allowing the textbox to fire the textchanged event when textbox autopostback property set to true. Now i want is when the user closes the page the changed text in textbox should affect the database and textchanged event should fire only once

mocking we service - Unable to connect to the remote server


I wanto to use a mocking web service, mocked with Soapui.But when I close the

main web service(stop the locally created web service in IIS) and try to call the mocked web service from an asp.net

project I got the error "Unable the connect the remote server".

How can I connect a mocked web service when having no connection to the actual web service.

Are anyone have any suggestion.

call JavaScript - jQuery code from ASP.NET Server-Side

jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.

call JavaScript - jQuery code from ASP.NET Server-Side

jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side

Accessing SharePoint 2010 Data with Server-Side APIs

Accessing SharePoint data in server-side solutions is one of the most common tasks that you will perform as a SharePoint developer. SharePoint 2010 provides powerful server-side APIs that enable you to retrieve, add, edit, and delete SharePoint data programmatically. SharePoint 2010 also includes the new LINQ to SharePoint technology that enables you to work with SharePoint data efficiently and easily.

Server side validation of Fileupload control not working



I've tried this method in my code behind to try and validate that the Fileupload control has a file or not. I get the error message the the event "Server Validate" cannot be found. Can anyone tell why? Thanks.

Public Sub CustomValidator1_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate

' Get file name

        Dim uploadAvatar As FileUpload = DirectCast(AdvertisementForm.FindControl("uploadAvatar"), FileUpload)

        Dim UploadFileName As String = uploadAvatar.PostedFile.FileName

        If UploadFileName = "" Then
            ' There is no file selected
            args.IsValid = False
            Dim Extension As String = UploadFileName.Substring(UploadFileName.L

server side does not save data when using POST data to another URL using WebRequest


 I am using a IIS 7.5 on Windows 7. I have a simple application that uses System.Net.WebRequest to POST data to another URL (in fact, the server side URL is on my local computer and it is hosted in IIS 7.5).

  1.  The problem is the server does not save data from client although on the client side codes when I debug and I see the OK message return from the code line

   response.StatusDescription; // this has value of "OK"
2. How can I debug the server code side where to receive the request from client side who posts the data ?

The following is the codes for client who posts data using System.Net.WebRequest, and codes for server side who received posted data to save to database.

Client side codes: // also run on my local computer

public string PostIntegrationXml(XmlDocument xmlSubmitDoc)




Calling webservice from the server


I have a sample web service and aspx file. I deployed them to an existing website that contains classic asp files.

web-service: --- using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; [WebService(Namespace = "http://localhost/MyWebServices/")] public class MembershipRegisWebService : System.Web.Services.WebService { public MembershipRegisWebService () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] public string HelloWorld() { return "Hello World."; } }

aspx.cs file: --- using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.Services; public partial class CallWebService : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { MembershipRegisWebService mrWs = new MembershipRegisWebService(); Response.Write("Calling web service:" + mrWs.HelloWorld()); } }

It runs locally, but it shows an error when running it from the server:

Server Error in '/' Application. Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the follow

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend