Decouple WCF Service Proxy Classes From Environment Endpoints

Jun 28, 2011

I have a WCF Service, I won't waste anyone's time with copy/pasting a basic implementation here, just imagine it as being the standard "Echo" example you see scattered around MSDN. Let's say I host the Service Library using IIS / a web app. Let's also say I publish the website to varying environments, local, shared dev server, varying test servers, and of course varying live environments. We'll also assume that the WCF gods smiled down upon us and the deployments went without a hitch.

Now I want to write an app (lets say WPF app for some clarity). When the app starts, I want a drop down listing all the available environments. I don't mind hard-coding or supplying (by means of a config file) those environments, but kudos points for linking any articles showing LAN discovery of deployed WCF services?

When the user has selected their chosen environment, I want the app to be able to call a method on the service (in the correct environment). Now I could do this with a big select case/if statement, instantiating the appropriate proxy class for the environment selected, calling out using the proxy class, etc. I could even pass the class around from method to method as an object and then use select case/if statements alongside TryCast/DirectCast to ascertain which environment the provided proxy class belongs to.

I'm bordering on the idea of selecting an environment (none in particular, just one of them) and on the assumption that all deployments/environments have identical code, instantiate the proxy client with the endpoint details of my chosen environment. I lose a form of type safety, but is that ok? Is that the done way?

View 3 Replies


ADVERTISEMENT

.net - Extending Web Service Proxy Classes?

Jul 28, 2011

I need to add functionality to my web service calls so object translation and automatic retries are done and abstracted away.I would usually override the base class to add the extra functionality, but as the proxy methods aren't over-ridable I can't keep the method names the same. The only other option I can think of to do it this way is to use the 'Shadows' keyword to achieve what I want.What other methods do people use to add functionality to their web service proxy classes without modifying the generated classes?

View 1 Replies

Local System Account And Proxy Environment?

Feb 16, 2010

I have a Windows service running on Local System Account. The service connects to a remote webservice, and donwloads a file.Now I installed the service in an environment with a proxy server (http://proxy:80"). The result is that in the eventlog I get error:"unable to connect to remote server". When I start the service with a (test) account, everything works fine.Can someone tell me how I can handle a proxy environment with a service running under local system account?

View 4 Replies

Base Classes On Proxy Objects

Sep 25, 2011

I have a webservice that is wrapped up by a data access object and is accessed by many different UI controls.

The proxy objects look something like this:

Public Class WebProxyObject1
' Common properties, there are about 10 of these
Public Name As String

[Code]....

View 1 Replies

Service Reference Error When Moving Dev. Environment From XP To W7?

Apr 21, 2010

I am building an application and I am using web services for getting data from a server. It was working fine when I was developing on my XP machine but had to switch to Windows 7. On the new machine I grabbed the latest version of the code using sourcesafe.However, when I try to add a service reference in the solution or update an existing one I get the following error:

There was an error downloading 'http://localhost:52490/Service/CustomerService.asmx'.

The request failed with the error message:Server Error in '/' Application.Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not create type 'Digital_Server.CustomerService'. Source Error
<%@ WebService Language="vb" CodeBehind="CustomerService.asmx.vb" Class="Digital_Server.CustomerService" %>
Source File: /Service/CustomerService.asmxLine: 1
Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927

[Code]...

View 1 Replies

Web Service Using Old Proxy Settings?

Jun 30, 2009

Web Service A - Called directly by Win32 App, and various other web applications

Web Service B - Called directly by same Win32 App and a different set of other Web Applications

I'm working on adding a reference to B into A, so that we can use the functionality B provides without rewriting/reintegrating that code manually into A. I have a develop copy of A on my PC that I'm working with, and am calling a test copy of B on a remote server (the test server is accessed over the internet at our hosting provider)I believe to have my code ready for testing, but every time I go to test it on my local copy, I get the following error.No connection could be made because the target machine actively refused it 10.1.X.XX:8080

at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)

[code]....

It fails on the call to oZip.GetCities() with the above error. The IP in the error message does not in any way indicate it's made it out of our local network, it's a 10.* private IP, whereas the test server has a valid live publicly accessible IP.

View 2 Replies

Consume A Web Service With Proxy Settings?

Jun 21, 2010

I am trying to consume a web service using VS2008.

The code below works in VS2005 but not VS2008 I, suspecting it's to do with WCF. Please can someone help me to solve the puzzle?[code]...

