PHP Soap 应用程序的 cURL 与 __SoapClient

发布于 2024-11-03 04:26:59 字数 1006 浏览 1 评论 0原文

我遇到了 PHP 内置 SOAP 客户端反复出现的问题,无论输入参数如何,它都会返回相同的错误响应。

使用 PHP 内置的 SOAP 库有优点还是直接通过 cURL 通过 GET 查询有缺点?

    $client = new SoapClient("http://example.com/wdsl"); 

    $params = array(
        'Username' => 'username',
        'Password' => 'pass',
        'EventName' => 'Test Event',
        'EventDate' => '2011-06-15T13:45:30',
        'Destination' => '447987654321',
        'Carrier' => '1',
        'PhoneType' => '13',
        'Originator' => 'ukflive',
        'MessageText' => 'Test',
        'LogoURL' => 'http://example.com/mail.gif',
        'BookingReference' => '123456',
        'Tickets' => '1',
        'CollectionValidFrom' => '2011-06-15T13:45:30',
        'CollectionValidTo' => '2011-06-15T18:45:30',
        'TemplatePath' => '',
        'PostBack' => 'http://example.com/'
    );

    $response = $client->__soapCall("SendManagedMobileTicket", $params); 

    print_r($response);

I'm having a recurring issue with PHP's inbuilt SOAP client where it returns the same error response regardless of the input paramaters.

Is there an advantage to using the SOAP library built into PHP or a disadvantage to directly querying via cURL through GET?

    $client = new SoapClient("http://example.com/wdsl"); 

    $params = array(
        'Username' => 'username',
        'Password' => 'pass',
        'EventName' => 'Test Event',
        'EventDate' => '2011-06-15T13:45:30',
        'Destination' => '447987654321',
        'Carrier' => '1',
        'PhoneType' => '13',
        'Originator' => 'ukflive',
        'MessageText' => 'Test',
        'LogoURL' => 'http://example.com/mail.gif',
        'BookingReference' => '123456',
        'Tickets' => '1',
        'CollectionValidFrom' => '2011-06-15T13:45:30',
        'CollectionValidTo' => '2011-06-15T18:45:30',
        'TemplatePath' => '',
        'PostBack' => 'http://example.com/'
    );

    $response = $client->__soapCall("SendManagedMobileTicket", $params); 

    print_r($response);

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

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

发布评论

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

评论(1

表情可笑 2024-11-10 04:26:59

SoapClient 是 PHP5 的一个集成的、积极维护的部分。 cURL 是发送 HTTP 数据的快速但肮脏的方式。明智的长期决策是坚持使用 SoapClient 及其方法。

您可能还想查看响应标头,如 __soapCall() 文档页面的注释部分所示: http://www.php.net/manual/en/soapclient.soapcall.php#102387

SoapClient is an integrated, actively maintained part of PHP5. cURL is the quick and dirty way to send HTTP data. The smart long term decision is to stick with SoapClient and its methods.

You may also want to look into the response headers, as shown in the notes section of the __soapCall() documentation page: http://www.php.net/manual/en/soapclient.soapcall.php#102387

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文