I've created EJB Stateless Bean and have added #WebService, #WebMethod
annotations to be able to access it as web service. I am using
NetBeans and GlassFish. When I tested web services with server console
they worked as expected. Next I've created .net application which is
supposed to be client for my web service. The problem is when I have
more than one method in the web service it does not work. When I
remove all method except one it works ok.
I also created for test purpose not EJB based web service - web
application project with added web service. This version works ok. So
am I suppose to do something at client side or server side to make the
EJB version works?
Unless explicitly told to, the web service libraries in Glassfish produce SOAP11 WSDL's, and most .NET-tools expect SOAP12.
If you cannot make your .NET-tool understand SOAP11, it appears you must adapt your sun-javaws.xml file. I have not tried this myself.
See https://metro.dev.java.net/1.4/docs/soap12.html
Related
I have a WCF Service written for .NET Framework 4.7.2 at http://wcfservice.mydomain.com/service.svc
I also have a REST API written for .NET Core 3.1 at http://api.mydomain.com/
REST API has methods which act as transparent proxies which call WCF Service endpoints to fetch data. I have created the ServiceReference.cs in the REST API project via svcutil.
When I run the WCF Service both on Visual Studio 2019 and remote server IIS it works OK. No problems.
When I run these two projects on my local PC everything still seems OK. REST API works perfectly, calls data from WCF service and return response correctly. But when I move these two projects to the remote server IIS when I call the REST API it returns "The remote server returned an unexpected response: (405) Method Not Allowed" error.
Another strange thing is that for another project I use the same approach for a different REST API which works as a proxy to another WCF service hosted on the same remote server IIS, there is absolutely no problem and it works fine.
I have made some research and found no exact match for my case. Nobody faced this error while calling the WCF Service from a REST API. For the rest people mainly suggest two things : "Modification on Web.Config file" or "Adding WCF Activation".
First of all since I am using auto-generated code by svcutil I am not using a Web.config file which hold Service parameters and not sure to modify where and how.
Secondly, When I check the IIS I see that "HTTP activation" is already enabled under "WCF services" and I can not add "WCF HTTP Activation" under ".NET Framework 3.5". I face an error when I try to so.
Also I don't think these might be the solution because other projects on the IIS work well. I also checked application logs and Event Viewer logs but there is nothing helpful there.
I really appreciate a help on this issue.
Thanks in advance.
I'm trying to understand if there is a way to make a web application run on the local computer(browser) without IIS.
My main objective is to transform my web application (that is on the internet) to a software that runs on the local computer without using the internet and without IIS.
My idea is to distributed my webapp between my colleagues and not forcing them to work online and not needing an internet connection.
I have a MVC web app with 3 pages and a couple of methods on the server side.
The idea of the application is to get proprieties from a form that I implemented on one of the pages of my web application and transform the proprieties on the client side to JSON and send it to the server, the server will generate XML file according to the JSON object and let the client download the XML file that were generated.
The flow of it:
1.The Client fill the form in my site.
2.The form become JSON object on the client side.
3.The JSON object that stored the properties of the form(filled by the client) is send to the server.
4.The server get the JSON object and generated XML document from it.
5.The client download the generated XML file.
Very simple web application.
I know that I can run HTML page by clicking it and the page will display on the browser but I need the server side to be working too to carry out actions.
So my question is : How can I make my web application run without internet ?
With the constrains:
No IIS required.
Working with .NET 4.0. (OWIN 2.0 - Not good)
No internet require.
No installation required to the computer ill pass this web app.
The server side code wont be expose when I send this application to my friends.
I read a couple of articles about OWIN, SingalR, Cassini and WCF but its all very vague...
If someone could provide me with a guide lines it will be very helpful.
Thanks a lot.
You can definitely self host a .NET web application using OWIN. Unfortunately documentation and information about it is vague and confusing at best. The fact that you're using MVC makes it somewhat easier as you may be able to directly use the self-host packages from Nuget for self hosting Web API. There may be similar packages for MVC.
I don't have recent experience but a Nuget search for "MVC Self Host" should yield some results.
Below is a link with an example. But the term you are looking for is definitely "self host". It can be done via a console window or (more complex) a windows service. It will likely use some form of OWIN but you can probably find some startup code to copy and paste into your project, usually in the form of a Startup.cs file.
http://www.c-sharpcorner.com/UploadFile/4b0136/working-with-owin-hosting-and-self-hosting-in-Asp-Net/
I'm migrating an old Delphi application that I wrote into C#. The application is a datalogger that exposes logged data requests via a SOAP web service interface.
The web service is contained with the delphi graphical windows application, i.e. no need to run a web server like IIS, etc I just run the application and it's up and running under the hood.
I'm looking to do the same in my c# Windows form application, I can find loads of resources on writing web services that are ultimately hosted within IIS but am struggling to find a solution for a self contained web service within my application.
Does anyone have any suggestions or can point me towards any resources on this?
The web service does not neceserily have to be SOAP, REST is fine (in fact probably prefered).
Look into WCF Services.
Hosting and Consuming WCF Services
Hosting WCF services in a Windows Forms Application
The System.Web.Hosting namespace allows you to host ASP.Net pages without using IIS within your applications. I have never used it to host web services but I found a tutorial that seems to provide a guide on doing this-
http://msdn.microsoft.com/en-us/magazine/cc163879.aspx
If you're wanting to host a service inside your application, it's possible with the System.ServiceModel.ServiceHost class. You need to learn WCF first, but that at least answers your question to get you started. If you have any further questions, leave me a comment or two and I'll update my answer to accommodate your inquiries.
I have the following problem;
My console app is running on the server and all I want to do is control it over ASP.NET Web Service.
I added new ASP.NET Web Service project to my Solution where my main console app and added reference to it.
The problem is every time WebMethod calls function from console app, i get the nullreferenceexception. Even if I try to use static classes or singletons; every object is null, although my console app is running absolutely correctly.
Should I change some permisions setting or something?
Thank you for your time.
Based on your comments - your console app needs to expose API to administer it. Now this can be possible by using WCF Web Services where your console app needs to host the WCF Services. Controlling console app from ASP.NET web services would be difficult because ASP.NET web services would be hosted in different process/AppDomain (by IIS) - so they somehow need to talk console app process. This across process talk is possible in .NET using remoting or WCF. So its better to use directly WCF to provide web based API (instead of using ASP.NET web services).
Refer this article to start with creating simple WCF service and hosting it in console.
I have a question. How can i invoke a web service and get the result from a C# desktop application. I am making a desktop app and I want it to be able to connect to my online ASP.net web services. How is this possible?
In Solution Explorer, right-click your project node and select Add Service Reference.
Enter the URL where your service WSDL is located. This is usually the URL of the service itself.
This generates a strongly-typed proxy class in a new Services References folder in your project.
Write code in your desktop app to instantiate the proxy class and invoke methods on it. The rest works like magic. :)
AB Kolan was also correct, but Add Web Reference uses the old-style web services framework whereas Add Service References uses the new WCF stack. Important note: It is not required that the service itself use WCF for you to use WCF on the client side. WCF on the client is typically the best choice for any service, provided you can take a dependency on .NET 3.0 and above.
Add a Web Reference to the webservice in your Desktop App project reference. Doing so would generate a Proxy for the Webservice called Reference.cs
You can access your webservice using the proxy.
This is possible the same way that you access web services from any other type of application, be it an ASP.NET page, a class library or windows service.
For an explanatory tutorial on the subject, see Accessing a Web Service from a Desktop Application.
Will get help how to create a webservice and consume that service:
http://www.c-sharpcorner.com/UploadFile/0c1bb2/consuming-web-service-in-Asp-Net-web-application/
Thanks