I wanted to make an application that will take either the path of the dll or Webservice and list me all the functions present in that dll. I accomplished the listing of the function using this but I am not able to list the functions of the Webservices. Using Assembly.GetMembers() it's listing the Function Name with the Parameters Type and I am not able to get the Parameters Name. How shall i get that? While debugging I found that m_parameters is a nonpublic member and i'm not able to get the Parameter name. Is that possible??? And one more question is how shall i list the functions available in the web service without including the web reference or service reference in the windows application using C#.
What webservices are you talking about?? ASP.NET ASMX webservices? Webservices based on WCF??
In any case, most of those web services will expose a WSDL document which basically contains the methods on the web service, plus the parameters expected for a call.
Mind you: web services don't have to publish a WSDL - it's optional. But if there is one, it's typically accessed by adding ?wsdl to the URL where the service lives, so if you want to find out what methods and parameter the prime number generator web service at:
http://www50.brinkster.com/vbfacileinpt/np.asmx
has, you do go
http://www50.brinkster.com/vbfacileinpt/np.asmx?wsdl
and grab the WSDL and start analyzing it.
To get the parameter name, use MethodInfo.GetParameters followed by ParamterInfo.Name property.
Related
I would like to know how to find the urls of internally referred services when hitting the first service.. is there any way? in fiddler I couldn't find.
I have a webservice customer.asmx contains method A(). I know only customer.asmx service complete url, with it's URL I am testing the method A in wcftestclient.
I get to know through code method A is calling reports.asmx and again resports.asmx is calling another service catalogue.asmx.
I am actually testing the test environment service, so I am not sure of the reports.asmx to which it is pointing I want to find out
Is there any way to know the complete urls of reports and catalogue services while testing my initial customer.asmx.
i have one doubt in Web Service / WCF
i'm creating the service and it's having 10 methods respectively
test1() , Program1(int age),Describe1(), DisplayAge(string name),,SimilarInterest(),ServiceCall(), Hide(), Difference(), WebService() and Help()
now after hosting this service in asmx only the below methods should display. others should not need to display.
DisplayAge(string name),,SimilarInterest(),ServiceCall() only these three should display when i call the http://URL.asmx?wsdl
the other 7 methods should not need to display in asmx wsdl file .how to do that?
As far as I know, in XML Web Service(ASMX), this should not work if you want the service to be both invoked and not shown in the WSDL. Either using private decorated methods or removing the [WebMethod] attribute causes the method to no longer be invoked. If in WCF we can implement authentication, authorization that individual methods cannot be invoked, or simply not expose metadata. But we cannot hide the specified method (but can be called by the outside world).
https://social.msdn.microsoft.com/Forums/en-US/533e0361-e9e0-400b-a7b2-f098a9ef3e75/how-to-prevent-web-method-from-showing-on-service-description-page?forum=asmxandxml
Feel free to let me know if there is anything I can help with.
I'm creating a .Net application to consume the Soap APIs.
I downloaded 2 partner wsdl files from 2 instances(production and sandbox). I think the only difference of the two APIs are their endpoints.
I then added the web references to a single application. When I write the method to consume the APIs, I don't want to duplicate the code to do same thing(insert,update...).
How can I design my code so maybe I can pass a parameter to let the method know which target instance should it talk to?
Thank you!
If the services are truly the same and just the endpoint differs, you should be able to use the generated client's Endpoint property to change the endpoint.
var client = new ServiceReference1.WebService1SoapClient();
client.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://localhost:2850/WebService1.asmx");
I am writing a custom piece of code that dynamically creates modified document libraries. I've attempted to create a document library template, which succeeds in the UI but cannot be found via-webservices.
So to get to the point - I am attempting to:
1. Set "Allow Management Of Content Types" on the list.
2. Add a new Content Type (Already Created) to the list.
3. Set the new content type as the default content type.
4. Remove the "Document" content type from the list.
So far I have succeeded in being able to "Apply" the custom content type but the others are evading my grasp. The methods I have attempted are through the Lists.asmx service and the method described here: http://msdn.microsoft.com/en-us/library/websvclists.lists.updatelist.aspx
I tried setting the Flags property and a few other potential candidates with no success and no error messages complaining about what I was trying to attempt.
One limitation is that I do NOT have access to the sharepoint dll where this is living.
Once completed - this would be a plugin living in another non-sharepoint system. The only option to include the SharePoint client dll's would be to perform an ILMerge.
EDIT:
http://msdn.microsoft.com/en-us/library/sharepoint/jj193051.aspx (SharePoint 2013 Web Services)
http://msdn.microsoft.com/en-us/library/ee705814(v=office.16).aspx (SharePoint 2010 Web Services)
and yes - technically the ASMX services sound like they're on their way out: http://msdn.microsoft.com/en-us/library/sharepoint/jj164060.aspx
Edit: Tags are relevant to the question.
use SharePoint Client Object Model. This is a library that wraps calls to webservices that allows among other things to batch commands.
The operations you mention are all available.
here is a link to an article that explains Client Object Model:
http://www.codeproject.com/Articles/399156/SharePoint-2010-Client-Object-Model-Introduction
The article focus on ListItems but you can also interact with list properties, even web properties if you want.
Please note that you don't need to run Client Object Model from your sharepoint server. Note the "Client" part in the name.
How to pass array from WinForm to WebService?
Can I get any C# sample?
In Visual Studio, simply add a Web Reference or a Service Reference to your WinForm project and it will create the service proxy for you. This assumes that your WebService is exposing a WSDL file that describes the methods and parameters used.
This is a pretty broad question, and it would depend entirely on the type of web service you are looking for. Here are some instructions on how to add a Web Service reference:
Add a link to a web service
Once added, you can call whatever method requires an array and pass in the array through the parameters. A sample instantiation and method call for a web service might look like this:
MyWebService myWebServiceInstance = new MyWebService(url);
string[] params = new string[2];
myWebServiceInstance.CallArrayMethod(params);
If the web service is SOAP based, it should have a WSDL. If so, simply import a service reference to the WSDL and it will set up the proxy for you. Then you create an array and pass it to the method in question.
If you are talking REST based services, I would look at the RestBucks implementation on CodePlex (http://restbucks.codeplex.com/). You will want to look at the client side code. It will show you how to add your "array" in the call body, while setting up header information, etc.
Worst case is going down to a lower level and creating your own Request object. Most likely that would be overkill.