I have to write client program in C# that have to take some data from DB and sent it to my Google application(Java). How can I do that? What is the best way to do that?
It'll be great if there be some code example in answers.
You can put your data in JSON format and send it with server request, but I`m not sure does JAVA support working with JSON.
You need to create a web service in your app engine app that would take post data and consume it.
Preferably Use a web service framework otherwise you will have to do a lot of xml parsin yourself, which is baaed. mmmkay
Now I dont know if ur using py or java, but do look for a web service framework in ur language. mmkay
Related
I'm currently planning on a project I want to work on. These are the steps:
User visits the website and searches for a name
PHP sends a command to a C# or Java program
Program sends JSON data back to the website
PHP saves data to MySQL and shows data to user
I'm trying to research what I need to do to make this work. I just need advice on what to search for to learn. How do I make PHP and the program communicate? Should I look into servlet? Any advice on doing the steps more efficient like making the program query the database instead.
Personally, I'd prefer Web-Service for your situation. you can design a Web-Service method for C# or Java , these mechanism provides a platform for your PHP application ( or another applications ). the PHP application only call the Web-Service methods. WS method perform the search and return the result. then you can process the result and do whatever you want.
Do this by database. Make a java thread scheduler which seance a database table each time. Now whenever PHP receive a request then it will insert that request into database with a new flag, now Java thread which is sensing the database will pick the request from database and process that and after processing will put the response into database , now PHP can pick that response and send back to USER.
May be you can use shell_exec from PHP to communication with C# or Java
Please read PHP Manual for using shell_exec
Today'm trying to pass a variable and an array of PHP to a desktop application, but I have no clue how to do it.
To be more precise in my question I need PHP run the Desktop Application Developed in C # or VB.NET and send a variable.
If anyone can help me with some solution,suggestion or method is welcome Thank You.
You should send the information to the client in a format you can parse client side. XML would be one example.
So if you go the XML route (I'd look for a better transport data structure)
PHP outputs XML when the client application requests the data
The client then parses the XML pulling the data from it and storing it as a native data structure
Given your clarification in your comment (that you want to do this on the client machine), the answer is you can't. PHP doesn't run on the clients machine, it runs on your server and outputs to the clients browser, the browser then interprets that and displays the results, the browser doesn't run other applications as that is asecurity breach...except when downloading certain mime-types. If you are doing this with the users knowing cooperation, that might be a solution. If you control both code bases (the PHP and C#), then it's more likely, it would make more sense for the user to run the desktop app and for it to communicate with the PHP page to get the info it has.
Ok I want to build a simple chat app where people can go a url, type in a name and a message and click submit and it will basically show that message to everyone that is current connected.
Firstly i would like to state i've had zero experience in sockets programming and the like. I'm simply a web 2.0 person building websites with css/html/js/ajax and backend i have asp.net on vb and sql server for database.
The many tutorials i've read linked me to http://superwebsocket.codeplex.com/
I've downloaded it, but im totally lost. i can't get the samples working and i don't even know what to run.
So basically coming from an ajax background, i was wondering why do we even need to download any additional stuff to do web sockets? I mean in ajax i can simply create a asd.aspx file and use Response.Write(text) (text based on the input which are available through dissecting the url) and voila, the server side is done, all that's left is just to create new XMLHttpRequest and stuff in the client side.
So ok I'm not worried about the client side part of Web Sockets. but the server side part of web sockets is just difficult. so in the client side i have this: ws://localhost:8080/websocket. Is it true that it will work if is also an .aspx file as such: ws://localhost:8080/websocket.aspx ?
I'm wondering so how do i continue from here? in Ajax i will supply parameters from client in the url as such: page.aspx?a=1&b=2 and do output in the server using Response.Write it's all clear but how do we do it in web sockets?
I mean of course i do not demand a full explanation with a forum reply but if someone could link me to a tutorial/book that actually does explain these stuff it would be great.
Microsoft's implementation has a full chat client sample for both HTML5 and pure C#.
http://html5labs.interoperabilitybridges.com/prototypes/websockets/websockets/download
I'm guessing this implementation is what would end up in ASP.NET and .NET framework so I'm using it because of that.
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.
Could anyone give me a small and simple example of how to do this? Or some good pointers on how to get started.
I would like to create a C# client that can send a file or some text or xml or whatever, to a web service or something similar written in PHP, where the PHP Web Service stores it in a file or a database or something like that. Just not sure how to get started.
I guess the first step would be to create the php web service. And then it perhaps would be quite easy to use it in C#, since I could probably pretty much use the "Add Web Reference" button in vs and then go from there?
You can take a look at this tutorial showing how to develop a web service using php. The .NET client will be pretty straightforward as you mentioned.
I'm not versed in the C# aspect of your question, which you intend to be the consumer. But if you don't mind using a library to expedite the process of getting the webservice up and running, you can set one up very quickly using Zend Framework. Check out the documentation for setting up a Zend_Rest_Server.
Just a thought... if the service only has to support simple operations like "upload a file", perhaps avoid WSDL all together? I assume PHP can handle raw requests - so you can use the oh-so-complex .NET client:
using (WebClient client = new WebClient())
{
client.UploadFile("http://some/upload.php", "foo.bar");
client.UploadString("http://some/upload.php", "some text");
}
etc. Likewise, you can often easily use POX / REST without the complexity of a formal web-service contract. The above code just does a simple HTTP request with the file-contents/string in the body.
you are right. all you need to do is to create a simple web service in PHP, which accepts the request/xml/file and then stores it in a database. then you can use the webservice using any technology, C# for sure.
in order to write a web service in PHP, I think it is better to choose your webservice type in the first step. it can be a REST web service, or SOAP, or XML-RPC. it depends on the level of complexity of your application.
if your application is as simple as just throwing a string to the webservice or a file URL, so then the webservice can store that string, or fetch the file from the URL and stores it in database, I recomment REST. because it is simpler. as simple as just writing a simple PHP script that uses it's HTTP parameters as input.
but incase you want it to be more secure or have more complex needs, It is easy to have SOAP services in PHP. if you wanted to work with SOAP, PHP has an extension (php-soap) which you can install and use the built-in functionality of PHP-SOAP. if you are using an older version of PHP that does not support the extension, or your application will be hosted where php-soap is not installed, there is pure PHP implementaion of SOAP protocol, named nusoap. it is open source and works very well.
http://sourceforge.net/projects/nusoap/
I have made work in PHP NuSOAP webservice and my C# mobile client fetching data from web services.Below is the link
http://khanmubeen.wordpress.com/2010/11/18/web-services-with-php-nusoap-c-mobile-client/
In case you like to know more from me welcome to inbox me at mubeen44us at gmail.com