api - How to create this XML with PHP SoapClient? -
i've been trying few days try , create xml via php soap client, no avail.
i checked many topics here on stackoverflow nothing quite worked yet. response sent empty request.
below request structure should like:
<?xml version="1.0" encoding="utf-8"?> <soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.datacontract.org/2004/07/cm.entities.services" xmlns:ns2="http://tempuri.org/"> <soap-env:body> <ns2:createlead> <ns2:contact> <ns1:address>?</ns1:address> <ns1:aditionalcontactdata> <ns1:adgroup>?</ns1:adgroup> <ns1:adid>?</ns1:adid> <ns1:carrier>?</ns1:carrier> <ns1:category>?</ns1:category> <ns1:city>?</ns1:city> <ns1:clickid>?</ns1:clickid> <ns1:device>?</ns1:device> <ns1:device_model>?</ns1:device_model> <ns1:isp>?</ns1:isp> <ns1:keyword>?</ns1:keyword> <ns1:lp>?</ns1:lp> <ns1:landerid>?</ns1:landerid> <ns1:match>?</ns1:match> <ns1:os>?</ns1:os> <ns1:offerid>?</ns1:offerid> <ns1:placement>?</ns1:placement> <ns1:reff_domain>?</ns1:reff_domain> <ns1:reff_url>?</ns1:reff_url> <ns1:titleid>?</ns1:titleid> <ns1:trafficsourceid>?</ns1:trafficsourceid> <ns1:trafficsourcename>?</ns1:trafficsourcename> <ns1:useragent>?</ns1:useragent> <ns1:var1>?</ns1:var1> <ns1:var10>?</ns1:var10> <ns1:var2>?</ns1:var2> <ns1:var3>?</ns1:var3> <ns1:var4>?</ns1:var4> <ns1:var5>?</ns1:var5> <ns1:var6>?</ns1:var6> <ns1:var7>?</ns1:var7> <ns1:var8>?</ns1:var8> <ns1:var9>?</ns1:var9> <ns1:zoneid>?</ns1:zoneid> <ns1:adposition>?</ns1:adposition> <ns1:trkcid>?</ns1:trkcid> </ns1:aditionalcontactdata> <ns1:affiliateid>?</ns1:affiliateid> <ns1:cxd>?</ns1:cxd> <ns1:campaignid>?</ns1:campaignid> <ns1:country>?</ns1:country> <ns1:email>?</ns1:email> <ns1:firstname>?</ns1:firstname> <ns1:ip>?</ns1:ip> <ns1:landingpageurl>?</ns1:landingpageurl> <ns1:language>?</ns1:language> <ns1:lastname>?</ns1:lastname> <ns1:phonenumber>?</ns1:phonenumber> <ns1:phonenumber2>?</ns1:phonenumber2> <ns1:referrerurl>?</ns1:referrerurl> <ns1:subaffiliate>?</ns1:subaffiliate> <ns1:verifiedemail>true</ns1:verifiedemail> <ns1:verifiedphone>true</ns1:verifiedphone> <ns1:zipcode>?</ns1:zipcode> </ns2:contact> </ns2:createlead> </soap-env:body> </soap-env:envelope>
my last attempt looks like:
$url = 'http://82.81.92.210:4050/websiteinterface.svc?singlewsdl'; $client = new soapclient($url); $xmlr = new simplexmlelement("<createlead></createlead>"); $xmlr->addchild('campaignid', 'test'); $xmlr->addchild('country', 'usa'); $xmlr->addchild('email', 'test@test.com'); $xmlr->addchild('firstname', 'test'); $xmlr->addchild('lastname', 'test'); $xmlr->addchild('phonenumber', '11226489'); $params = new stdclass(); $params->xml = $xmlr->asxml(); $result = $client->createlead($params); print_r($result);
the response sends back:
stdclass object ( [createleadresult] => stdclass object ( [code] => 20 [message] => contact request empty [success] => [contactid] => 00000000-0000-0000-0000-000000000000 ) )
Comments
Post a Comment