簡體   English   中英

使用SOAP從WSDL檢索值-PHP

[英]Retrieve value from WSDL using SOAP - PHP

我的WSDL文件結構非常糟糕,無法理解如何從中檢索信息。

無法從外部網絡訪問VM,因此無法共享整個WSDL文件

我想使用接受參數並返回具有多個值的字符串的getList函數。

SOAP Request

<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Header/>
    <S:Body>
        <ns2:getList xmlns:ns2="http://Wishlist.eBookCafe/">
            <arg0>2</arg0>
        </ns2:getList>
    </S:Body>
</S:Envelope>

SOAP Response

<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:getListResponse xmlns:ns2="http://Wishlist.eBookCafe/">
            <return>[1]</return>
        </ns2:getListResponse>
    </S:Body>
</S:Envelope>

我的問題是,因為值包含在return標記內,所以我不知道如何使用SOAP將其存儲在PHP變量中。

$list = $service->getList(array('arg0'=>$id));
print_r($list);

即使我使用靜態數字作為傳遞參數,它也始終會返回ID = 1的包含給用戶的值。

從博客帖子( 現在刪除: ()>>

<?php
$url = 'your_url_orFilePath';
$client = new SoapClient($url);

$xmlr = new SimpleXMLElement("<main_key></main_key>");
$xmlr->addChild('childName1', $childName1);
$xmlr->addChild('childName2', $childName2);
------
----likewise---

$params = new stdClass();
$params->xml = $xmlr->asXML();
$result = $client->main_key_function($params);
?>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM