簡體   English   中英

在SOAP WSDL上獲取500內部服務器錯誤調用PHP

[英]Getting 500 Internal Server Error on SOAP WSDL call PHP

我是PHP的新手,我有一些我需要發送數據的API。 我使用下面的代碼來做到這一點。

<?php  
// define variables and set to empty values
$name = $email = $city = $State_Province = $lastname = $ci_Address  ="" ;
$zipcode = $country = $phNumber = $ReasonforInquiry = $Scheduledate= $Comment = "" ;
$name = $_GET['firstname'];
$lastname=$_GET['lastname'];
$email=$_GET['email'];
$ci_Address=$_GET['StreetAddress']+$_GET['AddressLine2'];
$city=$_GET['city'];
$State_Province =$_GET['state'];
$zipcode = $_GET['zip'];
$country=$_GET['country'];
$phNumber=$_GET['ph1']+ "-"+$_GET['ph2']+ "-"+$_GET['ph3'];
$ReasonforInquiry=$_GET['ReasonforInquiry'];
$Scheduledate=$_GET['SD1']+ "-"+$_GET['SD2']+ "-"+$_GET['SD3'];
$Comment=$_GET['Comment'];
/// Create the standard SoapClient by pointing to the service's WSDL file/URL
$client = new SoapClient('https://test.com/test/external/v001/Patients/Patient.svc?wsdl');
/// ********************************************************
/// BEGIN: Sending and Receiving Objects
/// ********************************************************
/// The following displays how to call the service
/// First, create an object that matches the input object type expected.
class Patient
{
public $APIKey = '';
public $FirstName = '';
public $LastName = '';
public $MiddleName = '';
public $PhoneCC = '';
public $PhoneExt = '';
public $PhoneNumber = '';
public $EmailAddress = '';
public $MobileNumber = '';
public $Gender = '';
public $Age = '';
public $ResidingCountry = '';
public $Comments = '';
public $CI_Address = '';
public $CI_State_Province = '';
public $CI_City = '';
public $CI_Zip = '';
public $PTBNICOE_Name = '';
public $PTBNICOE_Address = '';
public $PTBNICOE_PhoneNumber = '';
public $PTBNICOE_Relationship_with_the_patient = '';
public $How_urgent_is_your_need = '';
public $Details_of_the_doctor_who_will_help_you_obtain_treatment_overseas = '';
public $Is_your_treatment_procedure_covered_by_insurance = '';
public $Do_you_have_a_Passport = '';
public $Have_you_ever_travelled_abroad = '';
public $Preferred_destination = '';
public $Preferred_destination_Yes_describe = '';
public $Desired_time_of_travel = '';
public $Number_of_people_accompanying_you = '';
public $Details_of_the_people_accompanying_you = '';
public $How_do_you_intend_to_pay_for_your_treatment = '';
public $Why_are_you_considering_treatment_abroad = '';
public $How_did_you_hear_about_us = '';
}
///Instantiate the parameter object to pass to the service.
$patient = new Patient();
///Set the values on the new object instance.
$patient->APIKey = '*******';
$patient->FirstName =  $name;
$patient->LastName  =  $lastname;
$patient->FirstName =  $email;
$patient->LastName  =  $ci_Address;
$patient->FirstName =  $city;
$patient->LastName  =  $State_Province;
$patient->FirstName =  $zipcode;
$patient->LastName  =  $country;
$patient->FirstName =  $phNumber;
$patient->LastName  =  $ReasonforInquiry;
$patient->Comments = $Comment;
//.//.//.
//$patient->How_did_you_hear_about_us = 'hear ';
/// Now, we create a variable array, named the same as the web method's parameter name.
/// This creates the proper parameter input for the web method call.
$patientParam = array('patientDC'=>$patient);
/// Call the web service and pass it the param array created above.
$PatientSaveResult = $client->Save($patientParam);
/// Get the result of the call.
$result = $PatientSaveResult->SaveResult;
/// Testing
if($result->IsSuccess)
echo('true');
else
echo($result->Error);
/// ********************************************************
/// END: Sending and Receiving Objects
/// 
?>

上面的代碼在我的本地系統上工作正常,但當我將我的更改移動到臨時服務器時。 它停止工作。 我調試了代碼,發現由於下面的代碼行導致500內部錯誤:

$client = new SoapClient('https://test.com/test/external/v001/Patients/Patient.svc?wsdl');

我沒有得到,如何解決它。 它是服務器問題還是我可以通過代碼修復它。 請幫我。 請指導我如何解決這個問題。

確認URL https://test.com/test/external/v001/Patients/Patient.svc?wsdl指向有效的WSDL。 可能是您的本地開發站將此請求路由到您的Staging服務器沒有的有效WSDL。 例如,您的本地主機文件或DNS條目可能會將test.com請求路由到為開發目的而裝配的本地服務器。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM