• Mahsa K
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies

The problem is that a send email button on one of our VF pages works perfectely well for some users while some other users get this error:

Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found 'http://www.w3.org/1999/xhtml:html'
Error is in expression '{!checkSend}' in component <apex:page> in page emailconfirmation

The code that the error is refering too is:

System.debug('SendPDFByEmail - accId = ' + accId + ' contactEmail = ' + contactEmail + ' attach.Id = ' + attach.Id + ' subject = ' + subject + ' usr.email = ' + usr.email + ' companyName = ' + companyName+ + ' IsTest? = ' + test.isRunningTest());
            if(!(test.isRunningTest()))
            CalcSoapWrapper.SendPDFByEmail(accId,contactEmail,attach.Id,subject,body,usr.email,companyName,'00X7000000185oO');
          
            String retUrl = ApexPages.currentPage().getParameters().get('retUrl');
            if(retUrl != null && retUrl != '') {
                PageReference pageRef = new PageReference(retUrl);
                pageRef.setRedirect(true);
                return pageRef;
            } else {
           
              string additionalParameter = '';
              if(!string.isEmpty(ApexPages.currentPage().getParameters().get('range'))){
                additionalParameter = '&range='+ApexPages.currentPage().getParameters().get('range');
              }
              if(!string.isEmpty(ApexPages.currentPage().getParameters().get('start'))){
                additionalParameter += '&start='+ApexPages.currentPage().getParameters().get('start');
              }
              if(!string.isEmpty(ApexPages.currentPage().getParameters().get('end'))){
                additionalParameter += '&end='+ApexPages.currentPage().getParameters().get('end');
              }
                PageReference pageRef = new PageReference('/apex/CP_ManageMyAccount?id=' +accId +'&accid=' +accId +'&printmode=pdf'+mode+additionalParameter);
                pageRef.setRedirect(true);
                return pageRef;
            }

I tried changing those users profiles to the ones that are working but I still get the same error. Those users have access to the email templates used in the code. Does anyone know what could solve this issue? Any help would be appreciated.

The problem is that a send email button on one of our VF pages works perfectely well for some users while some other users get this error:

Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found 'http://www.w3.org/1999/xhtml:html'
Error is in expression '{!checkSend}' in component <apex:page> in page emailconfirmation

The code that the error is refering too is:

System.debug('SendPDFByEmail - accId = ' + accId + ' contactEmail = ' + contactEmail + ' attach.Id = ' + attach.Id + ' subject = ' + subject + ' usr.email = ' + usr.email + ' companyName = ' + companyName+ + ' IsTest? = ' + test.isRunningTest());
            if(!(test.isRunningTest()))
            CalcSoapWrapper.SendPDFByEmail(accId,contactEmail,attach.Id,subject,body,usr.email,companyName,'00X7000000185oO');
          
            String retUrl = ApexPages.currentPage().getParameters().get('retUrl');
            if(retUrl != null && retUrl != '') {
                PageReference pageRef = new PageReference(retUrl);
                pageRef.setRedirect(true);
                return pageRef;
            } else {
           
              string additionalParameter = '';
              if(!string.isEmpty(ApexPages.currentPage().getParameters().get('range'))){
                additionalParameter = '&range='+ApexPages.currentPage().getParameters().get('range');
              }
              if(!string.isEmpty(ApexPages.currentPage().getParameters().get('start'))){
                additionalParameter += '&start='+ApexPages.currentPage().getParameters().get('start');
              }
              if(!string.isEmpty(ApexPages.currentPage().getParameters().get('end'))){
                additionalParameter += '&end='+ApexPages.currentPage().getParameters().get('end');
              }
                PageReference pageRef = new PageReference('/apex/CP_ManageMyAccount?id=' +accId +'&accid=' +accId +'&printmode=pdf'+mode+additionalParameter);
                pageRef.setRedirect(true);
                return pageRef;
            }

I tried changing those users profiles to the ones that are working but I still get the same error. Those users have access to the email templates used in the code. Does anyone know what could solve this issue? Any help would be appreciated.
I have a visual force page that gets data from a webservice through Apex callout. I want to display that in  the Account page in a section.
The page works fine if I access the page independently, it shows the below error if I embed the visualforce page in the Account Page Layout.

Content cannot be displayed: Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found 'http://www.w3.org/1999/xhtml:html'

Anybody else faced this issue? What could be the fix?

  • April 23, 2014
  • Like
  • 0