$client = new soapclient('enterprise.wsdl'); print_r($client->login(sfdc_login, sfdc_password.sfdc_api_token)); $client->__setlocation(token_url);
i receive error:
fatal error: uncaught soapfault exception: [unknown_exception] unknown_exception: destination url not reset. url returned login must set in sforceservice in /library/webserver/documents/custom/index.php:18
in case doesn't provide useful information, tell me either need set destination url or catch returned url? appreciated.
note:
i don't want use salesforce php toolkit because don't want add company web server, if don't have to.
ok, after digging aynber's idea. came this...
i downloaded soapui-5.2.1 mac https://www.soapui.org.
from there combined program enterprise wsdl file salesforce. using program "pre build" soap call me. pulled out pieces needed , used curl submit soap envelope.
this allowed me convert leads using created account ids/contact ids. after converting lead, able go , modify opportunity id created pre lead conversion.
here code came with...
$soapsubmission='<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com"><soapenv:header><urn:sessionheader><urn:sessionid>'.$creds[0].'</urn:sessionid></urn:sessionheader></soapenv:header><soapenv:body><urn:convertlead>'; foreach($postinfo $orderkey=>$values){ $additionstring='<urn:leadconverts>'; if(isset($values['sfdc_ids']['account'])){ $additionstring.='<urn:accountid>'.$values['sfdc_ids']['account'].'</urn:accountid>'; } if(isset($values['sfdc_ids']['contact'])){ $additionstring.='<urn:contactid>'.$values['sfdc_ids']['contact'].'</urn:contactid>'; } $additionstring.='<urn:convertedstatus>converted</urn:convertedstatus>'; $additionstring.='<urn:donotcreateopportunity>true</urn:donotcreateopportunity>'; $additionstring.='<urn:leadid>'.$values['sfdc_ids']['lead'].'</urn:leadid>'; $additionstring.='<urn:overwriteleadsource>false</urn:overwriteleadsource>'; $additionstring.='<urn:ownerid>'.self::it_service_id.'</urn:ownerid>'; $additionstring.='<urn:sendnotificationemail>false</urn:sendnotificationemail>'; $additionstring.='</urn:leadconverts>'; $soapsubmission.=$additionstring; } $soapsubmission.='</urn:convertlead></soapenv:body></soapenv:envelope>'; $ch=curl_init($creds[1]); curl_setopt($ch,curlopt_returntransfer,1); curl_setopt($ch, curlopt_maxredirs, 10); curl_setopt($ch,curlopt_timeout, 60); curl_setopt($ch,curlopt_post,1); curl_setopt($ch,curlopt_postfields,$soapsubmission); curl_setopt($ch, curlopt_httpheader, array( "cache-control: no-cache", "content-type: text/xml; charset=utf-8", "soapaction: convertlead" )); $result=curl_exec ($ch); curl_close($ch); return $result;
Comments
Post a Comment