View 2 Replies

DateTime Gets Changed In Service Reference Proxy

Jan 19, 2012

When I add a service reference to my VB.Net project all of the properties of type DateTime get changed to type Date. The project is ASP.Net using framework 4.0. The web service being referenced is C# framework 4.0. How can I keep this from happening?

View 1 Replies

WCF Service Generated Proxy Class Exposing Function As ByRef Sub

May 23, 2011

I have a WCF Service exposing a single contract and operation:

<ServiceContract(Namespace:="ImageSystem")> _
Public Interface IUploadService
<OperationContract()> _

[Code].....

This subsequently leads to stream casting issues, because the generated function allows me to pass a memory stream as an input (which works correctly when passed through to the service), but instead of passing me back a new stream for the response, it attempts to cast the MessageBodyStream received from the service into my memory stream.

This is, in some ways similar to other posts but as you can see, there are no enums involved in my contracts - presence of Enums caused strange proxy class generation is marked as the answer in the similar post.

Is there anywhere I configure the proxy behaviour to use the contracts I've specified? Clearly I'm within a dev/test environment currently, but when this eventually goes to production it will be memory and file streams passed to the service, and the returned stream can be in any format to be honest, I intend to treat it as the abstract stream class. The only way round this I can see right now is to change my in stream to be the same as the anticipated out stream, but surely there is a better way?

View 1 Replies

Declaring Arrays For Web Service Classes?

Jul 29, 2009

I need to initialize an array variable that belongs to a class supported by a Web Service. Theoretically it should have looked like that: Dim k(100) As New Appoint2.BookingData()However, it throws up an error message saying that 'Arrays cannot be declared with New'.I have managed to find a walk around: Dim k As Appoint2.Unit() = New Appoint2.Unit() {}But it creates only a zero-length array and I have no idea how to define its length. Wherever I try to put its length parameter (100) an error message emerges.

View 3 Replies

TcpClient.Connect With Proxy Server - Conncect - Send - Recive Data Using Tcp Connection With Specific Internet Service

Nov 4, 2011

I found similar forum thread [URL], but he don't have answers. How I can conncect | send | recive data using tcp connection with specific internet service (not web).

View 1 Replies

Create Classes In Windows Service Project?

Nov 12, 2009

i create a class library or use already created class library in my windows service project. I have 1 dll file then how can i use that file in my project.?Logic is my Greatest Asset !

View 1 Replies

Share Dataset Between Classes In A Windows Service

Apr 20, 2012

In all the Windows Forms Projects I've been able to share a dataset between the forms without a problem, so I assumed that it would be the same in a Windows Service. The issue I'm having is getting Class B to reference an existing dataset in Class that contains data. "Serv" is the class containing the dataset. When I say "Dim Serv1 as New Serv" and then declare my dataset/datatable references, the debug is showing that the dataset is empty, but I know the dataset contains data because I filled it in another sub procedure and checked that it contains data. How do I share a dataset between classes in a Windows Service?

View 2 Replies

Handle Case Sensitive Classes And Methods From A C# Web Service In .net App?

Jun 22, 2011

I am working on a VB.Net application that needs to access a web service that I am nearly certain has a C# backend. At bare minimum, the backend is providing classes to me that are differentiated only by case, and within a number of those classes, there are properties and methods that are only differentiated by case.

VB.Net is case insensitive, and it sees a number of these items as being ambiguous.I've thought of a few ways of dealing with this, but I would like suggestions before I go down a road that is likely difficult.

Here are some ways I have considered going about it.Modifying the generated code for the wsdl. This has presented problems in responding as the xml output would no longer conform to the webservice requirements.I think there might be some attributes I could use to override this, but I'm not sure what they are yet. Even so, this web service gets frequent updates and I would hate to have to keep refixing the service every time I refreshed it.Creating a csharp wrapper project where I expose the underlying classes with different names. Primarily through inheritance. Although the big problem here has been the issue with properties and methods that are only differentiated by case as well.

I'm sure at some point I could get one or the other of these solutions working, but if anyone has any better suggestions that I'm not thinking of,

View 1 Replies

Take Some Existing Classes We Retrieve From A Web Service And Hiding Public Functions?

Nov 18, 2009

[code]...

