C# - Why Does Silverlight Reference To Wcf Service Blow Up When Add Method To The Wcf Service That Returns Generic List

Aug 17, 2010

I have built a WCF Service that is being consumed by a Silverlight app. At first I created one method that was very simple:

public String SfTest()
{
return "SF Test";
}

No poblem. My silverlight app references my service and displays "SF Test" in a textbox. Now I add a method to my wcf service like this:

public List<String> GetTest()
{
List<String> list = new List<string>();
String a = "a";
list.Add(a);
String b = "b";
list.Add(b);
return list;
}

I update the reference to the service in my Silverlight app and the using statement in my xaml cs page throws an error like the service doesn't even exist although it is there. I am assuming the problem has to do with datatypes or serialization or something like that but it is driving me up the wall. Why can't I consume a simple generic list in my Silverlight app through the WCF service.

View 1 Replies


Similar Messages:

Silverlight Web.Config Setting For Web Service Reference URL?

Nov 12, 2010

I have a Silverlight control that is hosted within an ASP.NET application. The Silverlight control has a web service reference. The URL of this service is going to vary when we install the application for our customers. I need a way to be able to change this web service reference URL from within the web.config of the ASP.NET application. How can I do this?

View 2 Replies

DataSource Controls :: Foreign Key Reference Not Updating With ADO.NET Entity Framework Silverlight/Data Service

Apr 8, 2010

I'm trying to insert a new EF object containing a reference to a related table via foreign key, and cannot get the reference stored in the new object. I have two tables in a SQL Server 2008 Database:

Component Templates
PartGroups

with a Foreign Key linking them thus: ComponentTemplates:ID [0..1<->*] PartGroups:ComponentTemplateID

I have imported these tables into a .NET web application project .edmx file (using a new ADO.NET Entity Data Model), and then created a Data Service which I then reference in a Silverlight 3.0 project. The objects are available as expected in the data context called by my Silverlight app and load correctly. Now, when I try to save a reference of ComponentTemplate into a newly created PartGroup, the PartGroup object is created in the database, but the value of ComponentTemplateID in the newly created table record is NULL.

[Code]....

(Note that _ctCtrl.ComponentTemplate is a confirmed non-NULL object reference to the parent object on which PartGroup is a child)

View 2 Replies

Web Method That Accepts A List<CustomObject> Is Failing With "Web Service Method Name?

Feb 8, 2010

I want to create a web method that accepts a List of custom objects (passed in via jQuery/JSON). When I run the website locally everything seems to work. jQuery and ASP.NET and everyone is happy. But when I put it on one of our servers it blows up. jQuery gets a 500 error after the ajax request with the response being:

System.InvalidOperationException: EditCustomObjects Web Service method name is not valid.
[WebMethod]
public void EditCustomObjects(int ID, List<CustomObject> CustomObjectList)
[code]...

View 8 Replies

How To Force Web Service Base Class Method Run Before Web Service Method Start

Aug 6, 2010

My web services have base web service method called IsGood()I want to make sure every methods in my web service call IsGood() in base web service automatically without add code in each web service method, can I do that?

View 2 Replies

Architecture :: DAL As Web Service - Adding A Service Reference To Project And Then Using The EF4 Context And Writing LINQ Queries Against The DB?

Feb 10, 2011

I'm currently trying to work out the best way to build this web application, which will then be intergrated on other systems, such as WinForms, Intranets etc.

We hope to include the usual layers i.e. DAL, BLL, BOL and UI but I have been experimenting with Entity Framework 4 and WCF Data Services and managed to get something in place where I was using WCF as a gateway to EF4.

i.e. Adding a Service Reference to my project and then using the EF4 context and writing LINQ queries against the DB

e.g.[Code]....

Now with the current setup I would still need to write a DAL Class Library, that interacts with the Data Service, because as I said WCF Data Services only seems to be a gateway, I can't see where to put the code (above) in the Data Service and then how I could these methods.

My questions are: 1. How do I develop a WCF Data Service in such a way to allow this behaviour - I know how I could do it using ASMX web service, something like [Code]....

2. If I am to use WCF Data Services, how is serialization handled (if at all) - again I know how to do something in ASMX web services

3. Again, If I am to use WCF, how do I add Security and only allow my applications to access the web service - for obvious reasons

4. Would it be possible / logical to also include the Business Logic Layer into the web service?

View 4 Replies

WCF / ASMX :: Create An Instance Of Web Service Without Adding Web Service Reference?

Mar 17, 2011

How to create an instance of web service without adding web service reference? How to identify the server address/name where the web service is hosted from C# code?

View 1 Replies

Is Url Of Web Service Fixed, When Reference For Web Service Is Implemented In Class Library

Feb 9, 2011

<Application architecture>I'm developing ASP.NET Web Application by Visual Studio 2008.(.Net Framework Version = 2.0)I put followin two projetcs in the solution.a. Class library which implements all the buisiness logic for application.
(I'll call it "ClassLib" in the followin sentence)b. ASP.NET Web applicatoin which presents UI.(I'll call it "WebApp")ClassLib uses Web Service which located on other server. So, I set web reference in it. Method for url settings for this web reference is "Dynamic".

