1

I am new to Integration Projects. I have an Apex class generated from the WSDL of a third party. I would like to utilize the methods of that Apex class and write a batch class that utilizes the response.

Here is the error that I received when testing the code below

Web service callout failed: WebService returned a SOAP Fault: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object. at DataServices.a2zService.GetCustomSqlReport(XmlNode request) in D:\inetpub\wwwroot\027112\Partners.a2zinc.net\DataServices\App_Code\Public\a2zService.vb:line 176 --- End of inner exception stack trace --- faultcode=soap:Server faultactor=

Can someone help me on how I could test the response in Anonymous window? I can then use the same parameters in batch class as well

Here is the code that I tried executing anonymously

Request.request_element req = new request.request_element();
Dataservices.ServiceSoap service = new Dataservices.ServiceSoap();

Response.response_element res = service.GetReport(req);
system.debug('response'+res);

Here is my Apex class

public class Service {
    public class AuthenticationHeader {
        public String Key;
        public String UserName;
        public String Password;
        private String[] Key_type_info = new String[]{'Key','http://www.show.com/Services/Service/v1',null,'0','1','false'};
        private String[] UserName_type_info = new String[]{'UserName','http://www.show.com/Services/Service/v1',null,'0','1','false'};
        private String[] Password_type_info = new String[]{'Password','http://www.show.com/Services/Service/v1',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.show.com/Services/Service/v1','true','false'};
        private String[] field_order_type_info = new String[]{'Key','Source','UserName','Password','InstallName'};
    }
    public class ServiceSoap {
        public String endpoint_x = 'http://partners.inc.net/services/public/Service.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;
        public Service.AuthenticationHeader AuthenticationHeader;
        private String AuthenticationHeader_hns = 'AuthenticationHeader=http://www.show.com/Services/Service/v1';
        private String[] ns_map_type_info = new String[]{'http://www.show.com/Services/ReportRequest/v1', 'Request', 'http://www.show.com/Services/ReportResponse/v1', 'Response', 'http://www.show.com/Services/Service/v1', 'Service'};
        public Response.Response_element GetReport(Request.request_element request) {
            Request.DataService_element request_x = new Request.Service_element();

The Request class:

//Generated by wsdl2apex

public class Request {
    public class Service_element {
        public Request.request_element request;
        private String[] request_type_info = new String[]{'request','http://www.show.com/Services/ReportRequest/v1',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.show.com/Services/ReportRequest/v1','true','false'};
        private String[] field_order_type_info = new String[]{'request'};
    }
    public class request_element {
        private String[] apex_schema_type_info = new String[]{'http://www.show.com/Services/ReportRequest/v1','true','false'};
        private String[] field_order_type_info = new String[]{};
    }
}

Response Class:

//Generated by wsdl2apex

public class Response {
    public class Response_element {
        private String[] apex_schema_type_info = new String[]{'http://www.show.com/Services/ReportResponse/v1','true','false'};
        private String[] field_order_type_info = new String[]{};
    }
    public class Service_element {
        public Response.Response_element Response;
        private String[] Response_type_info = new String[]{'Response','http://www.show.com/Services/ReportResponse/v1',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.show.com/Services/ReportResponse/v1','true','false'};
        private String[] field_order_type_info = new String[]{'Response'};
    }
}

Here are the request parameters that I use to test in SOAP UI

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.