function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Warjie Malibago 15Warjie Malibago 15 

Kit to connect Salesforce to external systems with SOAP?

Hi all,

I've been fairly new to this SOAP thing and still trying to grasp the logic behind it.

So let's say I have an enterprise system (external) that needs to be connected to Salesforce using SOAP, what I need would be the following:
  1. Remote Site - where I'll put the endpoint URL and some other details
  2. WSDL Apex Class - will need WSDL file from the system to generate. Salesforce will use the methods from the system.
Am I missing something here? I think it's still not complete.. that I still need some other Apex class (like mentioned here) that will invoke those WSDL methods or something?

I'm working on a project involving this but up until now, I still cannot find that 'apex class' (if there is).

Appreciate the help! Thanks!
Best Answer chosen by Warjie Malibago 15
MatsMats
I can't help you with all your questions but I wonder if you realize that the WSDL's are stubs, i.e. method names and required parameters, properties etc on the remote system. You have to supply the code in your end that makes things happen, locally and remotely. Otherwise nothing happens.

All Answers

NagendraNagendra (Salesforce Developers) 
Hi Warjie,

May I request you to please confirm that were you not able to see the apex class and generate from WSDL option?

Please let us know.

Regards,
Nagendra.
MatsMats

This might be of interest to you regardless if your remote site is running a .NET applications or not.

http://www.developer.com/net/net/salesforce-integration-with-.net-callouts-.html

Warjie Malibago 15Warjie Malibago 15
@Nagendra, @CountZero

Sorry I cannot see the "Reply" link in your answers.

I searched for whatever class(es) that uses the URL described in the Remote Site (see url.PNG). There are 3 apex classes referencing this URL. These classes are WSDL generated within Salesforce.
User-added image.
Digging deeper, these WSDL classes reference another WSDL classes (WSE001_Wearer and WSE002_Wearer for the last 2 classes)
User-added image
Other than that, I am yet to find any other component that callouts these classes as mentioned by CountZero.

Here's the remote site
User-added image

New questions arise:
  1. If I understand it correctly, Salesforce invokes whatever functionality the external system has by (1) using the methods & classes inside the WSDL classes which came from the external system and (2) using the Remote Site to authenticate the connection.
  2. Since there are nested references of the WSDL classes, does it mean we have separate WSDL files uploaded into Salesforce? (I assume yes).
  3. There has to be another Apex class or whatever component that uses these WSDL classes if I'm not mistaken because the WSDL alone cannot work unless used. (I'm just not sure if WSDL to WSDL reference like this is enough).
  4. Is there any tool I can use to find what component uses the WSDL classes? I looked at Dev Console and I only found they are referencing each other. MavensMate and Eclipse are not working fine in my laptop.
Thanks and sorry for the novel-like reply!
Warjie Malibago 15Warjie Malibago 15
In addition, I'm trying to invoke the web service in dev console. Do you know how can I access GetTestCases()?
Invocation in dev console (always gets null). Not sure if invoke is correct or it really has no value at all.
WSE001_Org.GetTestsCasesResponse_element s = new WSE001_Org.GetTestsCasesResponse_element();
system.debug('**Case: ' + s.GetTestsCasesResult);
Code:
public class WSE001_Org {
    public class GetTestsCases_element {
        private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true','false'};
        private String[] field_order_type_info = new String[]{};
    }
        public WSE001_Ewearer.GatewayReplyOfArrayOfTestCaseDTOyxeNHFVu GetTestsCases() {
            WSE001_Org.GetTestsCases_element request_x = new WSE001_Org.GetTestsCases_element();
            WSE001_Org.GetTestsCasesResponse_element response_x;
            Map<String, WSE001_Org.GetTestsCasesResponse_element> response_map_x = new Map<String, WSE001_Org.GetTestsCasesResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://tempuri.org/ITestsCaseService/GetTestsCases',
              'http://tempuri.org/',
              'GetTestsCases',
              'http://tempuri.org/',
              'GetTestsCasesResponse',
              'WSE001_Org.GetTestsCasesResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.GetTestsCasesResult;
        }
}
WSE001_Ewearer
//Generated by wsdl2apex

public class WSE001_Ewearer {
    public class GatewayReplyOfArrayOfTestCaseDTOyxeNHFVu {
        public Integer CodeErreur;
        public WSE001_Ewearer.ArrayOfTestCaseDTO Data;
        public Double ExecutionTime;
        public String MessageErreur;
        private String[] CodeErreur_type_info = new String[]{'CodeErreur','http://schemas.datacontract.org/2004/07/eWEARERS.GATEWAY.Common.DTO',null,'0','1','true'};
        private String[] Data_type_info = new String[]{'Data','http://schemas.datacontract.org/2004/07/eWEARERS.GATEWAY.Common.DTO',null,'0','1','true'};
        private String[] ExecutionTime_type_info = new String[]{'ExecutionTime','http://schemas.datacontract.org/2004/07/eWEARERS.GATEWAY.Common.DTO',null,'0','1','true'};
        private String[] MessageErreur_type_info = new String[]{'MessageErreur','http://schemas.datacontract.org/2004/07/eWEARERS.GATEWAY.Common.DTO',null,'0','1','true'};
        private String[] apex_schema_type_info = new String[]{'http://schemas.datacontract.org/2004/07/eWEARERS.GATEWAY.Common.DTO','true','false'};
        private String[] field_order_type_info = new String[]{'CodeErreur','Data','ExecutionTime','MessageErreur'};
    }
}
MatsMats
I can't help you with all your questions but I wonder if you realize that the WSDL's are stubs, i.e. method names and required parameters, properties etc on the remote system. You have to supply the code in your end that makes things happen, locally and remotely. Otherwise nothing happens.
This was selected as the best answer
Warjie Malibago 15Warjie Malibago 15
@CountZero

This is now good. Turned out some of the methods in the WSDL classes were actually not used anywhere in the system. I was able to find some that were used. And yes you're right, WSDL are just containers. They're useless unless used. Thanks!