Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/241.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP中给定请求和响应结构的SOAP响应_Php_Soap - Fatal编程技术网

PHP中给定请求和响应结构的SOAP响应

PHP中给定请求和响应结构的SOAP响应,php,soap,Php,Soap,因为我对SOAP还很陌生,所以我真的需要一些帮助来开始。我被赋予这样的结构: 请求: POST /NumbriParing/NumbriParing.asmx HTTP/1.1 Host: nba.tja.ee Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://nba.sa.ee/NumriomanikuParing" <?xml version="1.0" encod

因为我对SOAP还很陌生,所以我真的需要一些帮助来开始。我被赋予这样的结构:

请求:

    POST /NumbriParing/NumbriParing.asmx HTTP/1.1
Host: nba.tja.ee
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://nba.sa.ee/NumriomanikuParing"

<?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:Body>
    <NumriomanikuParing xmlns="http://nba.sa.ee/">
      <number>long</number>
    </NumriomanikuParing>
  </soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?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:Body>
    <NumriomanikuParingResponse xmlns="http://nba.sa.ee/">
      <NumriomanikuParingResult>
        <Number>long</Number>
        <OmanikuRegNumber>string</OmanikuRegNumber>
        <Omanik>string</Omanik>
        <VastusKood>NumberLeitud or NumbritEiLeitud</VastusKood>
      </NumriomanikuParingResult>
    </NumriomanikuParingResponse>
  </soap:Body>
</soap:Envelope>
POST/numberparing/numberparing.asmx HTTP/1.1
主持人:nba.tja.ee
内容类型:text/xml;字符集=utf-8
内容长度:长度
SOAPAction:“http://nba.sa.ee/NumriomanikuParing"
长的
响应:

    POST /NumbriParing/NumbriParing.asmx HTTP/1.1
Host: nba.tja.ee
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://nba.sa.ee/NumriomanikuParing"

<?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:Body>
    <NumriomanikuParing xmlns="http://nba.sa.ee/">
      <number>long</number>
    </NumriomanikuParing>
  </soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?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:Body>
    <NumriomanikuParingResponse xmlns="http://nba.sa.ee/">
      <NumriomanikuParingResult>
        <Number>long</Number>
        <OmanikuRegNumber>string</OmanikuRegNumber>
        <Omanik>string</Omanik>
        <VastusKood>NumberLeitud or NumbritEiLeitud</VastusKood>
      </NumriomanikuParingResult>
    </NumriomanikuParingResponse>
  </soap:Body>
</soap:Envelope>
HTTP/1.1200正常
内容类型:text/xml;字符集=utf-8
内容长度:长度
长的
一串
一串
数不清的
我需要用一个数字变量替换请求中的“long”占位符,以获取该数字的请求。 asmx位于 如何使用php实现这一点

致以最良好的祝愿, Martti

使用您需要的服务的WSDL。 比如:

try {
    $client = new SoapClient('https://nba.tja.ee/NumbriParing/NumbriParing.asmx?WSDL');
    $param = new stdClass();
    $param->number = 123;
    $result = $client->NumriomanikuParing($param);

    var_dump($result);
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}

非常感谢。它起作用了。我无法想象SoapClient如此易于使用。