将字符串插入Soapclient

时间:2010-07-02 18:06:45

标签: php soap wsdl

好的问题是我试图在Soapclient请求中插入一个字符串值,我知道在$ searchTerm参数之前应该有某种术语,但我不知道它是什么帮助会很多赞赏。

$searchTerm = $_GET['search'];
$client = new SoapClient('http://stuiis.cms.gre.ac.uk/dd615/' .
    'aspweb/WatCoursework/Service.asmx?WSDL');
$xmlString = $client->getMusicdetailsSql()->getMusicdetailsSqlResult->$searchTerm;

1 个答案:

答案 0 :(得分:0)

$searchTerm = $_GET['search']; // try searching for "Dixon";
$client = new SoapClient('http://stuiis.cms.gre.ac.uk/dd615/' . 
                         'aspweb/WatCoursework/Service.asmx?WSDL');
$response = $client->getMusicdetailsSql(array('searchTerm'=>$searchTerm));
echo $response->getMusicdetailsSqlResult->any;

此时您需要解析XML并从那里继续。它有时有助于实验和读出存储在变量中的值,看看你可以用它做什么。尝试运行以下内容以查看有关可能的更多详细信息:

print_r($client->getMusicdetailsSql());
print_r($client->getMusicdetailsSql(array('searchTerm'=>$searchTerm)));
...