cancel
Showing results for 
Search instead for 
Did you mean: 

Consume Netweaver webservice from .NET

Former Member
0 Kudos

hi,

i try to call a SAP webservice from .Net.

  • Proxy

WebService.WebReference.ZWS_RESET_SAP_PASSWDService proxy = new WebService.WebReference.ZWS_RESET_SAP_PASSWDService();

NetworkCredential credentials = new NetworkCredential("benutzer", "password");

proxy.Credentials = credentials;

String s = proxy.ZbcResetUserPassword(Parameter);

If i set the user and password an exception is thrown.

Eine Ausnahme (erste Chance) des Typs "System.Security.SecurityException" ist in mscorlib.dll aufgetreten.

System.Security.SecurityException: Fehler bei der Anforderung des Berechtigungstyps System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.

bei System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)

bei System.Security.CodeAccessPermission.Demand()

bei System.Net.HttpWebRequest..ctor(Uri uri, ServicePoint servicePoint)

bei System.Net.HttpRequestCreator.Create(Uri Uri)

bei System.Net.WebRequest.Create(Uri requestUri, Boolean useUriBase)

bei System.Net.WebRequest.Create(Uri requestUri)

bei System.Web.Services.Protocols.WebClientProtocol.GetWebRequest(Uri uri)

bei System.Web.Services.Protocols.HttpWebClientProtocol.GetWebRequest(Uri uri)

bei System.Web.Services.Protocols.SoapHttpClientProtocol.GetWebRequest(Uri uri)

bei System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)

bei WebService.WebReference.ZWS_RESET_SAP_PASSWDService.ZbcResetUserPassword(String Bname)

bei WebService.Form1.button1_Click(Object sender, EventArgs e)

Die Aktion, bei der ein Fehler aufgetreten ist:

Demand

Der Typ der ersten Berechtigung, bei der ein Fehler aufgetreten ist:

System.Net.WebPermission

Die Zone der Assembly, bei der ein Fehler aufgetreten ist:

Trusted

Der Thread 0xf28 hat mit Code 0 (0x0) geendet.

Das Programm "[3044] WebService.vshost.exe: Verwaltet" wurde mit Code 0 (0x0) beendet.

In the webservice the parameter for the authentification is none.

1. Do i have to create a rfc destination in sap?

2. Any ideas what's wrong?

regards

Accepted Solutions (0)

Answers (1)

Answers (1)

sbhutani1
Contributor
0 Kudos

Hi wolfgang,

Please refer this article for a step by step webservice consumption in .NET

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3057b5a7-99d0-2910-8f8f-f357dc4b...

Also if the exception is because of user name and password then try to give some variables instead of string values for user name and password.

Also you can refer this thread for the same problem discussion.

http://www.thescripts.com/forum/thread525060.html

Regards

Sumit Bhutani

Former Member
0 Kudos

hi,

if i set the user and password the following error occurs.

Domain = "credentials.Domain" hat eine Ausnahme vom Typ "System.Security.SecurityException" verursacht.

Domain = "credentials.User" hat eine Ausnahme vom Typ "System.Security.SecurityException" verursacht.

Domain = "credentials.Password" hat eine Ausnahme vom Typ "System.Security.SecurityException" verursacht.

The other desciption doesn't help.

any ideas?

regards

Former Member
0 Kudos

hi,

i have found the error.

I had to configure the security settings in my .net project.

Right click on the project and then security.

Button calculate ...

regards

sbhutani1
Contributor
0 Kudos

Hi wolfgang,

If my reply have helped you locating the problem, then dont forget to reward points.

Regards

Sumit Bhutani