简体   繁体   English

如何从PHP调用Soap Web服务

[英]How to call soap web service from php

I am able to consume soap web service using wizdler in my chrome but need to how can I consume it in my php code. 我可以在Chrome中使用wizdler来使用soap web服务,但是需要如何在我的php代码中使用它。 From Wizdler I can get the proper response, for example I am posting the information like this: 从Wizdler,我可以获得正确的响应,例如,我正在发布以下信息: 在此处输入图片说明

Question is how to call this service from php code, what I did/trying so far is: 问题是如何从php代码调用此服务,到目前为止我所做的/尝试的是:

<?php

$wsdl = "http://64.20.37.90/VTWebServiceTest/VisualService.svc?wsdl";

$client = new SoapClient($wsdl);

$request_param = array(

    "storeNumber" => "valid value",
    "enterpriseId" => "valid value",
    "credential" => "valid value"

);

try {

    $responce_param = $client->GetCategories($request_param);
    $result = $responce_param->GetCategoriesResult;
    print_r($result);
} catch (Exception $e) {

    echo "Exception Error!";
    echo $e->getMessage();

}

?>

But it always returns message "12|Invalid service credential." 但是它总是返回消息“ 12 |无效的服务凭证”。

Can anybody help me out? 有人可以帮我吗?

Thanks in advance. 提前致谢。

maybe try this ... 也许试试这个...

$responce_param = $client->GetCategories($request_param);
print_r($responce_param);

or even 甚至

$responce_param = $client->GetCategories($request_param);
$values = get_object_vars($responce_param);
$myresults = object_to_array($values);
print_r($myresults);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM