cancel
Showing results for 
Search instead for 
Did you mean: 

example code for web service call from .NET

Former Member
0 Kudos

guys,

i am trying to understand the amount of work needed on the .NET side when calling a SAP web service from our .NET application. I have already created a FM in SAP and converted that FM into a Web service. It simply tries to get customer details like account balance and customer address from SAP.

Now, how do i integrate it into our existing .NET application. I understand that I would have to provide a url in my code that contains the sap server address, client no., web service name etc but what else needs to go into my .NEt code. Can someone please provide an example code in .NET that calls a webservice in SAP??? Please please help.

Thanks

Accepted Solutions (0)

Answers (5)

Answers (5)

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos
Former Member
0 Kudos

basis vasis,

Here is a simplified code snippet:

string I_CUSTOMER = txtCustNo.Text;

DHD.wsGetInvoices.Z_SD_VALIDATE_DATAService wsGetInvoices = new DHD.wsGetInvoices.Z_SD_VALIDATE_DATAService();

DHD.wsGetInvoices.BAPIRETURN RETURN = new DHD.wsGetInvoices.BAPIRETURN();

DHD.wsGetInvoices.ZSSD_CUST_LINE_ITEMS_WEB[] LineItems = new DHD.wsGetInvoices.ZSSD_CUST_LINE_ITEMS_WEB[0];

NetworkCredential credentials = new NetworkCredential();

credentails.UserName = "";

credentials.Password = "";

wsGetInvoices.Z_SD_VALIDATE_DATA(I_CUSTOMER,ref LineItems);

foreach(DHD.wsGetInvoices.ZSSD_CUST_LINE_ITEMS_WEB item in LineItems)

{

this.lblName.Text = item.NAME1.ToString();

}

hope it helps,

jpcosa

Former Member
0 Kudos

when you consume webservice in .net it will create a class and methods, you need to consume it and pass the data using it.

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

This message was moderated.