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
SFDCkumarSFDCkumar 

Web service callout failed: Failed to get next element

Hi Guys,

I have generated Apex stub from WSDL shared by other application.I am trying to invoke this service from salesforce but its getting errored out with 'Web service callout failed: Failed to get next element'.  When we are trying to hit the service through SOAPUI with below request its working. It seems issue is with some namespace binding  for InvoiceID
For SOAP UI:  <typ:invoiceId>90153875888</typ:invoiceId>
For Salesforce:  <invoiceId>90153875888</invoiceId>
How can i fix this issue?

SOAPUI Soap Message:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://cxf.apache.org/mime/types">
   <soapenv:Header/>
   <soapenv:Body>
      <typ:invoiceFileRequest>
         <!--Optional:-->
         <typ:invoiceId>90153875888</typ:invoiceId>
      </typ:invoiceFileRequest>
   </soapenv:Body>
</soapenv:Envelope>
Salesforce generated Soap meesage:
 
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 
   xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <env:Header/>
   <env:Body>
   <m:invoiceFileRequest xmlns:m="http://cxf.apache.org/mime/types">
   <invoiceId>90153875888</invoiceId>
   </m:invoiceFileRequest>
   </env:Body>
   </env:Envelope>

Below is generated apex code.
public class TarkkicxfApacheOrgMimeTypes {
    public class invoiceFileRequest {
        public String invoiceId;
        private String[] invoiceId_type_info = new String[]{'invoiceId','http://cxf.apache.org/mime/types',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://cxf.apache.org/mime/types','false','false'};
        private String[] field_order_type_info = new String[]{'invoiceId'};
    }
    public class invoiceFileResponse {
        public String invoiceId;
        public TarkkiabpWsTarkkiElisaFi.tarkkiAbpInvoice invoice;
        public String fileContent;
        private String[] invoiceId_type_info = new String[]{'invoiceId','http://cxf.apache.org/mime/types',null,'0','1','false'};
        private String[] invoice_type_info = new String[]{'invoice','http://cxf.apache.org/mime/types',null,'0','1','false'};
        private String[] fileContent_type_info = new String[]{'fileContent','http://cxf.apache.org/mime/types',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://cxf.apache.org/mime/types','false','false'};
        private String[] field_order_type_info = new String[]{'invoiceId','invoice','fileContent'};
    }
}
public class TarkkiabpWsTarkkiElisaFi {
    
    public class tarkkiAbpInvoice {
        private String[] apex_schema_type_info = new String[]{'http://abp.ws.tarkki.elisa.fi/','false','false'};
        private String[] field_order_type_info = new String[]{};
    }
    
    public class AbpCorporateInvoiceServiceImplPort {
        public String endpoint_x = 'http://xxx.xxx.xx.7x:4xx/services/viewArchi';
        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://cxf.apache.org/mime/types', 'TarkkicxfApacheOrgMimeTypes', 'http://abp.ws.tarkki.elisa.fi/', 'TarkkiabpWsTarkkiElisaFi'};
              
        public TarkkicxfApacheOrgMimeTypes.invoiceFileResponse getInvoiceFile(String invoiceId) {
            TarkkicxfApacheOrgMimeTypes.invoiceFileRequest request_x = new TarkkicxfApacheOrgMimeTypes.invoiceFileRequest();
            request_x.invoiceId = invoiceId;
            TarkkicxfApacheOrgMimeTypes.invoiceFileResponse response_x;
            Map<String, TarkkicxfApacheOrgMimeTypes.invoiceFileResponse> response_map_x = new Map<String, TarkkicxfApacheOrgMimeTypes.invoiceFileResponse>();
            response_map_x.put('response_x', response_x);
            system.debug('--------------------------'+request_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              '',
              'http://cxf.apache.org/mime/types',
              'invoiceFileRequest',
              'http://cxf.apache.org/mime/types',
              'invoiceFileResponse',
              'TarkkicxfApacheOrgMimeTypes.invoiceFileResponse'}
            );
            response_x = response_map_x.get('response_x');
            return response_x;
        }
        
       
    }
}
Thank you in advance!

 
Kalpesh Vyas 7Kalpesh Vyas 7
Did you get any solution for this?
narasimharaju monapati 13narasimharaju monapati 13
Did you get any solution for this?
Elson da Costa SilvaElson da Costa Silva
Did you get any solution for this?