PHP calls ASP. NET service test by passing object parameters

Source: Internet
Author: User

ASP. NET Test Service

processrequest.asmx File code

       
public class ProcessRequest:System.Web.Services.WebService
{

[WebMethod] PublicCustomer Registercustomer (Customer customer) {varobj =NewCustomer (); Obj. Name= Customer. Name +"_return"; Obj. LastName= Customer. LastName +"_return"; Obj. Anotherattribute= Customer. Anotherattribute +"_return"; returnobj; } Public classCustomer { Public stringName {Get;Set; } Public stringAnotherattribute {Get;Set; } Public stringLastName {Get;Set; } }
}

PHP Test Code

<?PHPHeader("Content-type:text/html;charset=utf-8");? ><?PHPEcho"<br/>-----------PHP calls ASP by passing object parameters--------------<br/>";$object=NewStdClass ();$object->name = "Test";$object->lastname = "More Tests";$object->anotherattribute = "ABC";$client=NewSoapClient (' Http://localhost:8091/ProcessRequest.asmx?WSDL ');$result=$client->registercustomer (Array(' Customer ' =$object));Print_r($result);$MYOBJ=$result-Registercustomerresult;

echo "<br/>name:";
Print_r ($myObj->name?>

Results:

-----------PHP calls the ASP. NET service test by passingObject Parameters--------------ObjectObject ([Name] = Test_ Return [Anotherattribute] = Abc_return [LastName] = more Tests_return)) Name: Test_return

PHP calls ASP. NET service test by passing object parameters

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.