Home > Backend Development > PHP Tutorial > 请问PHP调用C#的WEBSERVICE有关问题

请问PHP调用C#的WEBSERVICE有关问题

WBOY
Release: 2016-06-13 13:28:22
Original
1085 people have browsed it

请教PHP调用C#的WEBSERVICE问题
代码写法:

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->header("content-type:text/html;charset=utf-8"); 
$client = new SoapClient("http://s.dailiangu.com:8011/WebLocalData.asmx?WSDL"); 
$p = $client->Return_Package(array('UN'=>'dailiantang','PS'=>'xieyanjobb1306','TopCount'=>'2')); 
var_dump($p);//结果从这里分析 
echo "<br><hr>"; 
$ss = get_object_vars($p); 
print_r($ss);

Copy after login

输出结果如下:
object(stdClass)#2 (1) { ["Return_PackageResult"]=> object(stdClass)#3 (2) { ["schema"]=> string(716) "" ["any"]=> string(643) "68697【代练堂】70-85级★赠4000金五大声望尊敬★纯任务70.008468698【代练堂】【S11荣誉战场毕业】全套加武器【秒排2-3天】50.0084" } } 
 
--------------------------------------------

Array ( [Return_PackageResult] => stdClass Object ( [schema] => [any] => 68697【代练堂】70-85级★赠4000金五大声望尊敬★纯任务70.008468698【代练堂】【S11荣誉战场毕业】全套加武器【秒排2-3天】50.0084 ) )
应该有如下几个值,怎么一一获得?
68 697 【代练堂】70-85级★赠4000金五大声望尊敬★纯任务 70.00 84
68 698 【代练堂】【S11荣誉战场毕业】全套加武器【秒排2-3天】 50.00 84
(最后的两个84是巧合,应该是不一样的,前面的68是一样的,我要怎么分别获得这几种值?)
返回的是DataSet 类型,里面每一行(每1行就是1笔套餐)包括以下5个值:
[WorkID] 工作室编号,例如68
[PID]套餐编号,例如:697
[Ptitle]套餐名称,例如:XXXXXXXX
[Pri]价格,例如:70.00
[H]代练时间,例如:84



------解决方案--------------------
PHP code
header("Content-type:text/html;charset=utf-8");
$client = new SoapClient("http://s.dailiangu.com:8011/WebLocalData.asmx?WSDL");
$p = $client->Return_Package(array('UN'=>'dailiantang','PS'=>'xieyanjobb1306','TopCount'=>'5'));
$se = $p->Return_PackageResult->any;

$dom = simplexml_load_string($se);
foreach($dom->NewDataSet->Get_WebLocalData as $datas) {
  foreach($datas as $k=>$v) echo "$k : $v <br>";
  echo '<br>';
} <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template