ASMX :: Consume A WCF Service From A Project That Compiles In A Dll?
Mar 18, 2011
I am creating a class library which will have business logic and i want to call this from SQL Server 2005 DTS. What i want to know is how to consume a WCF service from this class library project and compile it in a dll. How to deal with app.config created when servie is refered in class library? Could somebody send me a link to any article which can help me to implement the same in my current project?
I've been given the task of consuming a client's web service, and all they've given me is a XSD file. I'm a little unsure how to go about doing this, as the only other time I've consumed a web service was internally and we just pulled it in as a web reference to our project. Where do I start when all I have the XSD (below)?
CX_ST_MATCH_ELEMENT:XSLT exception.System expected element 'IOrgeh' Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code. Exception Details:System.Web.Services.Protocols.SoapException: CX_ST_MATCH_ELEMENT:XSLT exception.System expected element 'IOrgeh'Source Error:
I need to call remote web services for example [URL]. So how to do it? I watched all asp.net video about web servies but in all videos they speaking just about local web services,
I added a Web Method to the existing web service. I don't see this method in my web project. I can see all the old methods but I couldn't access this method. Do I have to create proxy for this method?
I am working on WCF Data service which imported stored procedure, as below.
[WebGet] public List<GetMTSearchResultTest_Result> GettMTSearchResultTest() { MediaMarketResearch_PRODEntities ent = new MediaMarketResearch_PRODEntities(); return ent.GetMTSearchResultTest().ToList(); }
when i consuming this in my client application it says error as "The closed type MMRClient.MMRServiceReference.GetMTSearchResultTest_Result does not have a corresponding element settable property." I am getting this error while bind to the grid view as below.
DataServiceContext context = new DataServiceContext(new [URL])); IEnumerable<GetMTSearchResultTest_Result> empResult = context.Execute<GetMTSearchResultTest_Result>(new Uri [URL];
A sample web service app I have been practicing with has two web methods: 1) HelloWorld -- which I can read the data from no problem - just a string 2) ClientData[] -- which returns an array of struct objects -- this is where I have the question.
Here is my instantiation of the webservice in my winform app for reading from HelloWorld
myWebSvc1.WebService1 s1 = new myWebSvc1.WebService1(); string y = s1.HelloWorld(); //--no problems so far here Console.WriteLine(y); //--but when I add the call to GetClientData() I have a problem List<ClientData> ls = new List<ClientData>(s1.GetClientData(3)); //--problem here
public struct ClientData { public String Name; public int ID; } [WebMethod(CacheDuration = 30, Description="Returns an array of Clients.")] public ClientData[] GetClientData(int Number) { ClientData [] Clients = null; if (Number > 0 && Number <= 10) { Clients = new ClientData[Number]; for (int i = 0; i < Number; i++) { Clients[i].Name = "Client " + i.ToString(); Clients[i].ID = i; } } return Clients; }
If I browse the .asmx file -- the sample xml returns the following if I enter 3 for GetClientData function param
From my winform app I get the following error messages when trying to add the GetClientData function call above --
Error 1 The best overloaded method match for 'System.Collections.Generic.List<DSS_2008.Form7.ClientData[]>.List(System.Collections.Generic.IEnumerable<DSS_2008.Form7.ClientData[]>)' has some invalid arguments
Error 2 Argument '1': cannot convert from 'DSS_2008.myWebSvc1.ClientData[]' to 'System.Collections.Generic.IEnumerable<DSS_2008.Form7.ClientData[]>'
Error1 The best overloaded method match for 'System.Collections.Generic.List<DSS_2008.Form7.ClientData[]>.List(int)' has some invalid arguments
Error 2 Argument '1': cannot convert from 'DSS_2008.myWebSvc1.ClientData[]' to 'int'
How can I fix this so that I can read the result into my winform app? //--sample web service
namespace MyService { using System; using System.Collections; using System.Data; using System.Web; using System.Web.Services; public struct ClientData { public String Name; public int ID; } /// <summary> /// Summary description for WebService1. /// </summary> [WebService(Namespace="http://codeproject.com/webservices/", Description="This is a demonstration WebService.")] public class WebService1 : System.Web.Services.WebService { //--source of sample: http://www.codeproject.com/KB/webservices/myservice.aspx private const int CacheHelloWorldTime = 10; // seconds public WebService1() { //CODEGEN: This call is required by the ASP+ Web Services Designer InitializeComponent(); } /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { } //WEB SERVICE EXAMPLE //The HelloWorld() example service returns the string Hello World //To build, uncomment the following lines then save and build the project //To test, right-click the Web Service's .asmx file and select View in Browser // [WebMethod(CacheDuration = CacheHelloWorldTime, Description="As simple as it gets - the ubiquitous Hello World.")] public string HelloWorld() { return "Hello World bbb"; } [WebMethod(CacheDuration = 30, Description="Returns an array of Clients.")] public ClientData[] GetClientData(int Number) { ClientData [] Clients = null; if (Number > 0 && Number <= 10) { Clients = new ClientData[Number]; for (int i = 0; i < Number; i++) { Clients[i].Name = "Client " + i.ToString(); Clients[i].ID = i; } } return Clients; } } }
I have a hardtime to consume this web service as Web Reference or Service Reference: [URL] I'm using VS2010 and when I consume it as Web Reference, I can't use its method because in the reference.cs, it has these errrors:
// CODEGEN: The operation binding 'getStationCharacteristicSummary' from namespace '[URL]was ignored. The encoding '' is not supported.
If i consume it as WCF, then each time I call the service, it complained the encoding error. May someone try to consume it and help me with this.
1. ADO.NET Data Service with Visual Studio 2008 and the .NET 3.5 SP
2. WCF Data Service using Visual Studio 2010 and they both work in IE.
I can make a Service Reference to the first one with VS2008.
The problem is when I try to use Visual Studio 2008 as a client and I try to add a Service Reference for the WCF Data Service made with Visual Studio 2010:
an Error (Details) occurred while attempting to find services at '
and the Detail is: DS_InvalidMetadataFile Parameter name: edmxDocument
the xml of the 2 services is perfectly the same (with the exception of the url in the "base" attribute in the service node)
We are upgrading .Net 2.0 Framework Web service project to .Net 3.5 Project. We are not changing any methods. Will there be any change in the proxy because of this Framework Upgrade.My requirement is to all the existing clients consuming this webservice should not have any impact due to this framework upgrade.
How can I consume a default WCF web service, right out of the box from VS 2010 in a default ASP.NET MVC project right out of the box from VS 2010?
I know how to start up the WCF web service and add the service reference in the ASP.NET MVC project. So what I want to know is exactly what code I shall write in the ASP.NET MVC project?
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?
I am reciving an XML file(probabbly genrated by webservice), when i request a web url. EVery desried information is in this xml file. Now my problem is to access this file in XML control. I have genrated xsl file for the same xml file.Assume below mentioned url giving me xml file.
Server Error in '/' Application. The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested URL: /Service1.asmx
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053
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 trying to find a way to have my Entity Framework model in a seperate project within my ASP.NET solution.
Currently I have my DataManager project (which contains my EF model and some classes) and a second project which contains all my web project files.
The problem that I have come across is that I have a database connection string in a App.Config file in my DataManager project and the same connection string in my Web.Config from my web project. I basically have a duplicate connection string.
Is there a way to only use only one connection string in my project (preferably from my web.config)?
My only concern is that when it comes to compiling my project I will not be able to change the connection string in the App.Config contained in my DataManager project.
i have a web service project called (WS_Service) i have a html page thats trying to consume WS_Service. i have web services sits on its own project (the reason i have created is because its independednt and can be called from .aspx or .html or mobile) i dont have problem with .aspx and i have just add the reference and fire the services. but i am not sure how i will be doing on .html page below is my code i am trying to POST to a web service: