嗯,又找到一些好玩的东西,web service。 有个叫Nusoap类,在php4下比较流行。但是淡水这次玩的是php5,所以他就没戏了。 先恶补一下相关知识。 先要打开php5的web service扩展。linux下,嗯,好像不会-_-!。windows下,把php.ini文件中 extension=php_soap.dll 去掉注释即可。 方法: SoapClient->__soapCall() 说明: class SoapClient { mixed __soapCall ( string function_name, array arguments [, array options [, mixed input_headers [, array &output_headers]]]) } In WSDL mode, you can simply call SOAP functions as SoapClient methods. This method useful in non-WSDL mode when soapaction is unknown, uri differs from the default or when sending and/or receiving SOAP Headers 返回值: 一个简单类型的返回值,或是一个关联数组 例子:
SOAP发送的协议:
POST /servicepath/service.asmx HTTP/1.1 Host: 211.186.1.4 Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: “http://211.186.5.15/Service/ServiceMethod”
调用方法:
SOAP发送协议:
POST /services/SoapMethod?WSDL HTTP/1.1 Host: 220.211.1.12:8088 Connection: Keep-Alive User-Agent: PHP-SOAP/5.2.5 Content-Type: text/xml; charset=utf-8 SOAPAction: “urn:SoapMethod#ServiceMethod” Content-Length: 1297
调用方法:
name 参数名
最后修改于 2009-05-11