cancel
Showing results for 
Search instead for 
Did you mean: 

.net web services client: problems to return value

Former Member
0 Kudos

Hi, I need some suggestions from you, please.

According to what reported in the document "Building Web Services with ABAP and SAP Web Application server. Exercise / Solutions" available in sdn.sap.com, I'm trying to create a Web Service with WAS 6.20 patch 38, that should be invoked by a C# WS Client created with Visual Studio .NET.

In WebAS I built (SE37) the function ZWS01_ADD (a remote-enabled module):

FUNCTION zws01_add.

*"----


""Interfaccia locale:

*" IMPORTING

*" VALUE(VALUE) TYPE I

*" EXPORTING

*" VALUE(RESULT) TYPE I

*"----


ADD value TO gl_result.

result = gl_result.

ENDFUNCTION.

At the moment the function is available as a WebService and I can obtain the WDSL file without troubles.

I created a new C# project with Visual Studio Net using the Console Application Template, I imported the wdsl to the Solution Explorer and here is the code of my MAIN function that invokes the Web Service:

int result;

calc.ZVW_ADDService s = new calc.ZVW_ADDService();

String Url = "http://wsap0.tsfsap.it:8000/sap/bc/soap/rfc?sap-client=100";

s.Url = Url;

result = s.ZVW_ADD(1);

System.Console.WriteLine("Result: " + result);

When I start the test with VALUE = 1, I'm sure that the WAS service is invoked (I can trace it ABAP side - I receive the correct value), the ABAP variable RESULT is set to 1 but, debugging the Web Service Client in Visual Studio, the instruction "result = s.ZVW_ADD(1);" returns a NULL causing a null exception.

Please, is there something wrong in this exercise ?

which are the minimum required versions of WAS, .net,...?

Please help me.

Thanks in advance,

Gianluca Bonavitacola

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

The SAP user and password are missing. The exception should contain more details on the failure. You can append sap-user=xxx and sap-password=xxx to the url:

String Url = "http://wsap0.tsfsap.it:8000/sap/bc/soap/rfc?sap-client=100&sap-user=xxx&sap-password=xxx";

Regards,

Guangwei