You need to sign in to do that
Don't have an account?

Apex callout to .Net Webservice.
Hi,
I added the .net WSDL file to my Apex project and also added the endpoint URL in Salesforce remote settings.
So now in the following class below i have a list of objects APImageslist.
So the WSDL2Apex calss is called as AJAXOrg and has a method GAPNetworkInages().
This is the method i need to calla and pass the APImageslist to check for the images.
Can any one suggest what to be done after and how would i be able to connect the Wsdl2apex class.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | public class APImageUpdates {
|
edit the apex wsdl class source and look at the method parameters, its just like any other class..
create an instance of the class, then call the method thru the instance..
my calling code to my wsdl created web service looks like this
HI,
thank you for your response.
Yes i have instantiated the method as you suggested. And i am calling the method passing a dummy string as the method in the service is declared to take a string. My objectiuve here is once i update the list APImagefiles with the records . Should they be passed as a string or can they be also passed as a list object(if i would change the return type in the service to List object too).
what should be the practice if i wanna pass a list object with records to services and if they shold be passed only as strings what should i do next to convert the list object to strings. Also how would i be able to debug with my service once its passed.
Please suggest..
}
public class APImageUpdates {
public void APImagesMissing()
{
string Test;
List<Contact> APContacts = new List<Contact>();
List<AP_Application__c> APImagefiles = new List<AP_Application__c>();
//Loop through Contacts for Available AuPairs
for(Contact contact: APContacts)
{
system.debug('Entered the List');
if(contact.AP_Status__c =='Available' && contact.RecordTypeId =='012300000000AHhAAM')
{
for(AP_Application__c APAppObj: [Select Id,Au_Pair__c,IsExist_Photo1__c,IsExist_Photo2__c,IsExist_Photo3__c,IsExist_Photo4__c From AP_Application__c where Au_Pair__c =: contact.Id])
{
if(APAppObj.IsExist_Photo1__c == false || APAppObj.IsExist_Photo2__c == false || APAppObj.IsExist_Photo3__c == false || APAppObj.IsExist_Photo4__c == false)
{
System.Debug('AP missing an Image with contact id' +contact.id);
APImagefiles.add(APAppObj);
}
update APImagefiles;
}
}
}
System.debug('List of APs missing images:' +APImagefiles);
//Create the Stub
AJAXOrg.AjaxSoap service = new AJAXOrg.AjaxSoap();
// Make the Web service call
String output = service.GAPNetworkImages(Test);
}
as long as u never need to call this web service from a trigger, you can pass a List of objects.
here is how the web service was created with the Wsdl Import tool in SFDC
note that last three parms are defined as 'arrays' of objects.
calling a future method does not support complex objects.. so I had to build these IN the future method..
my wsdl defined those object definitions.
here is the WSDL type
and the method in the WSDL