WCF / ASMX :: Return Dynamic / When Returns To Aspx Error At Aspx(no Exception Gets Caught At  @ Service)?

Feb 9, 2011

In our project WCF service is acting as our BLL.

i had scenario where i had to fill list of object class without knowing its type see code:

Added contract

[OperationContract]
dynamic GetReferenceTableData(string tableName);

method in service:

public dynamic GetReferenceTableData(string tableName)
{
try
{
dynamic tableData = ReferenceTableDAL.GetReferenceTableData(tableName);
return tableData;
}
catch (Exception ex)
{
throw;
}
}
method at DAL(ReferenceTableDAL):
public static dynamic GetReferenceTableData(string tableName)
{
Database db = DatabaseFactory.CreateDatabase(Flags.ConnectionStringKey);
DbCommand dbCommand = db.GetStoredProcCommand("USP_GETTABLEDATA");
dynamic objDynamic = null;
if (tableName.ToLower() == "a")
{
objDynamic = new List<A>();
}
else if (tableName.ToLower() == "b")
{
objDynamic = new List<B>();
}
else if (tableName.ToLower() == "c")
{
objDynamic = new List<C>();
}
try
{
db.DiscoverParameters(dbCommand);
dbCommand.Parameters["IN_TABLENAME"].Value = tableName;
DataSet dsTableData = db.ExecuteDataSet(dbCommand);
if (tableName.ToLower() == "a")
{
foreach (DataRow dataRow in dsTableData.Tables[0].Rows)
{
objDynamic.Add((A)dataRow);
}
}
else if (tableName.ToLower() == "b")
{
foreach (DataRow dataRow in dsTableData.Tables[0].Rows)
{
objDynamic.Add((B)dataRow);
}
}
else if (tableName.ToLower() == "c")
{
foreach (DataRow dataRow in dsTableData.Tables[0].Rows)
{
objDynamic.Add((C)dataRow);
}
}
}
catch (Exception ex)
{
throw;
}
return objDynamic;
}
@ Aspx
try
{
using (DataServiceRef.DataServiceClient petService = new DataServiceRef.DataServiceClient())
{
dynamic tableData = petService.GetReferenceTableData(tableName);
//tableData is null ,exception
}
}
catch (Exception ex)
{
throw;
}

There is no exception at dal or service end when i debug list gets filled ok but when returns to aspx error at aspx(no exception gets caught at @ service) but exception at aspx i.e:

Message:The underlying connection was closed: The connection was closed unexpectedly.
Stack Trace: at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)

View 3 Replies


Similar Messages:

WCF / ASMX :: How To Call Php Web Service From .aspx Without Adding Web Preference

Jun 18, 2010

I have a following php web service (nusoap-server-struct.php):

[code]....

how to call php web service from .aspx without adding Web Preference

View 2 Replies

WCF / ASMX :: Send Output Of Web Service From Xml As An Attachment To An Aspx Page?

Apr 8, 2010

i have designed a web service which would create 2 csv files on the system. I want to send the links to the location of the files as an url attachment over the aspx page.

like : http://myserver/download.aspx?file1=C: empimage1.png&file2=C: empimage2.png

the output from the asmx web service is : [Code]....

where xx.xx.xxx.xxx is the ipaddress. this is the whole output i get from the webservice.

how do i get the aspx page to send the attachment in the format i mentioned above? I have added an asp website to the project and added the webservice as a web reference to this but i do not know how to get the location from the xml output file of the webservice result.

View 2 Replies

Error Exception Code: 405 In Aspx When Insert A Row In Datagrid

Jul 26, 2010

I am using updatepanel in aspx with master page content, required validation control. IN that updatepanel I have one datagrid through that I am trying to insert a row. When I click that linkbutton then is shows error like "sys.webforms.pagerequestmanagerparsererrorexcepti on. Error code: 405" . I tried with another project this code works fine. How to overcome this. Some times error code 12031 also appear in prompt window. Error Received: The HTTP verb POST used to access path '/PMS/Marketing/' is not allowed. Stack Trace: at System.Web.DefaultHttpHandler.BeginProcessRequest( HttpContext context, AsyncCallback callback, Object state)

