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?