I am trying to implement webservices in my porject but the reference can't be found. What might be the issue here? What am I missing?
This is how I reference the Web service. I went to the project root in the solution explorer. Right click and Add Web Reference. It showed the method and everything but when I go in the code to make reference I can't find it.
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using net.webservicex.www;
I found the problem. You need to create a new website in order to show all the elements from the webservice. Creating a new Project was not giving me the expected results to be able to connect to the webservice.
I'm a little confused by the comments under the question...
If you are using a web-reference (2.0), you are asked for a "web reference name"; this doubles as your namespace to the item. You can access the service via something like MyWebReferenceName.MyServiceName.
When you use the "add service reference" dialog (3.0+), you are prompted for a "namespace", which acts identically. In this case, the service is available at something like MyWebServiceReferenceName.MyServiceNameClient.
Related
I am a C# newbie and trying to use the example in the below link.
https://learn.microsoft.com/en-us/previous-versions/office/developer/exchange-server-2010/bb799791(v%3Dexchg.140)
The problem is, it is asking for a reference and I can't seems to find it under
Microsoft.Exchange.WebServices or any of the sub references under that, eventhough article pointing it to be part of the Exchange webservices.
Error occurs under the below line. It says something about a missing directive.
ConvertIdType request = new ConvertIdType();
Below is my code:
using System,
using Microsoft.Exchange.Webservices;
ConvertIdType request = new ConvertIdType();//error on this line.
ExchangeServiceBinding esb = new ExchangeServiceBinding();// same error on this liine too
exchange = new ExchangeService(ExchangeVersion.Exchange2010_SP1); //this line works fine.
What am I doing wrong here?
Thank you for your answers/pointers
UPDATE:: Thank you all for trying to answer my question. Sorry for not getting back earlier as I seem to have moved from that approach and continued without the requirement of this piece of code. It's been more than a year and I can't remember what was my ultimate goal in this.
In your example you have posted both code for the EWS Managed API library and the EWS WSDL proxy. ConverItType is a class from the WSDL proxy unless you have a need to write code using the WSDL proxy i would suggest you stick to using the EWS Managed API which will make you life a lot easier. Your code for the EWS Managed API should look like
using System,
using Microsoft.Exchange.Webservices.Data;
ExchangeService exchange= new ExchangeService(ExchangeVersion.Exchange2007_SP1);
exchange.Credentials = new WebCredentials("user1#contoso.com", "password ");
exchange.AutodiscoverUrl("user1#contoso.com");;
then whatever you want to do eg if you want to convert and Id then use the sample from https://learn.microsoft.com/en-us/previous-versions/office/developer/exchange-server-2010/gg274397(v%3Dexchg.80)
According to the documentation, the type ConvertIdType should be under the namespace ExchangeWebServices and not under Microsoft.Exchange.WebServices.
Hope it helps!
I am currently building C# applications that talk to SharePoint 2013 using Microsoft.SharePoint.Client.
One requirement I have is to access Microsoft.AnalysisServices.SharePoint.Integration.DataRefreshSchedule to change this. Searching through google I have found a couple of solutions that use the old Microsoft.Sharepoint.dll which does not help me.
The first part of this solution runs the following:
(GeminiServiceApplicationProxy)SPServiceContext.GetContext(sPSite).GetDefaultProxy(typeof(GeminiServiceApplicationProxy))
Put simply I'd like to run this using ClientContext instead. A command like:
ClientContext c = get the context
c.GetDefaultProxy(typeof(GeminiServiceApplicationProxy))
Alas I cannot see a way to do this.
I have two key questions:
How can i access the DataRefreshSchedule using ClientContext or
How can I get the default proxy using ClientContext.
I have hosted two WCF services using a console application, one on port 8080 and the other at port 8090. I am able to create object for the first service named AccountManagementService but not for the other service named UserRegistrationService.
Snapshot below shows that two services have been added.
The second service doesn't show up in intellisense at all.
The complete details of the service used can be found at the following link(this is also a question asked by me):
Hosting two WCF services using a single console app
I have tried multiple times deleting and creating new service but nothing seems to be working. Please suggest.
based on the image, it should be there. open the reference.cs file for the service that is not showing up in IntelliSense and check the namespace. Then Try creating the reference using the full name. to get to the reference.cs file, click on Show all files in solution explorer as shown below
for example, if in reference.cs, you see the namespace WWWCF.UserRegistration as foo.bar.WWWCF.UserRegistration, then create instance using
foo.bar.WWWCF.UserRegistration ref = new foo.bar.WWWCF.UserRegistration ();
Found the solution. Not sure I understand the reason, though. But the following link has answers to my issue and has solved it.
Empty Reference.cs file issue solved
I am trying to connect to Magento API using C#. I am using Magento Go service and from what I've read I am able to use their API - I hope I am not wrong here. So here is what I did:
I added a Service Reference to http://mydomain.gostorego.com/api/v2_soap?wsdl=1, and just adding a service worked fine. Now I created a test class with GetStuff() method, which looks like this:
using ww.Feeds.MagnetoGoService;
public static string GetStuff()
{
MagnetoGoService.Mage_Api_Model_Server_V2_HandlerPortTypeClient s = new MagnetoGoService.Mage_Api_Model_Server_V2_HandlerPortTypeClient();
var login = s.login("username here", "key here");
return login.ToString();
}
When I run the program I get an error in first line saying:
Could not find default endpoint element that references contract 'MagnetoGoService.Mage_Api_Model_Server_V2_HandlerPortType' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
Any ideas what this may be? Do I have to set something up in my Magento Go settings? Or maybe using Magento Go is not allowing API access?
Thanks a lot.
Forget SOAP with c# you will pull your hair out. Download Charls Cook's xml-rpc api libary for c# and use the xml-rpc method. You won't get all the snazzy intellisense but at least it will work. There's also c# solution from ez.newsletter they released with Cook's library demonstrating how to use 80% of the magento api calls.
Cook's library xml-rpc.net
http://www.xml-rpc.net/
ez.newsletter solution
http://code.google.com/p/csharlibformagexmlrpcapi/
If anyone ever has problems with this, my solution was this:
I used the reference in one project, but I actually called the class and had main program in another project. You need your Service reference to be in each project wherever you're using it. That fixed it! Alternatively you can create a new BasicHttpBinding() and putt all the options from app.config/web.config into that binder, then you don't need to reference to Service everywhere. I hope that helps!
Hello i'm trying to add a webservice to my project, and that web service is from another project i have open. IIS is set up and everything works good with the webService.
Ok so on first image ,im using the webservice in the same project i have it created and it works fine
http://img215.imageshack.us/img215/4605/55347669.jpg
On second image i add the webreference and it is added succesfully . Thing is i dont know how to access it ( the HelloWorld function that returns a string which i want to set up to be text for the label )
http://img846.imageshack.us/img846/4922/19350256.jpg
The error i get at the second image says
" BankarskiUslugi is a namespace but it is used as type."
So i would appreciate any help if someone tells me how can i 'call' the webservice in my proect.
Thanks a lot in advance !
When you added the web service reference, it should have shown a namespace for the web service you were referencing; you need to add something like:
using YourWebServiceNamespace;
And then you should be able to instantiate it and call the methods as you are trying to do on the second image.
Alternatively, you can use WCF Test Client (WcfTestClient.exe) as far as testing is concern.
See How to Consume a Web Service.