C#调用PHP写的WebService
2008-01-20 16:54:49
版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://approlife.blog.51cto.com/304821/60025 |
1.server.php
<?php class Result{ function add($a,$b){ return $a+$b; } } ?> 2.kobetest.wsdl
<?xml version='1.0' encoding='UTF-8'?> <!-- WSDL file generated by Zend Studio. --> <definitions name="kobetest" targetNamespace="urn:kobetest" xmlns:typens="urn:kobetest" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <message name="add"> <part name="a" type="xsd:string"/> <part name="b" type="xsd:string"/> </message> <message name="addResponse"> <part name="addReturn" type="xsd:string"/> </message> <portType name="ResultPortType"> <operation name="add"> <input message="typens:add"/> <output message="typens:addResponse"/> </operation> </portType> <binding name="ResultBinding" type="typens:ResultPortType"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="add"> <soap:operation soapAction="urn:ResultAction"/> <input> <soap:body namespace="urn:kobetest" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </input> <output> <soap:body namespace="urn:kobetest" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output> </operation> </binding> <service name="kobetestService"> <port name="ResultPort" binding="typens:ResultBinding"> <soap:address location="http://192.168.1.55/server.php"/> </port> </service> </definitions> 3.在VS2005中“添加web引用”,然后在代码里调用webservice就OK了。
PS:这里只是简单的写了基本过程。有些细节的地方没注明,需要的朋友可以留言联系我。 本文出自 “技术旅途上蹒跚的步行者” 博客,请务必保留此出处http://approlife.blog.51cto.com/304821/60025 本文出自 51CTO.COM技术博客 |


approlife
博客统计信息
热门文章
最新评论
友情链接