EDIT: The above class is just an example of what could be returned from a web service. I won't have access to modify it at all, sorry if I didn't make that clear.Is it possible to somehow make a clone this class, so that it retains all of the properties values, but hides the fact that there is a Public function?I'd like to be able to take some existing classes we retrieve from a web service(which we didn't write) and be able to pass them on for use in an application, but without exposing the functions. I don't want to go down the route of creating my own classes that specifically define each property and write the values in (due to the sheer size of some of them), so I'm looking to see if there is anything dynamic I can utilise (maybe there is a way using reflection?).

View 4 Replies

Making Multiple Copies Of A Data Bound Object From A DataGridView - How To Decouple Them

May 19, 2009

I have a DataGridView object to which I've bound a list of objects (of type Asset) returned from a database query.I'm programming in VB using Visual Studio 2005.I want to grab two copies of the bound object (calling them oldAsset and newAsset) from the selected row in the DataGridView, update newAsset based on input from other controls on the form, and pass both oldAsset and newAsset to a function that will update the appropriate record in the DB.I try to grab the two copies like this:

Dim currentRow As DataGridViewRow = Me.AssetDataGridView.CurrentRow
Dim newAsset As Asset
newAsset = currentRow.DataBoundItem

[code]....

Opening a watch window on oldAsset and newAsset indicates that the appropriate values are pulled at this point. But when I try to change a property of just newAsset, like

newAsset.CurrentLocationID = cboLocations.SelectedValue

I see that the corresponding value in oldAsset is also changed. This is not what I want, but it's obviously what I'm telling the computer to do.

View 1 Replies

Download Xsd Specifications From A Web Service And Automatic Converting (serialize) These Schemes To Classes (visual Studio - .net)?

Aug 8, 2011

I want to download xsd specifications from a web service and automatic converting (serialize) these schemas to classes (visual studio - vb.net). If the organization that is responsible for the xsd schemas alter them in a way that only my class corresponding to the xsd have to be altered (not the rest of my code) I would like to automatic update my xsd corresponding class.

I use vs2010. What I want to do is: call a web service where I can send in an input parameter to the service which specifies the xsd I want to retrieve (the service is GetShemaDefenition and returns an object with the schema specification in a string property of the object). I den have to read the xsd string from the string property and convert this to a class representation of this xsd specification. Is it possible to do this automatically? I have done this manually by using xsd.exe. If the owner organization of the xsd has altered the xsd specification, I have to test if there is a new specification, and if there is I have to build a new class representation of this xsd? Is it possible to do what I want? And how would I know if it has been a big change in the xsd which also affect other parts of my code, not just the class representation of the xsd?

Update:I use one web service where one of the properties is a string. The string is an XML inside a CDATA block. The organization which provides the web service will not pares the xml inside the CDATA block but instead forward this to another organization that will use the xml data. The organization which uses the xml data specifies the xsd schem that I have to follow to generate my xml correct. This is the xsd schema I can get from another web service. I don't really understand what I can do with this xsd file from the web service. What can I do with it and why do I want to download it from the web service, when I can't use it automatically? Because I have to manually do the changes when the xsd changes I can easily download the xsd schema from the organization's home page and make the new class with xsd.exe.

View 1 Replies

Developemnt Environment But Not In Deployement Environment?

Dec 15, 2009

I have VB6 Dll which I am referencing in vb.net ,I am calling the following function in it. It working fine in developemnt environment but not in deployement environment.

Error Method not found: 'Boolean MyUtils._MyUtils.LoadMyObjectRecords(ADODB.Stream ByRef, System.Array ByRef)'.

View 4 Replies

Proxy - Passing Data Via College Proxy

Oct 15, 2011

I'm making a application to use in college to retrieve my calendar and other things in VB.NET. But my college uses a proxy so when I connect my laptop I need to change the internet settings in my web browser to view web pages. how I would send requests via a proxy server in VB.NET? Or is there a piece of software that I can download which tunnels all connections or is there a setting in win7 does this?

View 1 Replies

VS 2010 : HTTPWebRequest.Proxy : Set The Proxy For A Web Request?

Nov 24, 2010

I'd like to set the proxy for a web request. However, when I say, for example, request.proxy = "x.x.x.x:xxxxx", it gives me the error "String cannot be converted to webproxy". How can I get around this and actually set the proxy?

View 2 Replies

V B 2008 Express Book - Can't Connect To The "Service-Based Data Base" Or To The "Linq To Sql Classes"

Jan 6, 2010

