cancel
Showing results for 
Search instead for 
Did you mean: 

Consuming a SAP web service from .NET

Former Member
0 Kudos

I wrote and published as web service this function:

FUNCTION ZRQFUNCION.

*"----

-


""Interfase local

*" TABLES

*" LISTAPAISES STRUCTURE ZESTPAIS OPTIONAL

*"----

-


DATA: TI LIKE ZESTPAIS OCCURS 0 WITH HEADER LINE.

SELECT IDPA DESPA FROM ZRQPAIS INTO TABLE TI.

LOOP AT TI.

MOVE TI TO LISTAPAISES.

APPEND LISTAPAISES.

ENDLOOP.

ENDFUNCTION.

What I want is test the SAP WebService posibility to return a set of data rows (internal table). Don you know is it posible? How can I achive that?

This is my code in .Net

Zestpais[] lista = new Zestpais[9];

ZLISTAPAISESService x = new ZLISTAPAISESService();

x.Zrqfuncion(ref lista);

Here I have two problems:

1. I need to specify the length of the array.

2. I recive the following error message:

"Error de la solicitud con el código de estado HTTP 401: Unauthorized."

Regards,

Roberto.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Dear Friends,

I found a solution for the .net coding:

Zestpais[] paises = new Zestpais[9];

ZLISTAPAISESService x = new ZLISTAPAISESService();

System.Net.NetworkCredential y = new System.Net.NetworkCredential("alumno04", "987654321");

x.Credentials = y;

x.Zrqfuncion(ref paises);

foreach(Zestpais h in paises)

{

MessageBox.Show(h.Despa);

}

What was missing was the network credentials.