2014-07-19 2 views
0

SOAP을 알아 내려고했지만 성공하지 못했습니다. (PHP (컬) SOAP 요청을 어떻게 만들 수 있습니까?PHP에서 CURL로 SOAP 요청하기

또한
POST /WebServices/domain.asmx HTTP/1.1 
Host: webservices.domain.ru 
Content-Type: text/xml; charset=utf-8 
Content-Length: length 
SOAPAction: "http://www.domain.ru/GetVariants" 


<?xml version="1.0" encoding="utf-8"?> 
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
       xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soap:Header> 
    <AuthentificationHeader xmlns="http://www.domain.ru/"> 
     <Login>string</Login> 
     <Password>string</Password> 
     <PartnerId>string</PartnerId> 
    </AuthentificationHeader> 
    </soap:Header> 
    <soap:Body> 
    <GetVariants xmlns="http://www.domain.ru/"> 
     <RequestParameters>xml</RequestParameters> 
    </GetVariants> 
    </soap:Body> 
</soap:Envelope> 

나는 다음 한 데이터 : 기본적으로

WSDL: 
http://webservices.domain.ru/WebServices/domainXml.asmx?WSDL 
Soap action: 
http://webservices.domain.ru/WebServices/domainXml.asmx?op=GetVariants 
+1

링크가'404 not found'를 반환했습니다 – alkis

+0

샘플 링크를 만들었습니다 –

답변

0

:

  1. SOAP에 대한 PHP의 지원 그냥 짜증
  2. .
  3. PHP 클래스를 생성하기 위해 WSDL을 사용해야하므로 Request 객체를 빌드 할 수 있습니다. 거기에 PHP 스크립트에 약간의 WSDL있다

    class SomeClass 
    { 
        var $name; //NCName 
    } 
    class SomeOtherClass 
    { 
        var $value; //anonymous2 
    } 
    . 
    . 
    . 
    

    :

이 뭔가를 얻을 것이다. (구글 wsdl PHP로)

그럼 당신이 뭔가를 할.

$soapClient = new SoapClient($this->_wsdlUrl, array(
       'trace' => true, 
       'exceptions' => true, 
       'uri' => $this->_endPoint, 
       'location' => $this->_endPoint, 
       'local_cert' => $this->certificatePath, 
       'allow_self_signed' => true, 
       'soap_version' => SOAP_1_2, 
      )); 
// Build the SOAP client object, with your properties. 

//After that, you have to call: 
$yourContainerObject = new YourContainerObject(); // The top SOAP XML node 
$yourContainerObject->SomeChildNode = new SomeChildNode(); 
$yourContainerObject->SomeChildNode->Name = 'John'; 
. 
. 
. 

$soapResponse = $soapClient->GetVariants($yourContainerObject); 
print_r(soapResponse); // to see what you get 

은 "GetVariants"방법이 구현 될 필요가 없다, 그래서 당신이 혼란스러워 내가 from.It이 WSLD에 설명되어 있음을 얻는 경우 자신에게 물어 및 PHP의 SOAP 클라이언트는 것을 알고하지 않습니다 그냥 SOAP 동작.

이것은 PHP를 통해 SOAP 요청을 작성하는보다 고급 예제 여야합니다. 이 기본 흐름을 얻길 바랍니다.

+0

불행히도 저는 이미 다른 wsdl 소스와 함께 구현 된 컬 멀티가 있기 때문에 불행히도 별도의 클래스로 만들 수 없습니다.). 어떤 컬 솔루션? –

관련 문제