Skip to Content
author's profile photo Former Member
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 a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on 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 a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.