at System.Web.HttpApplication.CallHandlerExecutionSte p.System.Web.HttpApplication.IExecutionStep.Execut e() at System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously)
Source:System.Web
Origin: [URL]
Target Site:System.IAsyncResult BeginProcessRequest(System.Web.HttpContext, System.AsyncCallback, System.Object)
Exception Thrown @7/26/2010 10:11:21 PM

View 1 Replies

WCF / ASMX :: Calling A Web Service On A Remote Server From A ASPX Page (website Project VS2005)?

Aug 30, 2010

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?

View 1 Replies

Configuration :: Web.config 404 CustomErrors / Change The Url To Def23947823h.aspx It Is Caught And Redirects To Correct Page?

Sep 14, 2010

I am having an issue where if I change my url to .asp from .aspx i get a 404 error but it is not handled by my custom errors. If I change the url to def23947823h.aspx it is caught and redirects to correct page.

[Code]....

View 8 Replies

Jquery - JSON Can Call Method In .aspx File But Not In .asmx (web Service) File

Jul 3, 2010

I am using JQuery & JSON (POST) to call webmethod. However I can call only webmethod located at aspx file but not in asmx file Below are sample codes

CustomValidate.asmx
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
Public Class CustomValidate
Inherits System.Web.Services.WebService
'ACCESS VIA JSON
<System.Web.Services.WebMethod()> _
Public Shared Function AJAX_Test(ByVal date1) As Boolean...
Return True
End Function
End Class
Javascript: JQuery JSON
function isDates(source, arguments) {
var isValidDate;
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "CustomValidate.asmx/AJAX_Test",
data: '{date1: "' + arguments.Value + '"}',
dataType: "json",
async: false,
success: function(result) {
isValidDate = result;
},
error: function(httpRequest, textStatus, errorThrown) {
alert("status=" + textStatus + ",error=" + errorThrown);
}
});
arguments.IsValid = isValidDate;
}

It always return javascript undefined error. But if I put the AJAX_Test webmethod in aspx page and replace the url: "CustomValidate.asmx/AJAX_Test" to "mypage.aspx/AJAX_Test". It works fine.

View 1 Replies

WCF / ASMX :: Best Way To "ensure" That A Web Service Is Only Called From AJAX On A Specific ASPX Page?

Oct 26, 2010

I have an ASPX page which hosts a Custom Control. That custom control needs to call an ASMX web service. I would use a PageMethod, if the fact that I'm calling from within a Custom Control didn't preclude that. I'm looking for some guidance on the most effective way to try and lock down the ASMX call such that it will only succeed for my users calling it from my ASPX page - and not for anyone trying to call it from elsewhere. I've seen various ideas around session variables and so on.

View 5 Replies

C# - Web Service Return Type Exception?

Jul 26, 2010

I have a web service and its methods return a class which is name WSResult. WSResult has 2 properties. One of property's type is int and the other one's type is object. I want to return some different type with this second property.

[code]....

How can i pass an object which i retrieved from other web services or that i generated from my serializable classes inside M_ResultObject property ?

View 2 Replies

WCF / ASMX :: WCF Service Returns Blank Data?

Jul 22, 2010

I'm new to WCF and this is definitely a rookie question. Why does my browser show/return nothing when I type this URL: http://localhost/service.svc/root, using the code below. I was hoping I would see an xml respone like: <double>56.78</double>. service.svc

--------------------------------------------------------------------------------------

<%@ ServiceHost Language="C#" Service="EssentialWCF.StockService" %>
using System;
using System.ServiceModel;
using System.ServiceModel.Web;

[code]...

View 6 Replies

