• Kalpesh Vyas 7
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
Hello everybody,

I got the error : System.CalloutException: Web service callout failed: Failed to get next element
at the line WebServiceCallout.invoke in my class.
The web service works i saw the callout response in the log but it doesn't work.

I search and i tried all the solutions but that doesn't resolve my problem.
I use the wsdl generator (Salesforce and FuseIT) and that doesn't resolve anything...
I hope that somebody can help me,
Best regards
Mathilde
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!

 

I can't get past this error message using an class generated from a WSDL. There's one or two threads that touch on this but nothing helpful. What does this message mean?

 

Web service callout failed: Failed to get next element

Error is in expression '{!doWSDLCallout}' in component <apex:page> in page simplewscallout
From debug log:

14:06:51.976 (976692000)|SYSTEM_METHOD_ENTRY|[99]|WebServiceCallout.invoke(APEX_OBJECT, APEX_OBJECT, MAP, LIST)
14:06:51.982 (982105000)|CALLOUT_REQUEST|[99]|searchReqType:[apex_schema_type_info=(http://xxx.xxx.com:7502/services/salesforce/service, true, false), clientId=, clientId_type_info=(clientId, http://www.w3.org/2001/XMLSchema, string, 1, 1, false), clientTransactionId=, clientTransactionId_type_info=(clientTransactionId, http://www.w3.org/2001/XMLSchema, string, 0, 1, false), field_order_type_info=(clientId, clientTransactionId, searchKey, ), =Type:[apex_schema_type_info=(http://www.xxx.com/services/salesforce/service_v1.0, true, false), field_order_type_info=(prescriber), prescriber=null, prescriber_type_info=(prescriber, http://www.xxx.com/services/salesforce/service_v1.0, prescriberType, 1, -1, false)], _type_info=(, http://xxx.xxx.com:7502/services/salesforce/service, Type, 1, 1, false), searchKey=, searchKey_type_info=(searchKey, http://www.w3.org/2001/XMLSchema, string, 1, 1, false)]::SFDC_STACK_DEPTH=1 SOAPAction="http://xxx.xxx.com:7502/services/salesforce/service" User-Agent=SFDC-Callout/25.0 Accept=text/xml Content-Type=text/xml; charset=UTF-8
14:06:52.050 (1050268000)|EXCEPTION_THROWN|[99]|System.CalloutException: Web service callout failed: Failed to get next element