Daniel,
normalerweise werden die im .asmx definierten SOAP Header automatisch in
die Client-Proxy-Klasse eingebaut - in Deinem Fall ist dies die Klasse
MyHeader.
Im .aspx kannst Du dann ganz 'normal' darauf zugreifen:
Z.B.:
<%@ Import Namespace="Simple" %>
<script runat=server>
Public Sub Page_Load()
' Erzeugung einer Instanz des Proxies
Dim u = New UsingSoapHeaders()
' Neue Instanz der MyHeader Klasse
Dim oMyHeader As New MyHeader()
' Werte setzen
myHeader.Username = "Daniel"
myHeader.Password = "TeSt"
' Zuweisung
u.MyHeaderValue = oMyHeader
...
</script>
Und das tut bei mir!?
Gruss,
Christian
> 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
>
>
--
___________________________________________________
eYesoft We see your visions.
���������������������������������������������������
Christian Weyer http://www.eyesoft.de
[EMAIL PROTECTED] Bernhard-Krieg-Str. 4
Tel.: +49-9393-993161 97845 Neustadt/Main
___________________________________________________
bUilding sMart iNternet aRchitectures
���������������������������������������������������
| [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