 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
dfowler81
Joined: 27 Oct 2008 Posts: 2
|
Posted: Mon Oct 27, 2008 9:19 pm Post subject: SOAP attributes |
|
|
Hey guys,
I've been looking for help with pear::soap for the last couple of days, but haven't been able to find any answers. My current problem is that a response I am getting is using attributes. For example:
| Code: | | <account id="123523" name="Bob" /> |
Instead of the typical:
| Code: | <account>
<id>1234523</id>
<name>Bob</name>
</account> |
I can't figure out how to read these attributes that I need. When I get the response I try using print_r($response); but am only getting the following:
| Code: | stdClass Object
(
[Result] =>
[Account] => stdClass Object
(
)
) |
Does anybody have an idea how to read these attributes? Or at least get the raw xml that is sent back? Thanks for any help. |
|
| Back to top |
|
 |
dfowler81
Joined: 27 Oct 2008 Posts: 2
|
Posted: Tue Oct 28, 2008 4:47 pm Post subject: |
|
|
I thought I would post my entire code so people can see what I am doing.
| Code: | <?php
require_once "SOAP/Client.php";
include "connect.php";
include "country_conv.php";
$countryUpper = strtoupper($_POST['billTo_country']);
$wsdl_url = $url;
$WSDL = new SOAP_WSDL($wsdl_url);
$client = $WSDL->getProxy();
$params = array(
'WebId' => $webID,
'Password' => $webPW,
'EmployeeLogin' => $empLogin,
'EmployeePassword' => $empPW,
);
$response = $client->SecurityValidateEmployeeLogon($params);
if (PEAR::isError($response)) {
echo "<br>An error #" . $response->getCode() . " occurred!<br>";
echo " Error: " . $response->getMessage() . "<br>\n";
exit();
} else {
$empToken = $response->Token;
$firstName = $_POST['billTo_firstName'];
$lastName = $_POST['billTo_lastName'];
$randNum = rand(0,9) . rand(0,9) . rand(0,9) . rand(0,9) . rand(0,9);
$compName = $firstName." ".$lastName." (".$randNum.")";
$header = new SOAP_Header('{'. Conferencing . '}HeaderToken', NULL, array('Token' => $empToken), 0);
$params = array(
'Company' => array(
'Name' => $compName,
'Address' => array(
'Address1' => $_POST['billTo_street1'],
'Address2' => $_POST['billTo_street2'],
'City' => $_POST['billTo_city'],
'State' => $_POST['billTo_state'],
'Zip' => $_POST['billTo_postalCode'],
'Country' => $country[$countryUpper]
),
'BlastEmailAllowed' => 'false',
'Enterprise' => $enterprise,
'Provider' => $provider
)
);
$client->addHeader($header);
$response = $client->ProvisioningCompanyCreate($params);
if (PEAR::isError($response)) {
echo "<br>An error #" . $response->getCode() . " occurred!<br>";
echo " Error: " . $response->getMessage() . "<br>\n";
exit();
} else {
$compID = $response->CompanyId;
$header = new SOAP_Header('{'. Conferencing . '}HeaderToken', NULL, array('Token' => $empToken), 0);
$account_info = array(
'CompanyID' => $compID,
'TimeZone' => 'ESTRN-BASE',
'ViewCompanyWebReport' => 'true'
);
$contact_info = array(
'FirstName' => $firstName,
'LastName' => $lastName,
'Company' => $_POST['billTo_company'],
'Phone' => $_POST['billTo_phoneNumber'],
'Email' => $_POST['billTo_email'],
'Address1' => $_POST['billTo_street1'],
'Address2' => $_POST['billTo_street2'],
'City' => $_POST['billTo_city'],
'State' => $_POST['billTo_state'],
'Zip' => $_POST['billTo_postalCode'],
'Country' => $country[$countryUpper]
);
$contact_value = new SOAP_VALUE('{'. Conferencing . '}ContactInfo', false, NULL, $contact_info);
$account_value = new SOAP_VALUE('{'. Conferencing . '}Account', false, $contact_value, $account_info);
$params = array(
$account_value
);
$client->addHeader($header);
$response = $client->CreateAccount($params);
print_r($response);
}
}
?> |
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|