WSDL
파일을 다운로드 할 때 PHP가 스트림 컨텍스트를 무시합니다. 해결 방법은 WSDL
파일을 다운로드하고, 로컬 파일 시스템에 대한 모든 스키마 수입 (나는 꽤 XML 인쇄하려면 여기를 tidy
을 사용하고 있습니다) :
wget --secure-protocol=SSLv3 https://winsystemsintl.com:54904/PSAService.svc?wsdl --no-check-certificate -O - | tidy -xml -indent > PSAService.svc?wsdl
wget --secure-protocol=SSLv3 https://winsystemsintl.com:54904/PSAService.svc?xsd=xsd0 --no-check-certificate -O - | tidy -xml -indent > PSAService.svc?xsd=xsd0
wget --secure-protocol=SSLv3 https://winsystemsintl.com:54904/PSAService.svc?xsd=xsd1 --no-check-certificate -O - | tidy -xml -indent > PSAService.svc?xsd=xsd1
wget --secure-protocol=SSLv3 https://winsystemsintl.com:54904/PSAService.svc?xsd=xsd2 --no-check-certificate -O - | tidy -xml -indent > PSAService.svc?xsd=xsd2
wget --secure-protocol=SSLv3 https://winsystemsintl.com:54904/PSAService.svc?xsd=xsd3 --no-check-certificate -O - | tidy -xml -indent > PSAService.svc?xsd=xsd3
다음, 당신은 PSAService.svc?wsdl
을 편집 할 수 있습니다 (파일 이름 해당 wget이 저장 됨) 가져 오기가 웹 대신 로컬 시스템을 가리 키도록 변경하십시오. 좋아하는 편집기에서 교체-모든 기능을 사용하여 대체 'https://winsystemsintl.com:54904/'
''
과 :
예 전 :
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="https://winsystemsintl.com:54904/PSAService.svc?xsd=xsd0"
namespace="http://tempuri.org/" />
<xsd:import schemaLocation="https://winsystemsintl.com:54904/PSAService.svc?xsd=xsd1"
namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
<xsd:import schemaLocation="https://winsystemsintl.com:54904/PSAService.svc?xsd=xsd2"
namespace="http://schemas.datacontract.org/2004/07/PSA.Service.MessageObjects.Pregunta" />
<xsd:import schemaLocation="https://winsystemsintl.com:54904/PSAService.svc?xsd=xsd3"
namespace="http://schemas.datacontract.org/2004/07/PSA.Service.MessageObjects.Respuesta" />
</xsd:schema>
</wsdl:types>
후 :
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="PSAService.svc?xsd=xsd0"
namespace="http://tempuri.org/" />
<xsd:import schemaLocation="PSAService.svc?xsd=xsd1"
namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
<xsd:import schemaLocation="PSAService.svc?xsd=xsd2"
namespace="http://schemas.datacontract.org/2004/07/PSA.Service.MessageObjects.Pregunta" />
<xsd:import schemaLocation="PSAService.svc?xsd=xsd3"
namespace="http://schemas.datacontract.org/2004/07/PSA.Service.MessageObjects.Respuesta" />
</xsd:schema>
</wsdl:types>
반복에 대한 각 파일은 다운로드되었습니다.
다음으로, (나는 모든 PHP/WSDL 파일이 같은 폴더에 있다고 가정한다) 다음에 코드를 변경 : 이제 SoapClient
웹에서 WSDL
다운로드를 건너 뛴
$opts = [
'ssl' => [
// set some SSL/TLS specific options
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
],
'http'=>[
'user_agent' => 'PHPSoapClient'
]
];
// Initialize Soap Client
$client = new SoapClient('PSAService.svc?wsdl', array('ssl_method' => SOAP_SSL_METHOD_SSLv3,'soap_version' => SOAP_1_2, 'location' => 'https://winsystemsintl.com:54904/PSAService.svc','stream_context' => stream_context_create($opts), 'exceptions' => true, 'trace' => true));
var_dump($client->__getFunctions());
하고 스트림 컨텍스트를 사용하여 전화를 걸 준비가되었습니다.
MITM 공격에 자신을 노출 할 준비가되었습니다. :/ – miken32
그렇습니다. 프로덕션 환경에서는이 작업을하지 않겠지 만 개발자가 자체 서명 된 인증서를 사용해야하는 경우 테스트 목적으로 유용합니다. –
아빠, 내 마지막 댓글을 편집 할 수 없습니다. 완료된 댓글입니다. 안녕하세요. 답변을 보내 주셔서 감사합니다.하지만 이제 오류 메시지 '호스트에 연결할 수 없습니다'가 표시됩니다. 나는 그것이 webservice 인증서에 문제가 될 수 있다고 생각한다. 그래서 나는 그들과 이야기를 나눴다. 그리고 그것들은 프로덕션 webservice에 대한 테스트 자격 증명을 제공 할 것이다. 그렇다. 나는 문제없이 프로덕션 웹 서비스에 연결할 수있다. 다시 한번 고마워. . – Nerea