ASMX Service Works On Development Server Returns 404 When Deployed To IIS 7.5?

Mar 24, 2011

I have a web application in ASP.NET 4.0. I've added an asmx service, primarily as a source for the autocomplete extender's lookup values.

When I debug on my machine locally, everything works fine. However, when I deploy the web application to IIS 7.5, I get a HTTP 404 response when trying to send data to the service.

I am able to browse to the service definition, see the available operations. Tellingly, however, when I use the test pages to test the service using POST, I receive an HTTP 404 again.

I'm not sure what is going on. I did create the asmx file within my web application and it is deployed in the virtual directory of my otherwise working production application. Is there an issue with the .asmx file being deployed in the same virtual directory, perhaps?

View 1 Replies

JQuery :: Call Asmx Service That Returns Multiple Data

Mar 3, 2011

I want to call .asmx service from jquery

.asmx service will return multiple data from database.

I need to get those data to jquery on client side

and then i need to put each data into their respective textfield on the client side

View 6 Replies

WCF / ASMX :: Calling A Remote Or Local Web Service That Returns A JSON With JQuery?

Mar 16, 2011

how to create a Web service that returns a JSON(or JSONP). That also should be able to work for cross-domain access aswell as for a local call.. help to get this working or for a few links for further reading about this

View 2 Replies

WCF / ASMX :: Web Service - Return XML

Jun 10, 2010

I have a web service that originally returned a string containing text formatted as XML. I was contacted by the programmer who is going to be consuming the web service, and he asked if I could make it "just XML" and not a string. I converted the web service so that it returns an XMLDocument object, and it seems to be returning data properly. I would just like to erify, however, that the XMLDocument object is what the other programmer was referring to when he said "just XML," and that the XMLDocument can be universally consumed by any programmer, regardless of his or her programming environment.

View 4 Replies

WCF / ASMX :: Return More Than One Value From Web Service

Oct 13, 2010

I am new to web service... I have created a simple web service to add a record to sql server by passing a parameter and returns true or false once done. It the same time, I want to return the customer_account_number value created on the sql server.. so basically I want to return the true and false and one (or more) additional values.

View 5 Replies

Architecture :: Exception Not Caught?

Nov 22, 2010

My question is, I have a PL, BL and DAL layered architecture (In which all these components are hosted in a single web server).

With the above architecture, i have only placed try catch block in all my events in aspx.cs pages in PL ALONE and NO TRY CATCH BLOCK IN BL AND DAL.

There is one command timeout exception happening at the DAL layer and the exception bubbles back to the PL(aspx page event which is having the try catch block). This try catch block catches the exeption and logs the exception information to database and displays useful information in the UI.

WIth the above approach, sometime very rarely(only once till now) exception is not caught in the PL for the commandtimeout exception thrown from DAL implicitly.I confirmed the exception is not caught because the exception information is not logged into the database and also no useful information displayed in UI.

Why the exception from DAL dint bubble down to PL? Do we need to explicitly throw exception from DAL or BL i.e by having try catch block in BL and DAL ?

View 1 Replies

Return Pure XML From Asmx Web Service?

May 6, 2010

I want an asmx webservice with a method GetPeople() that returns the following XML (NOT a SOAP response):

<People>
<Person>
<FirstName>Sara</FirstName>
<LastName>Smith</LastName>
</Person>
<Person>
<FirstName>Bill</FirstName>
<LastName>Wilson</LastName>
</Person>
</People>

View 4 Replies

WCF / ASMX :: Regarding Web Service Return Types?

Jun 24, 2010

i have 10 employee objects.I want to return these 10 object from a web method to web service client.

View 6 Replies

WCF / ASMX :: Exception Handling In DTO Mapping With Web Service?

Sep 13, 2010

I am going to be receiving data in a web service. After I receive this data I will be mapping it to a data transfer object. I want to be able to catch exceptions if the data from the service is missing any of the required values, times out or any data is malformed.

