이 문제를 디버그하는 데 많은 시간을 보냈습니다. 나는 아이디어가 부족하다. 다음 간단한 PHP 코드가 있습니다.웹 서비스에서 오류가 반환되었습니다.
$url = "https://webservices.test.optimalpayments.com/creditcardWS/CreditCardServlet/v1";
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,"&txnMode=".$txnMode."&txnRequest=".urlencode($ch));
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$result = curl_exec($ch);
불행히도 나는 이것을 실행하려고 할 때마다 XML 요청에 계속 문제가 발생합니다. 다음은 요청입니다.
$txnRequest = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
$txnRequest .= "<ccAuthRequestV1 xmlns=\"http://www.optimalpayments.com/creditcard/xmlschema/v1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.optimalpayments.com/creditcard/xmlschema/v1\">\n";
$txnRequest .= "<merchantAccount>\n";
$txnRequest .= "<accountNum>".$account."</accountNum>\n";
$txnRequest .= "<storeID>".$merchantId."</storeID>\n";
$txnRequest .= "<storePwd>".$merchantPwd."</storePwd>\n";
$txnRequest .= "</merchantAccount>\n";
$txnRequest .= "<merchantRefNum>".$merchantRefNum."</merchantRefNum>\n";
$txnRequest .= "<amount>".$amount."</amount>\n";
$txnRequest .= "<card>\n";
$txnRequest .= "<cardNum>".$cardNum."</cardNum>\n";
$txnRequest .= "<cardExpiry>\n<month>".$eMonth."</month>\n<year>".$eYear."</year>\n</cardExpiry>\n";
$txnRequest .= "<cardType>".$cardType."</cardType>\n";
$txnRequest .= "<cvdIndicator>".$cvdIndicator."</cvdIndicator>\n";
$txnRequest .= "<cvd>".$cvd."</cvd>\n";
$txnRequest .= "</card>\n";
$txnRequest .= "<billingDetails>\n";
$txnRequest .= "<cardPayMethod>WEB</cardPayMethod>\n";
$txnRequest .= "<firstName>".$firstName."</firstName>\n";
$txnRequest .= "<lastName>".$lastName."</lastName>\n";
$txnRequest .= "<street>".$bStreet."</street>\n";
$txnRequest .= "<city>".$bCity."</city>\n";
$txnRequest .= "<state>".$bState."</state>\n";
$txnRequest .= "<country>".$bCountry."</country>\n";
$txnRequest .= "<zip>".$bZip."</zip>\n";
$txnRequest .= "<phone>".$bPhone."</phone>\n";
$txnRequest .= "<email>".$bEmail."</email>\n";
$txnRequest .= "</billingDetails>\n";
$txnRequest .= "</ccAuthRequestV1>";
아무도 제대로 인코딩되지 않은 것에 대한 통찰력을 제공 할 수 있습니까?
'$ txnRequest'를 에코하여 최종 데이터를 검사하십시오. 나는 당신이 그것을 게시하기 전에 XML을 인코딩해야 할 수도 있습니다 같아요. – aynber
'.urlencode ($ ch)'거기서 무슨 일이 일어 났습니까? – Steve