• gbutt
  • NEWBIE
  • 0 Points
  • Member since 2012

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

Hi Everyone,

 

I created a VF form which will i save  field in my custom object   I'm using this page in the site here while i'm clicking the Save! button it is showing me the Authorization required page.I checked all the permissions to object ,fields,Apex class, VF all are correct.Here is my code

 

Controler :

 

public class CreateNewCandidateToVerify{
private final ApexPages.standardController controller;
private final Candidate_to_Verify__c obj;
public Attachment attachment {get; set;}

public CreateNewCandidateToVerify(ApexPages.StandardController stdController) {
this.controller = stdController;
this.obj = (Candidate_to_Verify__c)stdController.getRecord();
attachment = new Attachment();
}

public PageReference zapis(){
String val = ApexPages.currentPage().getParameters().get('recruitment');
Recruitment__c rec = [
SELECT id
FROM Recruitment__c
WHERE id = :val
LIMIT 1];
obj.Recruitment__c = rec.id;
insert obj;
Candidate_to_Verify__c added = [
SELECT id
FROM Candidate_to_Verify__c
WHERE Name__c = :obj.Name__c
AND Surname__c = :obj.Surname__c
AND Phone__c = :obj.Phone__c
AND E_mail__c = :obj.E_mail__c
LIMIT 1];
attachment.ParentId = added.id;
try{
insert attachment;
}
catch (DMLException e) {
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading attachment. You can send your CV by e-mail: e-mail adress'));
return null;
}
//obj = new Candidate_to_Verify__c();
//attachment = new Attachment();
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'Thanks for Application'));
return null;
}

}

 

VF Page 

 

<apex:page standardStylesheets="false" showHeader="false" sidebar="false" standardController="Candidate_to_verify__c" extensions="CreateNewCandidateToVerify">

 

<h1>Welcome in HR App</h1>
</center>
<h2></h2>
<br></br>
<apex:form >
<center>
<apex:pageBlock id="tst2">
<apex:pageMessages />
<apex:pageBlockSection columns="1">

<h3>Personal Data</h3>

<apex:inputField value="{!Candidate_to_verify__c.Name__c}"/>
<apex:inputField value="{!Candidate_to_verify__c.Surname__c}"/>
<h3>Contact Data</h3>
<apex:inputField value="{!Candidate_to_verify__c.Phone__c}"/>
<apex:inputField value="{!Candidate_to_verify__c.E_mail__c}"/>


</apex:pageBlockSection>
<h1>Attach your CV</h1>
<apex:pageBlockSection showHeader="false" columns="2" id="block1">
<apex:pageBlockSectionItem >
<apex:outputLabel value="File Name" for="fileName"/>
<apex:inputText value="{!attachment.name}" id="fileName"/>
</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem >
<apex:outputLabel value="File" for="file"/>
<apex:inputFile value="{!attachment.body}" filename="{!attachment.name}" id="file"/>
</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem >
<apex:outputLabel value="Description" for="description"/>
<apex:inputTextarea value="{!attachment.description}" id="description"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>

<apex:pageBlockSection >
<apex:commandButton action="{!zapis}" value="Save!">
<apex:param value="{!$CurrentPage.parameters.recruitment}" assignTo="{!Candidate_to_Verify__c.Recruitment__c}"/>
</apex:commandButton>
<apex:commandButton action="{!cancel}" value="Cancel!"/>

</apex:pageBlockSection>

</apex:pageBlock>
</center>
</apex:form>
</apex:page>

 

  • April 04, 2013
  • Like
  • 0

hey guys,

 

i have the following problem:

 

 

private Soap salesforceClient;
	private SessionHeader sh;
	private HashSet<Login> loginSet;


	public void init() {
		try {
			if(salesforceClient == null){
			SforceService ss = new SforceService(new URL("link/to/enterprise.wsdl"), new QName("urn:enterprise.soap.sforce.com", "SforceService"));
			salesforceClient = ss.getSoap();
	        LoginResult loginResult = salesforceClient.login("LOGIN", "PASSWORD+TOKEN");
	        ((BindingProvider) salesforceClient).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, loginResult.getServerUrl());
			//ss.addPort(portName, loginResult.getSessionId(), loginResult.getMetadataServerUrl())
			
	        //Create a new session header object and set the session id to that returned by the login
	        sh = new SessionHeader();
	        sh.setSessionId(loginResult.getSessionId());
	        
	        
	        }	
			
		} catch (InvalidIdFault_Exception e) {
			logger.debug(e.toString());
		} catch (LoginFault_Exception e) {
			logger.debug(e.toString());
		} catch (UnexpectedErrorFault_Exception e) {
			logger.debug(e.toString());
		} catch (MalformedURLException e) {
			logger.debug(e.toString());
			e.printStackTrace();
		}
	}

 

 

I get the   UnexpectedErrorFault_Exception INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session