Показать сообщение отдельно
Старый 14.08.2009, 14:49   #7  
Kipetcoff is offline
Kipetcoff
Участник
 
136 / 16 (1) ++
Регистрация: 20.05.2009
Адрес: Санкт-Петербург
Как на странице можно сделать референс на веб сервис? В этом та главный вопрос.
Я тут сейчас вот такую штуку мучу.. не работает правда пока..

Код:
<%@ Page Language="C#" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI.WebControls" Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	
<script runat="server"> 

	[System.Diagnostics.DebuggerStepThroughAttribute]
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	[System.Web.Services.WebServiceBindingAttribute(Name = "ListsSoap", Namespace = "http://schemas.microsoft.com/sharepoint/soap/")]
	[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
	public class list : System.Web.Services.Protocols.SoapHttpClientProtocol
	{

		[System.Diagnostics.DebuggerStepThroughAttribute()]
		public list()
		{
			this.Url = "http://пампампам.ru/Docs/_vti_bin/lists.asmx";
		}

		[System.Diagnostics.DebuggerStepThroughAttribute()]
		[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/CheckOutFile", RequestNamespace="http://schemas.microsoft.com/sharepoint/soap/", ResponseNamespace="http://schemas.microsoft.com/sharepoint/soap/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] 
		public bool CheckOutFile (string pageUrl, string checkoutToLocal, string lastmodified)
		{
			object[] results = this.Invoke("CheckOutFile", new object[] { pageUrl, checkoutToLocal, lastmodified});
			return ((bool)(results[0]));
		}

		[System.Diagnostics.DebuggerStepThroughAttribute()]
		[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/AddAttachment", RequestNamespace = "http://schemas.microsoft.com/sharepoint/soap/", ResponseNamespace = "http://schemas.microsoft.com/sharepoint/soap/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
		public int AddAttachment(string listName, string listItemID, string fileName, byte[] attachment)
		{
			object[] results = this.Invoke("AddAttachment", new object[] {listName, listItemID, fileName, attachment});
			return ((int)(results[0]));
		}
	}
	  
	protected void Page_Load(object sender, EventArgs e)
	{	
		
	}

	protected void btnUpload_Click(object sender, EventArgs e)
	{
		if (uplControl.PostedFile == null)
			return;	

		System.IO.Stream fStream = uplControl.PostedFile.InputStream;
		byte[] contents = new byte[fStream.Length];

		fStream.Read(contents, 0, (int)fStream.Length);
		fStream.Close();

		list docList = new list();
		docList.Credentials = new System.Net.NetworkCredential("логин", "пароль", "avenir");

		//%2fDocs%2fnew%5floan%2f1001744cb185de1186a10003ff966666
		//docList.AddAttachment("1001744cb185de1186a10003ff966666", "13", uplControl.PostedFile.FileName, contents);
		docList.CheckOutFile("http://пампампам.ru/Docs/new_loan/1001744cb185de1186a10003ff966666/PluginRegistration.zip", "true", "10 Aug 2009 17:57:00 GMT");
	}
	
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    
    <form id="form1" runat="server">
    <%--<asp:ScriptManager runat="server" ID="scriptManager">
                <Services>
                    <asp:ServiceReference  Path="http://пампампам/Docs/_vti_bin/lists.asmx" />
                </Services>                
    </asp:ScriptManager>--%>
    <div>				
        <input id="uplControl" type="file" runat="server" title="upldFileBox"/>        
        <asp:Button id="btnUpload" OnClick="btnUpload_Click" runat="server" 
      Text="Upload File"></asp:Button>      
    </div>
    </form>
</body>
</html>
Т.е. написал свой прокси класс. Может этот пример прояснит что я хочу, а то мы пока др др не понимаем чувсвую.