나는 this wsdl에서 SoapUI에 의해 생성이 XML이 : 나는 PHP, SoapClient에 대한 클라이언트를 생성 할 때, 그것은 실패 ... 내가PHP에서 SoapClient에 항아리를 추가하려면 어떻게해야합니까?
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:safetypay:mws:api:messages">
<soapenv:Header/>
<soapenv:Body>
<urn:CommunicationTestRequest>
<urn:ApiKey>?</urn:ApiKey>
<urn:RequestDateTime>?</urn:RequestDateTime>
<urn:Signature>?</urn:Signature>
</urn:CommunicationTestRequest>
</soapenv:Body>
</soapenv:Envelope>
그것은 확인을 작동하지만를 발견하는 오류는 그것 때문에 약간 다르다. 단지 urn이 없다. (나는 그것이 무엇인지 모른다.). SoapClient에서 XML은 다음과 같다 :
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<CommunicationTestRequest>
<RequestDateTime>2012-04-17T23:21:54</RequestDateTime>
<ApiKey>XXXXX</ApiKey>
<Signature>XXXXX</Signature>
</CommunicationTestRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
세 가지 주요 diferences은 : 1) SoapClient 의해 생성 된 코드는 다음의 부족한 정의에서 : 의 xmlns : URN = "URN : safetypay : MWS를 : API : messages " 2) SoapUI에 의해 생성 된 xml에는 SOAP-ENV가 생성되는 반면 SOAP-ENV는 입니다. 3) SoapUI에는 각 자식 앞에 항아리가 있으므로 SoapClient는 없습니다.
나는 거의 하루 종일 구성을 변경하고 객체에서 배열로 뒤로 이동하며 (과거에는 다른 wsdl과 작동했기 때문에) 인터넷에서의 내 연구는 나에게 아무것도주지 않았다. .. 내 실수는 누구에게나 알 수 있습니까? 나는이 오류를 수정 할 수 있었다 :
$std = new RequestDateTime();
$std->RequestDateTime = date ('Y-m-d\TH:i:s', time());
$std->ApiKey = SafetyPaySoap::API_KEY_SAND;
$std->Signature = SafetyPaySoap::SIG_KEY_SAND;
$this->_wsdl->CommunicationTest($std);
SoapClient에 대한 구성이 하나
$config = array();
$config ['exceptions'] = true;
$config ['trace'] = true;
$config ['cache_wsdl'] = WSDL_CACHE_NONE;
$config ['soap_version'] = SOAP_1_1;
parent::SoapClient ($url . '?wsdl', $config);
편집입니다 :
요청
이있다. __doRequest 메서드를 다시 작성해야했습니다. 그리고 지금은 다음과 같습니다public function __doRequest($request, $location, $action, $version, $one_way = null) {
$request = str_ireplace("<{$this->_method}Request>", "<{$this->_method}Request xmlns='urn:safetypay:mws:api:messages'>", $request);
return parent::__doRequest ($request, $location, $action, $version, $one_way);
}
을 그럼, 내가 뭘하면 요청에 네임 스페이스를 추가하고, 그와 함께이 XML을 생성
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<CommunicationTestRequest xmlns='urn:safetypay:mws:api:messages'>
<ApiKey>XXXX</ApiKey>
<RequestDateTime>2012-04-18T20:22:51</RequestDateTime>
<Signature>XXXXX</Signature>
</CommunicationTestRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
사실 나는 이미 그것을 증명했지만 변경되지 않았습니다 ... – Cito