I can't connect to the "Service-Based Data Base" or to the "Linq To Sql classes". I tried all that I've read in the Forums for days : ( I removed the VB 2008 and SQL 2205-2208, then upload VB 2008 from my CD only. I'm starting a Web Technology class in 2 weeks, and the complition of the book is my entry requirement.

View 4 Replies

.net - WCF Service Hosted In A Managed Windows Service Connect Using A WCF Service Application

Jul 14, 2011

i have a Windows service that is hosting a WCF service through net.tcp and this is working great. I have also created a WCF service application. I am trying to add the net.tcp service reference to the service application. Then I add it to the GAC that goes ok but if I try to RegAsm the WCF service application to allow it to be called from Server.CreateObject I get the error:

Warning: Type library exporter encountered a type that derives from a
generic class and is not marked as
[ClassInterface(ClassInterfaceType.None)]. Class interfaces cannot be
exposed for such types. Consider marking the type with
[ClassInterface(ClassInterfaceType.None)] and exposing an explicit
interface as the default interface to COM using the
ComDefaultInterface attribute.

It does not work. I have tried to call it through a class library but this does not work either as the end point is not set correctly.

View 1 Replies

Use LINQ To Filter Collection Of Nested Classes To Yield Dictionary Of Unique Properties Of Those Classes?

Jan 23, 2012

I have two classes, one nested in the other. [code]Neither "Name" or "ID" are unique between operations and records.I wish to construct a dictionary using LINQ = Dictionary(Of String, Of List(Of Integer), whereby the keys are uniqe examples of Names in my collection and the values are the collective set of distinct IDs that are associated with those names.

View 2 Replies

VS 2010 Structure Classes So That The User Interfaces Though A Single Class While The Supporting Classes Are Hidden From Their View?

Jun 13, 2012

How can I structure my classes so that the user interfaces though a single class while the supporting classes are hidden from their view? I think its best understood in an example:

Public Class MyInterface
Public Economic as EconomicClass
Public Sub New()
MyBase.New()

[code].....

So you might ask why am I even separating them? It's strictly for others who will be working with this interface. I need to funnel them though a logical structure:

interface.Economic.MyMethod
interface.Currency.MyMethod
etc

This way everything is already handled for them in the background and they only need to run the method they need. I don't know if I can have it both ways in VB.NET.

View 23 Replies

VS 2010 Calling Subs And Functions Within Classes That Are Within Classes?

Oct 24, 2009

Here is some example code of what I mean:

vb
Public Class Form1
Private Sub Button1_Click(ByVal sender as Object, e as systemEventArgs) Handles Button1.Click

[Code]....

View 5 Replies

Derived Classes Cannot Raise Base Classes

Jul 10, 2009

I m trying to raise Click event of Textbox explictly but I m getting "Derived classes cannot raise base classes" error.[code]....

View 1 Replies

Service Error Cannot Open <service Name> Service On Computer '.'

Feb 3, 2010

I have a VB2008 application which can control a windows service i.e. start, stop, pause etc. This runs ok on a Windows XP machine but not on a Win 7 machine (message is - Service error cannot open <service name> service on computer '.') ( if I stop the UAC then it runs ok ). It seems to be a rights issue,

View 3 Replies

Loop And Enumerate Properties Of Nested Classes In Nested Classes?

Sep 24, 2010

so far i got

code
For Each item As Reflection.FieldInfo In GetType(NameSpace.ClassWithNestedClasses).GetFields
rtfAppend(item.Name & ":" & Tab & item.GetValue(Me))
Next
For Each item As Reflection.PropertyInfo In GetType(NameSpace.ClassWithNestedClasses).GetProperties()

[code]...

which gets me the simple string vars and properties of my top class, but how can i apply this to loop through all sub classes and get there vars and props?

View 1 Replies

Warning1 The Service System.ComponentModel.Design.IInheritanceService Already Exists In The Service Container

Mar 15, 2010

I got this warning that I don't know what it means.Warning1 The service System.ComponentModel.Design.IInheritanceService already exists in the service container.Parameter name: serviceType00

View 2 Replies

[VS 2005] Service Control Manager Privileges - Communicate With A Windows Service On A Remote Machine On The Network

Jul 23, 2009

I am trying to communicate with a Windows service on a remote machine on the network but i keep getting an exception saying the following: "System.InvalidOperationException: Cannot open Service Control Manager on computer 'machine001'. This operation might require other priviledges. ---> System.ComponentModel.Win32Exception: Access is denied.

[Code]...

View 4 Replies







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