не могу аутентифицировать запрос SOAP php - PullRequest
0 голосов
/ 26 июня 2019

Я пытаюсь пройти проверку подлинности и получить ответ на запрос мыла, я пробовал разные варианты, но не могу получить никаких результатов обратно.Это формат, в котором должен быть xml:

<?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>
    <UserCredentials xmlns="http://www.wtvision.com/sportsmanager">
      <userName>string</userName>
      <password>string</password>
      <appName>string</appName>
      <instance>string</instance>
    </UserCredentials>
  </soap:Header>
  <soap:Body>
    <GetGames xmlns="http://www.wtvision.com/sportsmanager">
      <competitionKeyName>string</competitionKeyName>
    </GetGames>
  </soap:Body>
</soap:Envelope>

Это мой код:

<code>$url="http://sportsmanager.wtvision.com/SportStatsCenterV4/SportStatsCenterInfoServiceV4.asmx?WSDL";



    try{
        $auth = array(
            'username' => 'xxxxx',
            'password' => 'xxxxx',
        );
        $ns = 'http://www.wtvision.com/sportsmanager';


        $client = new SoapClient($url);
        $header = new SOAPHeader($ns, 'UserCredentials', $auth);
        $client->__setSoapHeaders($header);   
        print_r($client->__getLastRequest());
        $result  = $client->GetGames();
        echo '<h2>Response</h2>';
        echo "<pre>".print_r($result, true)."
";} catch (Exception $ e) {echo $ e-> getMessage ();}

Единственный ответ, который я получаю:

System.Web.Services.Protocols.SoapException: Invalid authentication for user . at SportStatsCenterInfoService.ThrowError(String competitionKeyName, String requestName, String errorMessage) in c:\inetpub\wwwroot\SportStatsCenterV4\App_Code\SportStatsCenterInfoService.cs:line 146 at SportStatsCenterInfoService.GetGames(String competitionKeyName) in c:\inetpub\wwwroot\SportStatsCenterV4\App_Code\SportStatsCenterInfoService.cs:line 558
...