View 1 Replies

WCF / ASMX :: Add Service As Service Reference To VB6 Winforms Application

Feb 7, 2011

How do I add the WCF service built using VS2010 as a service reference to a Winforms app which is written in VB6?

View 1 Replies

WCF / ASMX :: Returning List From A Web Method In A Web Service?

Mar 25, 2010

I'm using a web service and I want to return a list to my client. I am nearly newby at web services and I can't return a List<String> object to my client. But when i call the method it says "Unable to cast object of type 'System.Collections.Generic.List`1[System.String]' to type 'System.String[]'" What should I do?

View 2 Replies

C# - Web Service Method Returns Response Object Instead Of Custom Object?

Sep 29, 2010

I have the following code:

[WebMethod]
[SoapHeader("_webServiceAuth")]
public User GetUser(string username){
try
{
this._validationMethods.Validate(_webServiceAuth);
User user = new User(username);
[code]...

View 1 Replies

Can't Get WCF Service's Operations List With Web Service Studio Client

Jan 21, 2011

I've created a simple WCF service hosted by ASP.NET web site:

[Code]....

I can add references to this service as to WCF service, as to WebService.WcfTestClient application successfully recognized service and its methods.

But "Web Service Studio" [URL] can't get a list of operations... Why? How to diagnose/resolve that?

P.S. I work under VS 2008 using .NET 3.5

View 2 Replies

Adding Service Reference For A Wcf Service?

Sep 1, 2010

I am getting an error when i try to add a service reference of a WCF service. Error details is below. My web service is hosted on a different server and my client is on different server. When i run the service directly from IE i can see the service but adding it in .net web application i get error.

[Code].....

View 1 Replies

Changing "web Reference" To "service Reference" Changes Method Signature?

Sep 3, 2010

I'm helping out a colleague on this one so if I'm missing some details that's why.We have an asp.net 3.5 web application calling a WCF service. Originally the app used a "Web Reference" to register the service however after having some trouble and burning an incident with Microsoft their solution was to replace the "Web Reference" with a "Service Reference" to the WCF service.This is great except the problem is that when we create a Service Reference, the method signatures are different than they were when a Web Reference was used.From what I've read this may be expected, however in our case this would mean some significant changes to the application and of course it was due yesterday...so......I'm wondering two things:Is it normal/expected that method signatures will change based on the reference type?Is there a way to create the Service Reference that will generate method signatures identical to the original Web Reference?

View 1 Replies

WCF / ASMX :: Add Service Reference Reading Svc File But Not Reading Service?

Mar 10, 2011

I was trying to go through this tutorial:

[URL]

but when I tried to add the service reference to the silverlight app, the Add Service Reference window would show me that there was a service file, but the node wouldn't expand to show the rest of the files that contain the services and what not. I got this error instead:

"An error occurred during the processing of a configuration file required to service this request. review the specific error details below and modify your configuration file appropriately."

"Parser Error Message:There is no service behavior named 'AdventureWorks_WebServer.Service1Behavior'."

"Metadata contains a reference that cannot be resolved: 'http://localhost:55579/Service1.svc'.

The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.

If the service is defined in the current solution, try building the solution and adding the service reference again."

here's my web.config file:

[Code]....

View 1 Replies

How To Use Silverlight And RIA Service

Jun 21, 2010

I'm pretty new to Silverlight/RIA/Asp.Net thing, and I'm trying to figure if an Asp.Net website is required (for hosting the app) if I wish to use RIA services with Silverlight?

View 2 Replies

Implement Generic Web Service API

Feb 10, 2010

What is the best way to implement a open/cross platform web service API to an existing .NET App? Not being a strictly .NET friendly API. It already has ASP.NET exposed web services, but need to be built into an generic API allowing inserts, updates and deletes and returning results based on user criteria in standard SOAP, JSON or other common formats, similar to Google's Data API's. Are there any frameworks designed for this or is it a build it from scratch project implementing each format/protocol manually?

View 3 Replies

Calling WCF Service From Silverlight?

Jan 7, 2010

I am new to Silverlight. In Silverlight, we can get data from server using ASP.Net (using WebClient and HTTPWebRequest classes in Silverlight) and using WCF Service.

Assuming that I do not need the cross domain capability, what is a good option in terms of Security and ease of development?

View 1 Replies

How To Add Web Service Reference To The Web Service

Feb 10, 2011

http://geoss.compusult.net/wes/serviceManagerCSW/csw?request=GetCapabilities&service=CSWHow would i create the proxy classes for the service?More information HERE.The hosting service above is implementing an OGC standard (CSW). The schemas for this standard are hosted HERE. And they have some WSDLs HERE. If i was to place the URL to one of those WSDL into visual studio's "add reference/service" i get a list of web operations and will generate a reference. However, that will not work because it does not know about the true hosting provider. So i'm not quite sure what to do.

Edit #2:
Custom tool error: Failed to generate
code for the service reference
'ServiceReference1'. Please check
other error and warning messages for
details. D: empWebApplication2WebApplication2Service
ReferencesServiceReference1Reference.svcmap 1 1 WebApplication2
[code]...

View 3 Replies

Looking For A Generic Handler / Service For Mongodb?

May 25, 2010

I am new to MongoDB and have a perfect place in mind to use it. However, it's only worth it if I can make the queries from JavaScript and return JSON.

What's the easiest way I can implement a generic service/handler in asp.net/c# that would allow me to interact with mongodb via JavaScript? I understand JavaScript can't call mongodb directly, so the next best thing is what I'm looking for.

View 3 Replies

C# - Silverlight Ria Domain Service Not Being Called?

Sep 29, 2010

Im using silverlight ria services and trying to called a domain service methodthe domain service class signature goes like this public class UserDomainService : DomainServiceand I have a simple operation to return data

public IQueryable GetUsers()
{
return userService.GetAll()
).AsQueryable();
}
[code]...

View 2 Replies

Silverlight Error While Calling A Service?

Oct 10, 2010

I am trying to call a service from a silverlight application, but I am getting the following error.

Uncaught Error: Unhandled Error in Silverlight Application An exception occurred during the operation, making the result invalid. Check InnerException for exception details.

This works fine locally. I don't know if it make any sense, but locally if I add the url of the webservice on a browser, I am getting the details page of the service. In the other hand, on production server, it prompts me to download it.

public MainPage() {
InitializeComponent();
Loaded += new System.Windows.RoutedEventHandler(MainPage_Loaded);
}

[Code]....

View 1 Replies

C# - WCF Service Returns 400 Bad Request

Mar 18, 2011

I've got this application that works locally and when deployed and using a .mdf SQL Express database file (which I usually use for testing purposes). However, when I change it to work with our SQL Server 2008 the app works but the service doesn't. For example if in my code behind of a page I have a button that adds data to a table such as this it works fine:

public static string connString = @"Data Source=server1;Initial Catalog=Project;Integrated Security=True";
protected void btnAddProj_Click(object sender, EventArgs e)
{
using (var sqlc = new SqlConnection(connString))
{
sqlc.Open();
var cmd = sqlc.CreateCommand();
int intProjectID;
// Add the project info to the database
cmd.CommandText = "INSERT INTO tblProject VALUES(@ProjName,@ProjTeam,@ProjStart,@ProjEnd)";
cmd.Parameters.Add("ProjName", System.Data.SqlDbType.NVarChar).Value = txtProjName.Text;
cmd.Parameters.Add("ProjTeam", System.Data.SqlDbType.Int).Value = ddlTeamSupported.SelectedValue;
cmd.Parameters.Add("ProjStart", System.Data.SqlDbType.NVarChar).Value = txtStartDate.Text;
cmd.Parameters.Add("ProjEnd", System.Data.SqlDbType.NVarChar).Value = txtEndDate.Text;
cmd.ExecuteNonQuery();
}
}

My web.config is setup to use impersonation on that server and all works perfectly well. However, for my service the query doesn't seem to return anything and I get a 400 Bad Request error. The code for the jquery is:

$.ajax({
type: "POST",
async: false,
url: "Services/ProjectService.svc/test",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
console.log(data);
}
});
And for the Service:
[ServiceContract]
public interface IProjectService
{
[OperationContract]
[WebInvoke(ResponseFormat = WebMessageFormat.Json)]
ArrayList test();
}
public static string connString = @"Data Source=server1;Initial Catalog=Project;Integrated Security=True";
public ArrayList test()
{
var sqlc = new SqlConnection(connString);
sqlc.Open();
var cmd = sqlc.CreateCommand();
cmd.CommandText = "SELECT ProjectID FROM tblProject";
var reader = cmd.ExecuteReader();
ArrayList temparray = new ArrayList();
while (reader.Read())
{
temparray.Add(reader[0]);
}
sqlc.Close();
return temparray;
}

If instead of querying the database I have the service just return static data then it works fine. What could cause my service not to be able to connect to the database when the rest of the code behind for the app works?

View 3 Replies

Using .net Mvc 2 And WCF - Passing Generic Object To The Service Call?

Mar 11, 2011

[DataContract]
public class UserCertification
{
...
}
[DataContract]
public class UserPhone
{
...
}
[code]...

View 2 Replies

C# - Silverlight Ria Domain Service Not Being Called While Making?

Sep 2, 2010

Im using silverlight ria services and trying to called a domain service method. the domain service class signature goes like this public class UserDomainService : DomainService and I have a simple operation to return data

public IQueryable GetUsers()
{
return userService.GetAll()
).AsQueryable();
}

this compiles fine an a silverlight proxy is generated on the silverlight client side. how ever when makeing calls from silverlight eg

LoadOperation op = UserDomainContext.Load(UserDomainContext.GetUsers(),UserLoadedCallback,null);
int i = op.Entities.Count();

it is always 0, the domain servcice method is never hit when i put a breakpoint.

View 1 Replies







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