如何解析asmx的返回值

时间:2016-05-26 09:37:20

标签: php web-services asmx

我想将一些值从php发送到asmx webservce。 我的代码工作正常,但返回值是这样的:

object(stdClass)#4 (1) { ["any"]=> string(963) "123" }  

现在,如何获得123值?

require_once('lib/nusoap.php');
$client = new SoapClient("http://****/service.asmx?WSDL");
$params->UserName   = '1';
$params->PassWord   = '1!';
$params->Ip         = '1!';
$params->MacMain    = '1!';
$params->PcName     = '1!';
$result = $client->GetPassPort($params)->GetPassPortResult;
var_dump($result);

1 个答案:

答案 0 :(得分:1)

从对象获取数据时,您需要使用var http = require('http'); var fs = require('fs'); http.createServer(function(request, response) { console.log('request starting...'); var url = request.url; switch(url) { case '/' : getStaticFileContent(response, 'public/index.html','text/html'); break; case '/add': getStaticFileContent(response, 'public/add.html','text/html'); break; case '/css/style.css': getStaticFileContent(response, 'css/style.css','text/css'); break; case '/js': getStaticFileContent(response, 'js/javascript.js','text/javascript'); break; default: response.writeHead(404, {'Content-Type':'text/plain'}); response.end('404 - Page not Found'); } }).listen(8000); console.log('Hello World, this is the Projekt Nr.1'); console.log('Server Running at localhost:80'); function getStaticFileContent(response, filepath, contentType) { fs.readFile(filepath, function(error, data){ if(error) { response.writeHead(500,{'Content-Type':'text/plain'}); response.end('500 - Internal Server Error'); } if(data) { response.writeHead(200, { 'Content-Type': contentType }); response.end(data); } else { response.writeHead(200, { 'Content-Type': contentType }); response.end(content, 'utf-8'); } }); } 运算符。只需使用下面的代码将->作为:{/ p>

123