Tell me more ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have been trying to use web services to create a new survey. I initially used a ServiceReference and then tried a WebReference.

try
{

    srv.Lists client = new srv.Lists();
    client.UseDefaultCredentials = true;
    client.Url = "http://srv/xyz/de/_vti_bin/Lists.asmx";

    XmlNode node = client.AddList("paulxxx", "xxxx", 102);
    Console.WriteLine(node.ToString());


    SppLists.ListsSoapClient soap = new SppLists.ListsSoapClient("ListsSoap", "http://srv/xyz/de/_vti_bin/Lists.asmx");
    soap.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential();
    XElement x = soap.AddList("New_list", "From ws", 102);
    Console.WriteLine(x.ToString());
}
catch (Exception ex)
{
    FaultException fex = (FaultException)ex;
    MessageFault msgFault = fex.CreateMessageFault(); 
    XmlElement elm = msgFault.GetDetail<XmlElement>();
}

The ServiceReference throws a FaultException which I think (looking at the raw soap traffic) is trying to tell me that the filename is invalid. The WebReference approach seems to work ok.

In both cases something is created on the server. I can see both names listed but the one created by ServiceReference links to an unknown page.

What is happening here? Why are they different?

share|improve this question
3  
or better yet stackoverflow.com/questions/308454/… – djeeg May 4 '11 at 7:54
I would check carefully to make sure that the "web reference" actually worked. There should be no difference between the two types of reference - they are both calling the same service, aren't they" – John Saunders May 4 '11 at 16:27
I'm closing this question since it is not really SharePoint related (also a dupe of the SO question). @Paul, feel free to post another question if you are having problems getting a ServiceReference working with SharePoint. – Kit Menke May 4 '11 at 16:45

closed as off topic by Kit Menke May 4 '11 at 16:48

Questions on SharePoint Stack Exchange are expected to relate to SharePoint within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

1 Answer

Simplistically:

ServiceReference's normally have a ".svc" extension and are the newer way of doing things with WCF (Windows Communication Foundation)

WebReference's are the old way and normally end with ".asmx"

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.