I am developing a web service in C# using the C# port of the PureMVC framework. The web service uses nHibernate to connect to and manipulate the database. I have tried to find information about how PureMVC should be initialized when used to manage a web service or if I call a seperate page to invoke PureMVC and have it load the .asmx file directly and pass it the post data. I'm somewhat lost when it comes to the load order so if anyone could help me out with this it would be very appeciated.
Gary
I notice that WCF has a messaging system that appears to run asynchronously. This seems to much better fit the asynchronous nature of Proxies in PureMVC and indicates that I would access the web services as normal where I then instantiate PureMVC and use it to encapsulate my data and commands, I can then query nHibernate and notify the rest of my system when I get a response. This should allow me to create return data objects and send them back through the web services.
If anything about that sounds crazy, please let me know before I invest time implementing it :D
Thanks guys, and thanks to CrazyDart for his input.
Related
I apologize for my rather vague question, but I am at a bit of a loss. The documentation for MSDN API functionality is very confusing and convoluted to say the least, and I have been tasked to figure out a way to get the desired functionality mentioned in the title.
Basically, my intent is to create an API using SOAP that sends out data to a separate instance of the same application, with the intent of synchronizing their databases. It is important that this data is sent by the primary database, and not requested by the receiving end, as that could create a security hole in the architecture if our primary database was that open.
I don't want to simply ask for code, but a very lightweight example of how this could be achieved on both ends would be extremely helpful. I don't really have anything significant to show other than a very simple Test Service.
Is the problem that those other systems cannot initiate sessions due to network security? The challenge is that Soap services are made to receive a request. In order to do what you want, the client systems will have to have a soap service or some other kind of service that yours can call too. Then your service can synchronize to at least tell them to call your service. There are lot's of ways to approach this with the kind of architecture I mentioned.
I was wondering how you can send data from the client to the host. Currently I have 2 projects and one WCF library. One of the projects is a pump which is the client and I want it to be able to send data to the host? Although I may have a misunderstanding of how WCF works. I was wondering if anyone could point me in the right direction. The problem requires me to use WCF. I want to be able to pass a list of strings to the host.
WCF can send data over many different transport protocols like MSMQ and http. It also enables message security, distributed transactions and other more complex features of a distributed system.
You need to create a WCF service, which is available as a template in Visual Studio. The server should be hosted as a stand alone program os as a web application in IIS.
Afterwards you need to create a client, that can communicate with the server.
WCF is however a large and complicated framework and you should not expect to be able to just scratch the surface and build a system. You need some googling and could possibly start with MS own tutorials.
If you need real useful answers you should be more specific about your program and the client and server operations as well as the deployment scenario.
As faester already said, WCF is a large framework and you can not make a good application by just copy-pasting the code into your project.
You should really read into the matter and then create your programming masterpiece.
faester gave you a link, but it's for basic WCF client-server communication.
Here are some good links on sending and receiving data via WCF:
Data transfer and architectural overwiev
Using the Message class
For a simpler, task-oriented view of how to send and receive data, see:
Specifying Data Transfer in Service Contracts
I hope that this will help you and the people yet to come to this question.
I am trying to build a service mechanism which should be add-on based and communicating through a publish subscribe system. It must be based on WCF services.
What I have right now is a concept which I can't get to work so I decided to ask you because maybe I am going at this the wrong way (I only just started using WCF).
What I want to achieve is making a single core service with session persistency which can be extended by linking an unknown number of add-on services. I want to set up the publish subscribe system at runtime, not at buildtime, so the core-service should be able to detect what add-on services are available (using the web.config?) and then bind them to the message bus.
From the front end (ASP classic) it must be possible to access any .svc file but, maintaining session, each .svc file must be connected to the message bus.
All is hosted in a single IIS active directory.
Can you give me some hints as to where to look?
I am especially interesed in:
WCF dynamic discovery
WCF to WCF communication on the same host (in the same active directory even)
Thanks in advance, hope you can help!
Update
Thanks for your answers, I'll read up at the links you send me. I'll post my final concept solution here in due time for future reference.
My 2 cents about Publish subscribe mechanism using WCF - WCF is not inherently built for pub/sub mechanism. It is built for Request/Response model of communication. Have a look at the NService Bus for pub/sub here
Talking about Add on services on top of core service, I am not able to get What you want exactly ? Is it the Routing service which you want ? WCF 4 now provides routing service For more information look here The link also talks in detail about the discovery mechanism in WCF 4.
Also have a look the Agatha framework which also have single WCF service and no. of request handlers where in the framework will decide which request handler to call based on each request.
Search for Agatha - Davy brion for more information
I was having a similar problem since I have one common WCF service but the implementation depends on the user's role so it was kind of difficult to do that at runtime.
I found this tutorial on the matter which runs great for my propouses: http://blog.micic.ch/net/dynamic-iis-hosted-wcf-service
I have tested in my env and is very powerful technique. Hope that helps you as well. Cheers.
I have a task to create a desktop version of our web app that will be distributed to our customers. I decided to go with wpf. The web app is three tier app with dal, bbl and pl. I could reuse a lot of it in my wpf but question is: is it a good idea to allow remote connections directly to sql server (i could compile connection string directly into the app). Or should i go wcf way and access db through a web service (this will require wrapping business metods around with service methods. Additional coding...)?
Any input is highly appreciated.
I would HIGHLY suggest using a WCF service. That way you are in control of what is running queries against your database, and it helps with keeping code updated. A great example why remote connections are bad :
Remote Access World
You use a stored procedure GetAnObject
In the process of upgrading your software, you change GetAnObject to return something different
Now all old versions are broken =(
WCF World
You use a stored procedure GetAnObject
In the process of upgrading, you change what it returns
In your WCF you just have to write some code to convert your object into the old one and send to legacy client. New clients are using a different WCF method call.
Also, I personally am not a fan of opening up my SQL server to any joe blow on a pc who can guess the login.
If you publish a version with an error in it, you at least have a chance the error is in the WCF side and therefore don't have to hassle clients with a 'my bad' upgrade. They never have to know where was a problem.
In a perfect world your WCF service and Web app can share a codebase, so you have less to maintain.
My suggestion is to go via a service (WCF or any other). The extra layer of indirection is decoupling which helps a great deal in maintenance and scalability. For example, if you already had a service which your web application used, it would have been much easier for you to just focus on creating WPF UI.
It all depends on what you want. Are you planning to use the DB layer and business layer across applications? If your answer is yes maybe WCF is the way to go.
We have a bunch of apps where we connect to the DB from WPF app directly because we wanted to avoid the extra layer of indirection which WCF adds.
I'm trying to enable a web application I've written in ASP.NET MVC2 to be able to send and receive data to and from Quickbooks on-demand, without a delay/intermediate database/sync operation. (Please take this as an assumption; I understand that it would be a better idea to use the Web Connector and sync every X units of time, but that is outside of the framework of discussion for this question)
It seems that the only way to do this is to write a regular application (it apparently will not work at all from a service), and then have the webapp communicate with that application and send and recieve data through that application.
So my question is what is the ideal way of setting up an intermediate application that will communicate with the web app?
Should I write a regular console application and get data from standard output? Or are there better ways of accomplishing the same goal?
QuickBooks exposes it's API through a COM interface and there are some limitations in how that can be used. An intermediate application that acts as an relay is an appropriate solution.
I would recommend building or using an application that listens over HTTP and proxies requests and responses to QuickBooks. In fact we use exactly the same approach in our product - RSSBus QuickBooks ADO.NET provider. Here are more details of what we do it in our product: http://rssbus.com/kb/help/RQR1-A/pg_qbconnector.rst