php怎么调用wcf服务,调用参数是对象参数。
.net做的wcf接口,部署IIS上访问是可以的如图:
我用php soap调用测试,是否能通,也是可以的:
header('Content-Type: text/plain');
$client = new SoapClient('http://testu.sh.jinri.com/Flight.User.SOA/SuggestService.svc?wsdl');
echo '
echo "提供的方法\n";
print_r( $client->__getFunctions ());
echo "相关的数据结构\n";
print_r($client->__getTypes () );
echo '
?>
浏览器上看到的结果如图:
调用wcf中的这个方法:GetSuggestList
这个方法在接口里面是这样的:
public GetSuggestListResponse GetSuggestList(GetSuggestListRequest request)
所以参数是个对象
我用PHP调用如下:
$client = new SoapClient('http://testu.sh.jinri.com/Flight.User.SOA/SuggestService.svc?wsdl');
$param = array('UserId'=>'1920','PageIndex'=>'1','PageSize'=>'5');
print_r($client->GetSuggestList($param));
但是抛出这样的的错误:
Fatal error: Uncaught SoapFault exception: [a:InternalServiceFault] 未将对象引用设置到对象的实例。 in D:\APMServ5.2.6\www\htdocs\wsdltest\index.php:22 Stack trace: #0 [internal function]: SoapClient->__call('GetSuggestList', Array) #1 D:\APMServ5.2.6\www\htdocs\wsdltest\index.php(22): SoapClient->GetSuggestList(Array) #2 {main} thrown inD:\APMServ5.2.6\www\htdocs\wsdltest\index.php on line 22
求大神帮忙,整了一天了,不知道啥原因。
回复讨论(解决方案)
可怜的孩子 这么长时间都没人回你
我来告诉你吧
$client->GetSuggestList(array(' request'=>$param));
试试这个

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Alipay PHP...

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

Article discusses essential security features in frameworks to protect against vulnerabilities, including input validation, authentication, and regular updates.

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...

The article discusses adding custom functionality to frameworks, focusing on understanding architecture, identifying extension points, and best practices for integration and debugging.

An official introduction to the non-blocking feature of ReactPHP in-depth interpretation of ReactPHP's non-blocking feature has aroused many developers' questions: "ReactPHPisnon-blockingbydefault...
