The project I'm holding is asp.net website with static content [aspx files]
SOAP WSDL to the web services is provided and it's built with java and I have added a service to the project using "Add Service Reference".
I am looking for a way to consume that API with the website so as I could not understand how to call and integrate the data out of service and locate it into HTML[.aspx] page.
I have worked mostly with MVC projects but in this case I have not found any clue on how to do that.
After looking for many resources, Here is a conclusion how i solved my problem in case anyone needed that later in WebForms and C#.
1.Add Service Reference to your project using the WSDL link
provided
now you have classes and functions identified to your project.
Import the namespace to your class or your webform page using corresponding syntax and after that you can instantiate object out of classes and use functions
using namespace.webserviceName; with class
<%# Import Namespace="namespace.webserviceName" %> with webForm page.
One more issue popped up while I was trying to connect to the service with TLS/SSL protocols using asp.net 4.0.The Exception I received was: "The request was aborted: Could not create SSL/TLS secure channel"
-To solve this refer to this question answer
Related
I have an IIS server which runs an app containing several web services. There is a .asmx file for each web service. For some reason, I have to restrict the access to the web services so i have deleted some of the asmx files.
Now my question is, can a client still call all the web services even without the asmx file? (I haven't changed the code, just deleted the .asmx files)
You cannot use the code behind without an asmx file. IIS does not know which class to use for implementation of the service.
You need to recreate the asmx file. Their content is quite simple. It is just a single line like
<%# WebService Language="C#" CodeBehind="ASWBW_002.asmx.cs" Class="P0300_GUI.Interfaces.ASWBW_002" %>
All you need is the name of the implementing class including the namespace. Usually this is the File name and parts of the path.
The ASMX file serves as a binding between the contract and its implementation. The client upon hitting the ASMX, the corresponding IIS handler invokes the underlying class to get the methods to fire. Removing this binding renders the service unavailable.
For a proper solution, follow these:-
In general, you need to identify who all clients can access your web service. Once done, you need a mechanism to provide them the WSDL file so they can generate their proxy classes.
Once done, disable the WSDL discovery using steps Disable Service Help Page by removing the documentation protocol. Post this, no client can get the WSDL and hence any updates (even existing verified clients)
If you want to implement selective availability, you have to incorporate SOAP Header based security using WS-Security policy.
Please note that WS-* and ASMX technologies are now considered as legacy and are not supported by Microsoft. Please upgrade to WCF/WebAPI instead.
I am intending to provide access to a web service for an ASP.NET web application through a class library, and have been experimenting with a simple weather service.
In case it makes a difference I am using Visual Web Developer 2010 Express.
The interface between the web application and the class library is a simple string passed and string returned to a single method of a single class e.g.
String forecast = LibClassInstance.GetForecast("Madrid");
I added the Service Reference to the class library using AddServiceReference and created my call to the service through the automatically generated proxy classes. So far so good.
I then went to call my simple GetForecast method from my web application and got a long error message to the effect that the service might not have been configured in my project's Web.config file. After adding the Service Reference to my application project as well, it all worked as expected. I was hoping that the service behind the class library code would be hidden from its clients.
Can anyone tell me why it was necessary for me to add a service reference to the web application as well as the class library in order to get it working?
Can anyone tell me why it was necessary for me to add a service reference to the web application as well as the class library in order to get it working?
It isn't necessary. But you do need to configure the service in Web.Config - as a starting point you can copy the system.serviceModel section that was generated in the app.config of your class library when you added the Service Reference.
I have an WSDL at my disposal. it's address is : http://gy30.com/webservice/index/wsdl
when i import the WSDL through asp.net "add service references" i can see the "Operations(methods)".
After importing the WSDL i can't see any methods in the object browser. And there isn't any generated classes for this kind of WSDL.
I have read several posts on S/O and many articles about how to consume WSDL by googling, but i didn't find any solution.
http://johnwsaunders3.wordpress.com/2009/05/17/how-to-consume-a-web-service/
what are the problems ?
If i am not mistaken "Add Service Reference" is for wcf services. What you need is add Web Reference.
This service is legacy and you should use "Add Service Reference" -> "Advanced" > "Add Web Reference" and you will see old beautiful Add Web Reference dialog. And it will add reference but i couldn't consume this service. There was something wrong.
Hey Folks. I was wondering if anything special is required to add a .NET web services to the "Services" tab in NetBeans to allow my java app to consume a .NET web service.
I go and add my WSDL (simple method, 1 operation, takes a string), and I continuously get a NullReferenceError as below:
java.lang.NullPointerException
at org.netbeans.modules.websvc.saas.model.wsdl.impl.WsdlModel.getServices(WsdlModel.java:65)
at org.netbeans.modules.websvc.saas.wsdl.websvcmgr.WebServiceManager.addWebService(WebServiceManager.java:142)
at org.netbeans.modules.websvc.saas.wsdl.websvcmgr.WsdlDataManagerImpl$1.run(WsdlDataManagerImpl.java:79)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1957)
Is this something common?
I'm using Netbeans 6.9.1 and yes, the webservice is a stub that takes a string and displays a static message right now.
OK. Installing (Tools->Plugins) the SOAP web services plugin fixed my problem. Duh!
I'm trying to consume a WSE enabled Web Service from an ASP.NET Web Site.
I've installed WSE 3.0, used the config tool to add WSE info to my web.config and then done an Add Web Reference.
I believe that the problem may be that this is a Web SITE, not a Web APPLICATION. As such, the proxy class is generated at runtime, perhaps not adding the WSE magic.
I can access the proxy class from metadata, and it's of type System.Web.Services.Protocols.SoapHttpClientProtocol, which as far as I can tell doesn't have any WSE functionality.
I realize that this is all old technology, but I don't get to decide what the servers run :(
Any help would be greatly appreciated
You are wrong, proxy is generated when you are adding web reference.
Could you tell me how you are adding web reference to the website.
Please refer following article - http://msdn.microsoft.com/en-us/library/5sds7a0b.aspx
After you have located a Web service
for your application to access by
using the Add Web Reference dialog
box, clicking the Add Reference
button will instruct Visual Studio to
download the service description to
the local machine and then generate a
proxy class for the chosen Web
service. The proxy class will
contain methods for calling each
exposed Web service method both
synchronously and asynchronously. This
class is contained in the local .wsdl
file's code-behind file. For more
information, see Web References in
Visual Studio and Add Web Reference
Dialog Box.
Please refer following article - How to Add a Web Reference