i am unable to to use google adwords api in aware IM using custom process. with the same crendials and code related to google api, i am able to run get data from google out fo aware IM but when i am runnig in awrae im getting exception related the crendials.
here is my code
public Object execute (IExecutionEngine engine, Object[] parameters)
throws SuspendProcessException, ExecutionException, AccessDeniedException {
try {
if (parameters == null parameters.length != 1 !(parameters [0] instanceof IEntity)){
return null;
}
// get the parameter
IEntity entity = (IEntity) parameters [0];
System.out.println("Entity " +entity.getName());
ObjectReference[] objectReference =new ObjectReference[1];
objectReference[0]= new ObjectReference(entity.getName(), entity.getId());
//google account credentials
AdWordsUser user=new AdWordsUser(EMAIL, PASSWORD, USER_AGENT, DEVELOPER_TOKEN, APPLICATION_TOKEN, ADWORDS_API_VERSION, null);
CampaignInterface cs= (CampaignInterface) user.getService(user.CAMPAIGN_SERVICE);
Campaign[] campaigns= cs.getAllAdWordsCampaigns(1);
for(int i=0;i<campaigns.length; i++){
System.out.println(campaigns[i].getId()+ " "+ campaigns[i].getName() );
IDomainVersion iDomainVersion = (engine.getExecutionContext(this)).getDomainVersion();
IEntityDefinition iEntityDefinition =iDomainVersion.getEntityDefinition("AdwordsCampaign");
IEntityTemplate iEntityTemplate = DomainFactory.createEntityTemplate(iEntityDefinition);
System.out.println("object creted");
iEntityTemplate.setReferences(entity.getName(), objectReference);
iEntityTemplate.setAttributeValue("Name",campaigns[i].getName());
iEntityTemplate.setAttributeValue("AdwordsId",new Integer(campaigns[i].getId()));
engine.createEntityFromTemplate(this,iEntityTemplate,null);
System.out.println("saved");
}
}catch (Exception e){
e.printStackTrace();
}
return null;
}
plz provide ur precious help regarding solving this problem.
exception are cooming like this
javax.xml.rpc.ServiceException
at com.google.api.adwords.lib.BaseCredentials.getService(BaseCredentials.java:177)
at google.processes.CampaignServiceProcess.execute(CampaignServiceProcess.java:60)
at com.bas.basserver.executionengine.ExecutionEngine.a(Unknown Source)
at com.bas.basserver.executionengine.ExecutionEngine.a(Unknown Source)
at com.bas.basserver.executionengine.ExecutionEngine.a(Unknown Source)
at com.bas.basserver.executionengine.ExecutionEngine.executeProcess(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)