I have a PHP page that call a Web service and returns a complex array type. As lame as it might sound, Im strugling to pass the parameters (which are arrays too) to the service. The code works fine calling the PHP page, but I cannot make it work in ASP.NET (C#).
Here is the PHP code I have:
<?
/* TEST SCRIPT */
require_once("SOAP/client.php");
$wsdl = "http://myhost/webservices/ws_rate/index.msw?wsdl";
$soap_client = new Soap_Client($wsdl);
$soap_client->setOpt('timeout',0);
$operation = 'Rate';
$namespace = 'urn:XMLRate';
//PARAMATERS
$paramaters = set_paramaters();
//CALL
$response = $soap_client->call($operation, $paramaters, array('namespace'=>$namespace));
//RESPONSE
if( is_object($response) && array_key_exists('result',get_object_vars($response)) )
{
if($response->result && $response->result_set){ get_results($response); }
if($response->error_description){ print("<h2 style='color:red'>ERROR!</h2>".$response->error_description); }
}else{ print "<h2 style='color:red'> soap_fault </h2>"; }
function set_paramaters()
{
/**
* Input Parameters:
*
* FreightBill - TFreightBill
*
* output_attributes
* - Must be a string in the following format:
* TableName=field1,field2,field3|TableName2=field1,field2
* ex.: TLORDER=unique_id, USER3, detail_line_id, created_time, created_by, caller,FBDetails,FBUserFields,FBTraceNumbers,FBACharge,FBNotes,pick_up_by, pick_up_by_end, actual_pickup, pick_up_appt_req, pick_up_appt_made, pick_up_terminal, deliver_by, deliver_by_end, actual_delivery, delivery_appt, delivery_appt_req, delivery_appt_made, delivery_terminal, podd_signed_by, podd_signed_on, service_level, web_status, status_short_desc, status_long_desc, current_zone, current_zone_desc, start_zone, start_zone_desc, end_zone, end_zone_desc, pickup_terminal, delivery_terminal, bill_number, bill_number_key, master_order, bill_to_code, bill_to, extra_stops, declared_value, total_charges, currency_code, trailer_number, terminal_zone|TLDTL=PIECES, commodity, mmkm|TRACE=K, v, j|ZONE=terminal_zone|ACHARGE_TLORDER=ACODE_ID
* ex.: TLORDER=DETAIL_LINE_ID,CUSTOMER,CREATED_TIME
*
*/
$details[] = array(
'commodity' => '55',
'weight' => '1800',
'temperaturecontrolled' => 'False',
'pallets' => 1,
'pieces' => 0,
'length' => 0,
'width' => 0
);
$caller = array('internal_id' => 'CUST0001');
$fb = array(
'caller' => $caller,
'start_zone ' => '92805',
'end_zone' => '25005',
'service_level' => 'STANDARD',
'FBDetails' => $details
);
$input = array(
'FreightBill' => $fb,
'output_attributes' => 'TLORDER=unique_id, USER3, detail_line_id, created_time, created_by, caller,FBDetails'
);
$params = array('Input' => $input);
return $params;
}
function get_results($result)
{
print("<h2 style='color:green'>Success!</h2>");
foreach($result->result_set as $key => $value)
{
print "<br><b>".$key."</b><br>";
print_r($value);
}
}
?>
Any help really appreciated.
Luiz ///edox