RE:.NET SAP Connector / single sign on via ASP.NET

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Christoph (anonymous_at_discussions.microsoft.com)
Date: 05/24/04


Date: Mon, 24 May 2004 07:27:01 -0700

Hallo,

hier ein Beispiel:

...
string con = @"http://SAPSERVER:8059/sap/bc/soap/rfc";
string username = "BLA";
string password = "XYZ";

HttpWebResponse response = null;

HttpWebRequest request = (HttpWebRequest) WebRequest.Create
(con);
request.Credentials = new NetworkCredential
(username,password);
request.ContentType = "text/xml; charset:ISO-8859-1";
request.Accept = "text/xml";
request.Method = "POST";

Stream stream_request = request.GetRequestStream();
StreamWriter writer = new StreamWriter(stream_request);

writer.WriteLine(@"<SOAP-ENV:Envelope xmlns:SOAP-
ENV=""http://schemas.xmlsoap.org/soap/envelope/""
xmlns:SOAP-
ENC=""http://schemas.xmlsoap.org/soap/encoding/""
xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">");
writer.WriteLine(@"<SOAP-ENV:Body>");
writer.WriteLine(@"<m:BAPI_BUPA_SEARCH xmlns:m=""urn:sap-
com:document:sap:rfc:functions"">");
writer.WriteLine(@"<ADDRESSDATA>");
writer.WriteLine(@"<COUNTRY>*</COUNTRY>");
writer.WriteLine(@"</ADDRESSDATA>");
writer.WriteLine(@"</m:BAPI_BUPA_SEARCH>");
writer.WriteLine(@"</SOAP-ENV:Body>");
writer.WriteLine(@"</SOAP-ENV:Envelope>");
writer.Close();
stream_request.Close();
                                
// response
response = (HttpWebResponse) request.GetResponse();
Stream receive_stream = response.GetResponseStream();
StreamReader reader = new StreamReader(receive_stream);
string dummystring = reader.ReadToEnd();
reader.Close();
receive_stream.Close();
...

Gruss, Christoph.

>-----Originalnachricht-----
>Hallo,
>
>Aufgabenstellung: Ich soll mittels .NET SAP Connector
>eine Verbindung zum SAP-System herstellen und die
>User-Credentials aus dem Browser (Windows-
Authentifizierung)
>zur Anmeldung am SAP-System verwenden und zur SAP-
>Applikationswebsite verzweigen.
>
>Ich habe einige Infos, allerdings nur bruchstückhaft.
>
>Hat jemand vielleicht ein fertiges C# Code-Beispiel, wie
>so etwas aussehen könnte?
>
>Der Ablauf soll wie folgt sein:
>
>- User identifiziert sich auf ASP.NET site
> via Windows-Authentification
>- User-Credentials werden mittels SAP-Connector
> an das SAP-System übermittelt & gecheckt
>- Redirect zur SAP-site, User ist dort angemeldet
>
>Danke!
>Peter
>
>.
>



Relevant Pages

  • Randomly request timeout (IIS6.0)
    ... I have got IIS 6.0 on Windows 2003 Server. ... string host_address ... HttpWebResponse response; ...
    (microsoft.public.dotnet.framework.aspnet)
  • HTTPS with WebResponse class
    ... http:// connection. ... public string postForm ... HttpWebResponse result = null; ... Stream ReceiveStream = result.GetResponseStream; ...
    (microsoft.public.dotnet.security)
  • Post Data (Urgent)
    ... post is essentially a string delimited in a special way ... StreamWriter streamWriter = null; ... HttpWebResponse httpWebResponse = ... Unfortunaly the session variables do not exist. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Retrieve Form Key-Values from HttpWebResponse
    ... > which reads into a stream and then into a string. ... HttpWebResponse itself is completely agnostic to what it contains -- it ... you need to search through the HTML document. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: HTTPS with WebResponse class
    ... Best way to test your client is see if you can do the same from IE. ... > public string postForm ... > result = (HttpWebResponse) req.GetResponse; ... > Stream ReceiveStream = result.GetResponseStream; ...
    (microsoft.public.dotnet.security)