on 06-27-2014 12:58 PM
Hi,
i have consume the SAP web service from .NET environment to get list of customers . my Code as follows ;
Add the web reference
WebReference_PlantList.Y_WEBS3 myList = new Y_WEBS3(); //Create the instence
WebReference_PlantList.Y_WEBS31[] myPlantInput = new Y_WEBS31[2]; // Declare the array
WebReference_PlantList.Y_WEBS3Response myPlantResponse = new Y_WEBS3Response(); // Instantiate the Response
NetworkCredential myCredentials = new NetworkCredential("xxxx", "xxxxx"); // set the credentials
myList.PreAuthenticate = true;
myList.Credentials = myCredentials;
myPlantResponse = myList.CallY_WEBS3(xxxxxxxx); // from this point onward i am stuck .if any one can help with rest of the things , that will highly appropriated
i was able to get the data successfully when web service develop only with export parameter , but this case its return a table .
Regards,
T.w.k
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sample Code ;
string str_err;
try
{
WebReference_PlantList.Y_WEBS3 myList = new Y_WEBS3(); //service
WebReference_PlantList.Y_WEBS3Response myPlantResponse = new Y_WEBS3Response(); //response
WebReference_PlantList.Y_WEBS31 input = new Y_WEBS31();//input
// Create array list here
List<WebReference_PlantList.YEMPLANTS> mm = new List<YEMPLANTS>();
input.ZPLANTDET = mm.ToArray();
NetworkCredential myCredentials = new NetworkCredential(SAPUserName, SAPPasword); //set credentials
myList.PreAuthenticate = true;
myList.Credentials = myCredentials;
myPlantResponse = myList.CallY_WEBS3(input);
//Loop through the response
foreach (var item in myPlantResponse.ZPLANTDET)
{
myController.plantList_Service(item.WERKS,item.NAME1 );
}
}
catch (Exception ex)
{
mylog.insert_log(ex.Message);
throw;
}
Regards,
Thushara
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.