on 07-01-2010 1:03 AM
Dear all,
Hello,
I created a web service in SAP using the SAOMANAGER. I successfully added the web service into my visual studio 2008 project and able to see the web service methods. However when I call the web service method on run time it throws unauthorized error 401. I am the admin on the system.
Any help will be appreciated on this.
Thanks,
Ameha
Hi,
SAP service call needs proper authentication. so you need to configure user/password for calling service from .Net studio.
search SDN for sample code (same user/password which you used to fetch wsdl).
Regards,
Gourav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the prompt response,
Below is the code I used to call SAP service, it works perfectly for SAP Net weaver 7.0 SR3 IDES, But currently we upgrade our system to SAP Net Weaver 7.0 EHP4 IDES and I am getting unauthorized error at the code (Serviceobj.CompanycodeGetlist(ob1) despite I am the u201CGodu201D on the system the same as the previous system. Am I missing something here?
<host>.service Serviceobj = new <host>.service();
<host>.Bapi00021[] arry = new <host>.Bapi00021[20];
<host>.CompanycodeGetlist ob1 = new <host>.CompanycodeGetlist();
Serviceobj.PreAuthenticate = true;
NetworkCredential objCred = new NetworkCredential("Myusername", "Mypassword");
CredentialCache creCatch = new CredentialCache();
creCatch.Add(new Uri("http://WSDL url"), "Basic", objCred);
Serviceobj.Credentials = creCatch;
Serviceobj.CompanycodeGetlist(ob1)
for (int i = 0; i < arry.Length; i++)
{
Console.WriteLine(arry<i>.CompCode.ToString());
}
Console.WriteLine();
Console.ReadLine();
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.