What can I do to generally catch these exceptions?

View 1 Replies

MVC Exception Not Being Caught In Try Catch Block?

Jan 21, 2010

I have tried this on two different controller methods now, and both times, even if the linq2sql doesn't allow the data to be saved, the code never jumps into the catch block.

I've watched the noun object in the middle of the trace, and the isvalid property is false, but the modelstate isvalid is true. Either way, the code never jumps into the catch block.I'm pulling my hair out about this. I feel like it will be something really silly.

The code all works similar to nerd dinner.

NounRepository nounRepository = new NounRepository();
Noun noun = new Noun();
try[code]...

I'd rather not have to add code in this manner though, as it seems like an unnecessary duplication.

View 3 Replies

WCF / ASMX :: How To Return XML Structure From A Web Service In Page

Mar 24, 2011

I have a problem to connect my ASP page with a Web Service.

I'm going to explain the situation:

VB: WEB SERVICE: service1.asmx.vb (http://localhost:1234/Service1.asmx)

[Code]....

FROM ASP page

I have not any problem to receive the string from the SECOND function

However, When I call the FIRST one I receive an error:

"Microsoft VBScript runtime error (0x800A01C2) the wrong number of arguments or invalid property value argument"

I use this object: recXML = CreateObject("Msxml2.DOMDocument")

View 2 Replies

WCF / ASMX :: Max Return Size Of String From Web Service?

Feb 14, 2011

I have a web service that is declared like this.

[Code]....

Function inside the service simply returns string separated by some delimitor. This string is then used by JS function to assign to a jQuery datatable. Is there a maximum limit on size of this string? I have about 2000 rows with 6 columns each. I get an error (failed handle) when I return them all. But if I do only top 500, it works fine.Is there any size limitation?

[WebService(Namespace = "http://tempuri.org/")]

View 8 Replies

WCF / ASMX :: Return JSON Data From A 2.0 Web Service?

Sep 10, 2010

Just ramping up on JSON and JQuery and returning data to a ASP.NET web page from a web service using Ajax. The JQuery part is pretty straight-forward. However, when trying to return JSON formatted data instead of XML from a 2.0 web service, I'm stuck. The web service does have the System.Web.Script.Services.ScriptService attribute, so I can hit it via JavaScript; however, the web service always...always...returns data in XML format, no matter if I explicitly say I want JSON as the datatype in my JQuery code. So I don't know if this is an issue with the web service or the JQuery code. I posted this here, but realize that the category could be incorrect depending on where the issue is. Is there no way to return JSON data from a 2.0 web service? It's a production web service, so I can't change the code unfortunately.

View 3 Replies

WCF / ASMX :: WCF Data Service Out Put Not Return Correctly?

Sep 28, 2010

I am consuming wcf Data service in client application following way, when i execute SP, some of the columns are repeating with same value,

DataServiceContext context1 = new DataServiceContext(new Uri(serviceURL));
string strparam = "emailid='" + paramemail + "'& LocalTitle='" + paramtitle + "'& ColorGrouping='" + paramcolor + "'";
string url = serviceURL + "GetSearchResult?" + strparam; [code]....

View 3 Replies

WCF / ASMX :: Accessing A Published Web Service Gives Null Ref Exception?

Sep 2, 2010

I have an Asp.net web service that I created using Visual Studio 2005. I can acess the web service in my test environment, call methods and return data as expected. If this web service is published to the outside world (Outside of the company firewall), it will return a null why this might be happening? The same code is being used,against the same database. The only difference is that the published website is giving back the null reference exception. If I type in the URL for the web service "https://secure.theSiteGeist.com/wsIndigo.asmx" a list of methods for the web service is displayed in my browser. Yet if I try and call any methods on the web service I get back the null reference exception. Note that the URL I posted above is not the real name of my web service, but is just used for reference sake.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved