I have created a WCF Service and published it to a Windows Server running IIS. In an asp.net web application, I can add a Service Reference to the WCF Service which exposes its methods which I can call. This all works fine.
I need someone who is running a jsp site to be able to call a method in my WCF Service. How can they do that? (I know absolutely nothing about jsp). Presumably they cannot reference my WCF Service within their application in the same way you can within a .net application.
The web services are totally platform independent. Therefore, someone writing in Java should have no problem calling a web service server, regardless if it was written using WCF or another platform. For example, here, here and here you could find some tutorials on how to build web service clients using java. This java code could be called from JSP pages.
If you want to quickly test your web service from the client side, you could use SoapUI. It's a web service client tool developed in java. I am sure you will find it useful.
Hope I helped!
Related
I have two projects in my solution that I would like to publish to Azure as a Cloudapp.
MVC webrole, (service reference to WCF webrole)
WCF webrole
Now, is it not possible to publish two webroles in one Cloudapp? (Dah, dumb question).
If not possible, how am I supposed to use my WCF service? Am I force to publish the WCF service as it's own cloudapp!?
Perhaps it is possible to publish the WCF service as a worker role so I don't have to use two cloudapps for this?
Currently everything is working great locally. I have added a service reference in my MVC project pointing to my WCF service and I'm able to use the functions that resides in there.
The problem is that the WCF webrole doesn't get published, (just the MVC webrole). I can't access the WCF service, (The resource cannot be found).
Do you have any suggestions on how I can implement my WCF service when published without too much of a hassle?
Thanks
Host your WCF service in a worker role. Thank you, Coder1409!
Heres a follow up question:
Host WCF in the Worker Role, Timeout
I am developing an Web application using WCF. I have added Web Reference in Web Application. I am adding methods in WCF as per my need then updating Web Reference in Web Application and it is updating successfully but can't access the newly added methods of WCF in Web Application.
Please Help me...
Do your new methods exist in the contract interface, and do they have the OperationContract attribute?
When you update the web reference, is it looking at a test service or your newly-modified service?
Are you running the modified service when you update the web reference, or is it that the old version of the service is running under an ASP.NET process (check your taskbar) and that is what you are updating from?
Have you rebuilt the client after updating the web reference (I know, I know, but easily missed)?
Yes I did it.
I just deleted Web Reference from Web Application and then cleaned the solution of WCF and Web Application. After that Build Solution of WCF. Then added WCF Reference through "Add Service Refeence" then Build Solution of Web Application. In this way solved my problem.
I'm wondering if it is okay to add a reference to a web service within the same project (web application), i.e. I'm adding a reference in the same project where the service is defined.
The reason for doing so is because
Hosting the service becomes easier (gets automatically hosted when hosting the web app).
Invoking the service is done dynamically, i.e. the service url is fetched (from db) at run time and methods on that particular service are invoked. (this is a web app which is hosted on many domains. each app knows the service url of other apps (urls stored in db). since I have a reference to the service, I can change the url at runtime by updating the Url of the proxy and invoke it.)
Also, I'm not sure if this is the way to go about it. I have seen a lot of people suggest using WCF instead of a web service, but I don't see how I could accomplish the same thing with WCF.
There is already a question regarding this on SO - Add Service Reference to WCF Service within Same Project, but i don't think it is valid for my situation.
If the service is already in your project, you can use it directly without requiring a web service proxy.
After all, Web services are for exposing your application functionality to the outside world and not to other parts of your system.
How to retrieve data from database using Web services on VB?
Does it have to be a web service? Have you considered WCF? (Windows Communication Foundation)
http://msdn.microsoft.com/en-us/netframework/aa663324.aspx
If I understand you correctly, you are asking how to setup a web service using vb.net to communicate with the database and return the results.
If that is correct, then there are 2 parts:
How to write a web service
How to communicate with a database
Here are three pages that will help you create a web service:
vbdotnetheaven
codeguru
techrepublic
As for the database, if you are talking about SQL Server, then see this page here and this page here
Your question isn't clear enough. Are you trying to access a web service run by ASP.NET using VB? If yes, you can make SOAP request to your web service easily using VB, your web service will then fetch the data from database and return to you. You can have a look at this tutorial on how to make a SOAP request using VB -
http://www.aspfree.com/c/a/VB.NET/Calling-a-Web-Service-using-VB6-with-SOAP-30/1/
Hope that helps.
Create a proxy class from the web service's WSDL, using Visual Studio's "Add Web Reference" feature
Configure the proxy, such as for security, if needed (the details depend on the API)
Call the proxy from your code
Im trying to make a webservice in ASP.NET and get the data in a Smart Device Application.
I have the standard HelloWorld webservice and i wanna get the data in my application, but when i try to add a web reference to my project, Visual Studio can't find any webservices running. If i start the WebService in the WebService project and copy/paste the url to the "Add WebReference" in the Application project, Visual Studio finds the Webservice and i can use the InttilSence to find the HelloWorld Method (WebServiceClass.HelloWorld()) in the WebService. But when i then run the Application project the complier gives an error saying that it can't connect to the WebService.
How do i do this? How do i access a webservice in an Application project? Every tutorial or book i have read about the subject doesn't tell anything about how the webservice should i run. In my world the webservice project should be running before i can access it from another project or am i wrong?
Consider reading Rick Strahl's Creating Web Services with .NET and Visual Studio.
From there, you'll get the basics. You can build and deploy your XML SOAP web service.
Then you'll need to have your application use that web service as a 'Web Reference'. Start by "Add Web Reference".
(source: usaepay.com)
First, you should publish the web service to some server (even your own local IIS) rather than using the Visual Studio web server.
Then in your application, point to the correct URL wherever you published it when adding the reference.
While this is a bit low-tech, couldn't you create a web requrest from the Smart Device Application to hit the webservice directly? That would be my suggestion.
An example would be using the "WebRequest" Class.
It sounds like when you try to access the Web Service from your app, the service is not running (possibly because you're only running it in the Cassini server?).
The fact that you were able to generate the Web Reference means that at some point, the service was running and was able to generate the helper classes by examining the service.
I would do as David Stratton suggests and publish it somewhere where it can run while you are developing the Smart Device app (like your local IIS).
You might also take the opportunity to wrap the service call with some error handling - maybe catch the specific exception being thrown (System.Net.WebException?)