WCF / ASMX :: Does Inheritance Is Possible In Webservices
Oct 25, 2010Am new bee to Webservices.I have declared complete BLL in the class library.
Can call those methods defined in Class library class files(.cs file) in .asmx file.
Am new bee to Webservices.I have declared complete BLL in the class library.
Can call those methods defined in Class library class files(.cs file) in .asmx file.
I want to know can php client consume asp.net web services with
1: returning basic types int, string etc.
2: returning DataSets
from where to start learning WebServices. I do not know anything about it, i searched internet but no useful sites were found. I am unable to understand almost all the codes written in App_Code/WebService.vb file that is generated in VS.I know some basics of ASP.NET ,VB.NET and C#.NET.
View 4 RepliesWe are making use of webservices in asp.net console application.we could able to debug the console application but we would like to debug the webmethod calling in our console app. so, how can we debug the code present in the webserices?
View 2 RepliesI have the URL of webservice of some companies in database as
Company-A http://companya.com/myservice/calculate.asmx
Company-B http://companyb.com/someservice/post.asmx
Company-C http://companyc.com/theservice/help.asmx
Company-D http://companyd.com/services/count.asmx
I want to dynamically consume these webservices. As sometime I need only CompanyA webservice, some time Company-B webservice. How I can do these.I thing I have to use WebService class (Imports System.Web.Services)
I am using ASP.NET (.asmx) web services with Silverlight. Since there is no way to find the client IP address in Silverlight, I had to log this on the service end.
These are some methods I have tried:
Request.ServerVariables("REMOTE_HOST")
HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]
HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
Request.UserHostAddress()
Request.UserHostName()
string strHostName = Dns.GetHostName();
string clientIPAddress = Dns.GetHostAddresses(strHostName).GetValue(0).ToString();
All the above methods work fine on my local system, but when I publish my service on a production server, it starts giving errors, Error: Object reference not set to an instance of an object. StackTrace:
at System.Web.Hosting.ISAPIWorkerRequestInProc.GetAdditionalServerVar(Int32 index)
at System.Web.Hosting.ISAPIWorkerRequestInProc.GetServerVariable(String name)
at System.Web.Hosting.ISAPIWorkerRequest.GetRemoteAddress()
at System.Web.HttpRequest.get_UserHostAddress()
i m making an API in .net , that will communicate with its client with xml data. client software can be in any language php,asp.net etc. what is the best way to develop such API, i was trying to use the .net webservices', but [webmethods] does not allow non static data, and in my API there are lots of things that will work only with the non static data. any way to develpop it without using .net webservies?
View 1 RepliesI am trying to using webservices to update the sql database table.
CustomerName.cs code
namespace SqlWebService
{
public class CustomerName
{
[Code]....
when I run it, the result is true but I cannot see the changes in the database!!
I wrote some webservices in my solution and it works fine when i consume it in my local machine... BUT when i deploy it in the public IP and using https. I'm not able to consume the webservices i got a "The provided URI scheme 'https' is invalid; expected 'http'. Parameter name: via" Error...
I tried to change my configuration in my web app from security mode="None" into security mode = "transport" and I got an error... (forgot to log the error)
Note* I'm using virtual IIS (this is where i test my project)
I have following class in webservices, I am not able to override the constructer of webservice. Asp.net always call first method not the one with parameter.
[Code]....
How can i call the second constructer in asp.net? Pls provide vb.net code.
We developed webservices and provided services to Clients.As per my requirement i have to change the webmethod signature datatype.Can i handle without inform to client.
View 1 RepliesHow to solve the Cross domain issue using webservices?
View 4 RepliesI worked on an online store based . In this store i have a category for which there are almost 2000 products. So every time when there is some change in the price, it is very difficult to update the products with new price, descriptions, features etc.The manufacturer of this product is providing web services which can be linked with store owner's website who is selling their products.o is it possible to integrate e-commerce website with webservices API that are being provided by manufacturer ?
View 1 Repliesi am new to WebServices, i have a ClassDataLibrary.dll which include classes like Users,Products,Articles...
i want to create a structure like this in my webService. as i saw the examples of creating web services the web methods written on the same page. but i got over 50 methods in dll and i want to share these methods with flash so flash user get data using my webService but it will be difficult to find the method he wants so i want to give my webService in a structure like:
Service1.Users // he will finds the methods about users
Service1.Products // he will finds the product methods
how could i do it ? is there any example or something to share with me?
when I access the webservices URL through browser ,I am able to access the URL ,If i use the webmethod in c# code the error message is diplaying like "The Requested Failed with HTTP Status 404:Not found".
View 5 Replies what is best to use in CTP 5 for inheritence. Ive heard of 3 ways of doing it. (This is indirectly addressed to Serenarules )
Table per Hierarchy ?
Table per Type ?
or able per Concrete Type ?
For those who wondering what the hell is that.. refer to http://weblogs.asp.net/manavi/default.aspx which is a nice blog about inheritence and polymorphism in CTP 5.
All my controllers inherit from a BaseController that has an ActionFilter attribute:
[AnalyticsData]
public class BaseController : Controller {}
public class AccountController : BaseController {}
Some of my Actions in my controllers reuse the AnalyticsData ActionFilter:
public class AccountController : BaseController
{
[AnalyticsData(Page="AccountProfile")]
public ActionResult Profile()
{
// return View
}
}
I notice that the AnalyticsData ActionFilter only runs once. This is a good thing and I only want it to run once, but I'm wondering how that happens. If I set my breakpoint inside the OnActionExecuting:
public class AnalyticsAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
// break point set here
}
}
only gets hit once when AccountController serves it Profile view. How do ActionFilters and/or Attributes work that [AnalyticsData(Page="AccountProfile")] on the Action overrides/replaces [AnalyticsData] on BaseController?
When people talk about extending a control are they just talking about inheritance?
View 1 RepliesCan anybody tell me why multiple inheritance is not supported in C#?
View 9 RepliesI'm trying to figure out if its possible to have multiple inheritance in a view in ASP.Net MVC. Right now I'm trying to print out a list of entries from two different tables from my model in a single View. I have the following line at the top of my view:
Inherits="System.Web.Mvc.ViewPage<List<GEApproval.Models.CoursePrefix>>"
But I also want to include the table Course as follows:
Inherits="System.Web.Mvc.ViewPage<List<GEApproval.Models.Course>>"
I went ahead and created a composite class as follows:
namespace GEApproval.Models
{
public class Listings: GEApproval.Models.CoursePrefix, GEApproval.Models.ICourse
{
public List<CoursePrefix> CoursePrefixObjList { get; set; }
public List<Course> CourseObjList { get; set; }
private GEApprovalDataModel _db;
//Constructor
public Listings()
{
_db = new GEApprovalDataModel();
}
//Generate a list of all courses associated with the prefix and place in ViewData model
public void listCourses(ViewDataDictionary viewData, int prefixID)
{
var test = _db.CoursePrefix.Include("Course").First(cp => cp.id == 1);
//Show total courses for this prefix
viewData.Model = test.Course.ToList();
viewData["prefix"] = test.Prefix;
viewData["courseCount"] = test.Course.Count;
int courseCount = test.Course.Count();//Test
}
}
}
And in my view, I now have the following line:
Inherits="System.Web.Mvc.ViewPage<List<GEApproval.Models.Listings>>"
I'm still a little confused because I still cannot access the properties of the Course object when listing them in my view, because I'm only inheriting directly from CoursePrefix. I'm not sure what I'm missing. Do I need to have a constructor for the composite object? Do I need the inherit and implementation statements for CoursePrefix and ICourse respectively if I'm already, supposedly, exposing the properties of each within the Listings wrapper class?
I work in a web agency and thus we are plenty of websites from several customers. They're built upon a cms we made, so websites are quite identical for the 90% of code. However, remaining 10% struggles me and my team as it involves not only the presentation layer but behavioral logics too (ex: a website1 requires simply user/pass registration while website2 needs more data, facebook connector, etc. But this is a very easy example). Making ad hoc development for our customers is becoming painful as keep each version aligned is getting really hard for us What I really dream to have is an extendible website that works by itself, but in which I can override a part. This behavior should sound like "look for the specific part, if it doesn't exists get the base one". The parts could be a method, a class, a page, a control, a static file.
example:
Suppose I want website2 to have an own login component, let's so imagine that we have a situation like:
/website_base
|_ login.aspx
/website1
/website2
|_ login.aspx
So, if I ask for [URL] I'll get /website_base/login.aspx, but if I ask for [URL] I'll get /website2/login.aspx
I'm using EF4 to generate a model. My architecture looks like this:
IMyEntity (custom interface)
-> MyEntity - EF generated class
IMyOtherEntity (custom interface)
-> MyExtendedEntity (Customn Partial class) : MyOtherEntity (EF Generated)
The first entity has a list of MyExtendedEntity. Is there any way I can bind this with the entity framework. I'm targetting ASP.NET and WPF. The main probnlem I have is that I need an ObservableCollection in WPF, while the EF generated class only has an EntityCollection which doesn't even seem to derive from ObservableCollection.
I think I know the answer to this but hoping someone has a neat solution. We are currently using two kinds of drop down controls (telerik and .net). I'm hoping to combine these into one control but struggling with a user friendly design.
Ideally the control would be created in the design file with a bool property of say "SimpleBox", to determine which kind of control to inherit. The instantiation would then be generated in the code behind design file and the constructor would then dynamically load the base (which isn't possible). The easy solution would be for me to create a IDropDown interface then have a factory create the correct one. The only real problem with this is the fact the instantiation has to be manually written every time. Which is a hassle, and does not speed up our process at all.
Although it isn't directly possible i'm looking for a solution along the lines of a factory which is ran inside the object constructor for setting the base, based on a bool property.
I have a solution with quite a few different MasterPages / BasePages which all inherit from somewhere else. My problem is that I have a virtual string in BaseMaster, which is overridden by BaseManagement, but when I try to access this string I always get the base valueThe point of inheriting masters and pages is obviously to avoid having duplicate code everywhere.
View 1 RepliesI am currently trialing EF4 code-first. My POCO classes inherit from an Audit class that contains CreatedBy, CreatedOn, UpdatedBy, UpdatedOn. I was hoping the framework would include the Audit properties in my Action table when creating my database, however this doesn't appear to be the case. Does anyone know how to enable this without overriding the OnModelCreating() method?
Public Class Audit
Public Property CreatedOn as DateTime
End Class
Public Class Action
inherits Audit
Public Property ActionId As Int32
End Class