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
BritishBoyinDCBritishBoyinDC 

Passing XML to External Web Service

I've had success using REST based web services that return XML but I am having more difficulty with this one, so was hoping someone could guide me in the right direction. The service I am calling is an asmx service with one method GetService() that expects to receive an XML file. I parsed the WSDL and received the following, but can't work out what I should be setting the xmldoc variable that is declared as a xmldoc_element to...a DOM.Document, XMLNode List, or something else entirely...? Thanks

 

 

//Generated by wsdl2apex

public class KWD1 {
    public class xmlDoc_element {
        private String[] apex_schema_type_info = new String[]{'http://localhost/','true','false'};
        private String[] field_order_type_info = new String[]{};
    }
    public class GetService_element {
        public KWD1.xmlDoc_element xmlDoc;
        private String[] xmlDoc_type_info = new String[]{'xmlDoc','http://localhost/','xmlDoc_element','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://localhost/','true','false'};
        private String[] field_order_type_info = new String[]{'xmlDoc'};
    }
    public class XMLServiceSFIntegratedSoap {
        public String endpoint_x = 'http://www.test.com/Services/XMLServiceSFIntegrated.asmx';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'http://localhost/', 'KWD1'};
        public String GetService(KWD1.xmlDoc_element xmlDoc) {
            KWD1.GetService_element request_x = new KWD1.GetService_element();
            KWD1.GetServiceResponse_element response_x;
            request_x.xmlDoc = xmlDoc;
            Map<String, KWD1.GetServiceResponse_element> response_map_x = new Map<String, KWD1.GetServiceResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://localhost/GetService',
              'http://localhost/',
              'GetService',
              'http://localhost/',
              'GetServiceResponse',
              'KWD1.GetServiceResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.GetServiceResult;
        }
    }
    public class GetServiceResponse_element {
        public String GetServiceResult;
        private String[] GetServiceResult_type_info = new String[]{'GetServiceResult','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://localhost/','true','false'};
        private String[] field_order_type_info = new String[]{'GetServiceResult'};
    }
}