• Elson da Costa Silva
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
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!

 

Hi,

 

In our instance we have a couple of classes generated by wsdl2apex that "randomly" (I cannot see a pattern) throws a System.CalloutException with the message "Failed to get next element". I have googled a bit but couldn't find anything that I could think was related. The web services called logs all attempts but when I get this exception I can't see that the web services has been accessed at all. The web services are all build with .NET 3. 

 

I don't know what the best way to start troubleshoot this is. So I thought I should give the boards a try!

 

Any suggestions or ideas are welcome!

 

Thanks!

 

Martin

 

 

  • April 07, 2011
  • Like
  • 0