SOAP client: PHP SOAP Server-side C # Client

Source: Internet
Author: User
Tags array soap php soap server soap client client wsdl



recently wrote a PHP soap server


end, the implementation of the PHP client calls, but can not achieve the C # client calls, after reading the manual for a long time did not realize its visit


, finally tried a nusoap

An open source
on the
sf.net

Project, Effect


is very good, very eacy to achieve the required functions


C # 's web


Service


(server side) is very easy to implement, C # client invocation is also very convenient


PHP's Web server side typically generates a. wsdl file


,. WSDL is a service provided by an XML file Description


below to see my first PHP Web service


<?php


/**


* Processsimpletype Method


* @param string $who name of the person we ' ll say hello to


* @return String $hellotext The Hello string


*/


function Processsimpletype ($who) {


return "Hello $who, Welcome to visit http://www.cxybl.com


";


}


?>


Remember to download
first

Nusoap


<?php


require_once ("lib/nusoap/nusoap.php");


$namespace = "http://www.cxybl.com";


Create a new SOAP server


$server = new Soap_server ();


//Configure our WSDL


$server->configurewsdl ("SimpleService");


//Set our namespace


$server->wsdl->schematargetnamespace = $namespace;


//Register our WebMethod


$server->register (


//Method Name:


"Processsimpletype",


//Parameter list:


Array ("name" => "xsd:string"),


//return value (s):


Array ("Return" => "xsd:string"),


//namespace:


$namespace,


//SOAPAction: (Use default)


false,


//style. RPC or document


"RPC",


//use:encoded or literal


"encoded",


//Description:documentation for the method


"A simple Hello World Web method");


Get we posted data if the service is being consumed


//Otherwise leave this data blank.


$post _data = isset ($globals ["Http_raw_post_data"])? $globals ["Http_raw_post_data"]: "";


//Pass we posted data (or nothing) to the SOAP service


$server->service ($post _data);


exit ();


?>


after writing, you can use the


Open. NET, add references


Next click WSDL to see the services provided, as shown in the following figure


This article links http://www.cxybl.com/html/wlbc/Php/20120531/27134.html





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.