1
Webservice를 내가 전화 했어 반환 <detail>
요소에 포함 된 XML을 SOAPFault의 세부 하위 요소에 속성을 전달하지 SOAPFault에 - 이것은 SoapUI의 모습입니다 :PHP는
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>some error msg</faultstring>
<detail>
<e:exchange-error xmlns:e="http://mycompany.com/faults">
<e:message-data id="00001" type="005"/>
<e:result-data date="2017-02-13 15:44:33" code="1401" ref="2457798154426512"/>
</e:exchange-error>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>`
PHP 구현이 속성을 통과하지 못할 것 같다
try {
$resp = $this->_soap->__soapCall("myMethod", ['param-data' => $req->get()]);
var_dump($response);
} catch (\SoapFault $e) {
if (empty($e->detail->{'exchange-error'}->{'result-data'})) {
echo "it's empty :(\n";
var_dump($e->detail->{'exchange-error'});
}
}
$ php -f foobar.php
it's empty :(
object(stdClass)#7 (4) {
["message-data"]=>
string(0) ""
["result-data"]=>
string(0) ""
}
속성 값 exchange-error
개체를 얻을 수있는 방법이 있나요 : XML 노드의, 그냥 (이 경우, 비어있는) 값을 반환? 아니면 XML/문자열을 detail
에서 가져 와서 파싱 하시겠습니까? 오류 메시지는 WSDL에 정의되어 있으므로 구조가 클라이언트 측에 알려 져야합니다.
불행히도 나는 응답으로 서버가 생략하는 것을 제어 할 수 없다. 단지 장애 처리의 특별한 경우를 구현하기 위해 결과 데이터 속성 중 하나의 값을 식별 할 필요가있다. – bezetde