Skip to Content
avatar image
Former Member

Consuming a SAP web service from .NET

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Nov 22, 2007 at 10:44 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded