publish subscriber webservices and route manipulation - c#

We have a Websphere Datapower (WDP) infrastructure providing a central endpoint for Soap based web services for logging and many other stuff.
Clients invoke web services using the WDP endpoint for all Web Services and WDP routes the requests to the matching web service based on Web services namespace.
The scenario of the problem is that we have multiple web services with exactly the same wsdl but with different namespaces so a determined client can notify a determined web service or web services depending on some different conditions.
The reason for this is, when new web services are added, we don't need to compile client code to bind the new web service.
I was thinking in manipulating the XML request namespace on client in order WDP know exactly the endpoint web service .
Also I don't want to have any logic on WDP because dependencies reasons.
Is there a better and elegant way of doing this in .net?
Regards

Related

Service discovery ASP.Net Core with Ocelot

I may be wrong in my ideas but here the plan.
I have an app who has 2 services, with a client who consume these services.
Because I want them to be micro-services, I've planed to build an API Gateway to have only one access point and redirect requests.
I've found some docs for building this and I stumbled into Ocelot to do the job, it seems to fully answer my ideas.
But here the problem, if I want to run multiple instances of my services, I need a service discovery, that Ocelot can do with Consul, but it need in the service to register the service discovery provider in his configuration.
What I wanted to do is to discover services dynamically without configuring a service discovery provider in the services. Is it possible ?
Plus, if I want to run an another instance of the Gateway, the services will not register on this new instance.
Any hints or better solution ?

What are some scenarios in which you need ASP.net Web API to consume a WCF Service?

I know that ASP.net web service supports only HTTP protocol and with WCF you have more options like TCP and Named pipes etc. Can you think of any scenarios in which one might have to consume a WCF service through an ASP.net Web API?
Following would be one of them use case where you want to call wcf service from web API.
If you already have a wcf service running and available which is doing some complex operations and you do not want it to be available directly to your consumers, you can create a web API and call the wcf service to perform the complex tasks and let the consumers to use the web API. In web API you can put extra logic of validation and authorization of the incoming requests.
Wcf being an older technology it would be better to write something new and eventually replace wcf rather than maintaining it.
Also If the current wcf is setup is not available via http protocol then not all the clients can communicate with it. Web API has that edge over wcf service.
How web API would connect to wcf service?
This depends on lot of factors such as network, deployment strategy, security etc.
But following would be one of the examples.
If the wcf service is available on tcp and web API and wcf are running on the same network, then web API can call wcf.
There may be a different answer to this question based on what exact problem you are trying to solve.
My answer is based on what information you have provided and the experience I gained by solving similar issue in real life.

What tools/methods are used to consume WCF web services for Android?

I am designing an Android application which is supposed to connect to a server via WCF web service.
I have a WCF web service written in .NET 4.5 and it is a self-hosted web service. It has SOAP endpoint configuration and it is not a very complex service, however it does include some methods which return DTOs (Classes containing lists, other DTOs and value types).
Now the problem I am facing is that I wish to use some sort of tools to consume the web service definition and generate the proxy classes. I have been successful doing this with the help of Eclipse, but the resulting generated code uses alot of external libraries not available within Android.
Now my question is, what are the preferred tools/methods to consume WCF SOAP web services?
I found that using the following tool gave me the best generated code.
https://code.google.com/p/android-ws-client/
I do recommend this tool to anyone looking for consuming a WCF SOAP web service.

How to setup WCF proxy relay service

I am writing an ASP.net Dashboard application in C#. The application will collect alarm statistics and display them on the dashboard via Ajax(jQuery).
The application could collect the alarm stats cross domain so we chose to set it up as follows:
A standalone Windows Service runs with a constant connection to the Broker(a program that collects stats). Inside the Windows Service we've hosted a WCF service. The windows service will load pass the string of stats into the WCFExternalService.
We then setup an WCF Service hosted in IIS and referenced inside the Client app( this service will act as a relay/proxy service).
Can someone please point me to an article or explain how to setup the bindings/endpoints to connect the proxy service to the external WCF service?
Thanks in advance for any help on this!
Larry
Looks like you have already got most of the structure going. My inputs below:
The WCF proxy (in UI layer) could implement the same service contract as its WCF service counterpart (in Windows service). However, the WCF proxy would be a 'client' of the real WCF service (you need to configure this in Web.config).
Now, enable the WCF proxy to be consumed by jQuery / JavaScript using WebInvoke attribute. [WebInvoke("GET", WebMessageBodyStyle.WrappedRequest, ResponseFormat:=WebMessageFormat.Json)]
Use jQuery $.ajax syntax to consume your WCF proxy. The url should be an equivalent of 'http://myHost/myVirtual/MyProxy.svc/MyMethod' and the data should be a JSON string equivalent of your WCF proxy parameters.
Further explanation on the first point:
This MSDN article explains how to set up a WCF client (to be consumed by your proxy WCF).
Next, you can create a proxy WCF service to consume the WCF client.
The Web.config of your website (which contains the proxy) needs sections for WCF client and WCF proxy.
Hosting does not matter in WCF, so your 'real' service could support any binding (Http, Tcp) based on your requirements and environment

Generate SOAP requests on the fly, based on WSDL

I'd like to build a simple test harness for the various web services consumed by my application that I can run in my staging or production environment to verify that the web services are working and see what data their web methods are returning.
Is there a way I can generate a SOAP request based on the WSDL provided by a web service at run time (i.e. without adding a web reference to my project and creating a proxy for the web service)?
Check out SoapUI (http://www.soapui.org/). It's the only tool I've ever needed for testing Web Services.
You can try using Castle Dynamic Proxy.

Categories

Resources