错误请求生成soap客户端php

发布于 2024-12-02 16:00:18 字数 1228 浏览 2 评论 0原文

我正在尝试向我的肥皂网络服务发出请求。

    class DateTime2 extends DateTime {
        function __toString() { 
            return $this->format("d/m/Y H:i");
        }
    }
    $date = new DateTime2();

    $client = new SoapClient("http://www.myos.it/sp/smartphonelayer.asmx?wsdl",array("trace" => 1));
    $result = $client->SetReservation("Mario Rossi",2,"01234567",$date."");
    echo "REQUEST:".$client->__getLastRequest()."<br>"; 
    print_r($result);

我得到的输出是:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/">
    <SOAP-ENV:Body>
        <ns1:SetReservation/>
        <param1>2</param1>
        <param2>12345678</param2>
        <param3>2011-08-30T07:10:32</param3>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<br>stdClass Object
(
  [SetReservationResult] => stdClass Object
     (
         [Success] => SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
            [DeskCode] => 
            [Message] => 
       )

)

正如你所看到的,当我给它 4 个参数时,我在soapClient 创建的请求中只得到 3 个参数。

I'm trying to make a request to a soap webservice of mine.

    class DateTime2 extends DateTime {
        function __toString() { 
            return $this->format("d/m/Y H:i");
        }
    }
    $date = new DateTime2();

    $client = new SoapClient("http://www.myos.it/sp/smartphonelayer.asmx?wsdl",array("trace" => 1));
    $result = $client->SetReservation("Mario Rossi",2,"01234567",$date."");
    echo "REQUEST:".$client->__getLastRequest()."<br>"; 
    print_r($result);

The output i get is:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/">
    <SOAP-ENV:Body>
        <ns1:SetReservation/>
        <param1>2</param1>
        <param2>12345678</param2>
        <param3>2011-08-30T07:10:32</param3>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<br>stdClass Object
(
  [SetReservationResult] => stdClass Object
     (
         [Success] => SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
            [DeskCode] => 
            [Message] => 
       )

)

As you can see i get only 3 parameters in request created by soapClient when i give it 4 parameteres.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

挽你眉间 2024-12-09 16:00:18

对于发送参数,您需要使用 array()

对于日期时间,XML 需要以下格式

class DateTime2 extends DateTime {
    function __toString() { 
        return $this->format("Y-m-d\TH:i:s.000\Z");
    }
}
$date = new DateTime2();
$client = new SoapClient("http://www.myos.it/sp/smartphonelayer.asmx?wsdl",array("trace" => 1));

$result = $client->SetReservation(array( "RDescription"=>"Giuseppe Silvestri",
                                         "RNumber"=>2,
                                         "RPhoneNumber"=>"3286026817",
                                         "RDate"=>$date.""));
echo "REQUEST:".$client->__getLastRequest()."<br>"; 
print_r($result);

For Sending the Parameter you need to use the array()

Also for Date Time, XML needs following format

class DateTime2 extends DateTime {
    function __toString() { 
        return $this->format("Y-m-d\TH:i:s.000\Z");
    }
}
$date = new DateTime2();
$client = new SoapClient("http://www.myos.it/sp/smartphonelayer.asmx?wsdl",array("trace" => 1));

$result = $client->SetReservation(array( "RDescription"=>"Giuseppe Silvestri",
                                         "RNumber"=>2,
                                         "RPhoneNumber"=>"3286026817",
                                         "RDate"=>$date.""));
echo "REQUEST:".$client->__getLastRequest()."<br>"; 
print_r($result);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文