php 调用.net 写的webservice,无法传参数

lg_yan 2008-08-24 01:36:25
我用php的soap扩展调用.net的webservice,淡始终穿不了参数,不知是怎麽会事,请大家指点,代码如下:
PHP:
$bugclient=new SoapClient("http://localhost:1944/WebSite2/Service.asmx?WSDL");
return $bugclient->HelloWorld(2121) ;

.net:(就一个简单示例)
using System;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;

[WebService(Namespace = "http://haha.com")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Service : System.Web.Services.WebService
{
public Service () {

//Uncomment the following line if using designed components
//InitializeComponent();
}

[WebMethod]
public string HelloWorld(int bugid) {
return bugid.ToString() ;
}

}
...全文
151 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
fxs_2008 2008-08-25
  • 打赏
  • 举报
回复
传参有两种,一种一般是变量或数组传参,数据类型要对,象楼上的yzxlyd兄的

有的要求用类,但不知如何传
yzxlyd 2008-08-25
  • 打赏
  • 举报
回复
传参数好像是在第二个参数里面给。
__construct ( mixed $wsdl [, array $options ] )
$client = new SoapClient("some.wsdl", array('proxy_host' => "localhost",
'proxy_port' => 8080,
'proxy_login' => "some_name",
'proxy_password' => "some_password"));
jiangyouxing 2008-08-24
  • 打赏
  • 举报
回复
或许是编码问题

21,894

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