Hallo List 

Weiss jemand wie man in eines aspx-soap-proxy-client (wow was ein wort)
einen 
Soapheader einbaut? Ich hab die komplette MSDN abgesucht aber leider ist
die
Zu SOAP noch etwas unvollst�ndig. Kann mir irgendjemand weiterhelfen?




Normaler aufruf in der aspx:

//callservice.aspx
<%@ Page Language='C#' Debug='true' %>
<% @Import Namespace="MyProxy"%>

<script language="C#" runat="server">
void btnPress_Click(Object Sender, EventArgs E)
{
  MyWebService myService = new MyWebService();
  lblHelloOut.Text = myService.MyWebMethod();
}
</script>

<html>
<body>
<form runat="server">
<asp:Button id="btnPress" text="Say Hello!" onClick="btnPress_Click"
runat="server" />
<br/>
<asp:Label id="lblHelloOut" text="" runat="server" />
</form>
</body>
</html>

//MyProxy.cs
namespace MyProxy {
    using System.Diagnostics;
    using System.Xml.Serialization;
    using System;
    using System.Web.Services.Protocols;
    using System.Web.Services;


 
[System.Web.Services.WebServiceBindingAttribute(Name="MyWebServiceSoap",
Namespace="http://www.contoso.com";)]
    public class MyWebService :
System.Web.Services.Protocols.SoapHttpClientProtocol {

        public MyHeader MyHeaderValue;

        [System.Diagnostics.DebuggerStepThroughAttribute()]
        public MyWebService() {
            this.Url = "http://localhost/reg.asmx";;
        }

 
[System.Web.Services.Protocols.SoapHeaderAttribute("MyHeaderValue",
Required=false)]
        [System.Diagnostics.DebuggerStepThroughAttribute()]
 
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.c
ontoso.com/MyWebMethod", RequestNamespace="http://www.contoso.com";,
ResponseNamespace="http://www.contoso.com";,
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)
]
        public string MyWebMethod() {
            object[] results = this.Invoke("MyWebMethod", new
object[0]);
            return ((string)(results[0]));
        }

        [System.Diagnostics.DebuggerStepThroughAttribute()]
        public System.IAsyncResult BeginMyWebMethod(System.AsyncCallback
callback, object asyncState) {
            return this.BeginInvoke("MyWebMethod", new object[0],
callback, asyncState);
        }

        [System.Diagnostics.DebuggerStepThroughAttribute()]
        public string EndMyWebMethod(System.IAsyncResult asyncResult) {
            object[] results = this.EndInvoke(asyncResult);
            return ((string)(results[0]));
        }
    }

 
[System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.contoso
.com", IsNullable=false)]
    public class MyHeader : SoapHeader {

        public string Username;

        public string Password;
    }
}



_________________________________________________________

Do You Yahoo!?

Get your free @yahoo.com address at http://mail.yahoo.com




| [aspdedotnet] als [email protected] subscribed
| http://www.aspgerman.com/archiv/aspdedotnet/ = Listenarchiv
| Sie k�nnen sich unter folgender URL an- und abmelden:
| http://www.aspgerman.com/aspgerman/listen/anmelden/aspdedotnet.asp

Antwort per Email an