PHP calls WebService interface, Java code cannot receive parameters

Source: Internet
Author: User

A period of time to do a project two development, there is a function is required to PHP call Java implementation of the WebService interface, and pass some parameters to the interface, and then follow the interface provided by the other side of the document to make a parameter call, Java side has received the request, but the parameter is always NULL, Some of the code is as follows:

1 $client=NewSoapClient ($this-WebServiceURL); 2 $client->soap_defencoding = ' Utf-8 ';3 $client->xml_encoding = ' Utf-8 ';4 $param=$context;//parameter stitching XML string5 $result=$client->managementmemberinfo ($param);//return value

No matter what type of data is passed, the other person receives null. Then all kinds of Baidu (here are spit groove: Baidu really spicy chicken. ), Baidu came out of various messy answers, various attempts, and then continued various failures. [Email protected] .... You'll see an article later that says to add a key value and then try it:

 1  $client  = new  soapclient ( $this ->webserviceurl);  2  $client ->soap_defencoding = ' Utf-8 '  3  $client ->xml_encoding = ' utf-8 ' ;  4  $param  = array  (' context ' =  $context ); //  parameter stitching XML string  5  $result  =  $client ->managementmemberinfo ( $param ); //  return value  

Then, it's still a tragedy ... Continue Baidu, Bing ... Then saw an article said to add the key value, the key named arg0 this, if there are multiple should be an analogy arg1,arg2 and so on, well, originally I think with the front add key value no difference, but still tried:

$client New SoapClient ($this$client->soap_defencoding = ' utf-8 '; $client->xml_encoding = ' utf-8 '; $param Array (' arg0 ' =$context); // parameter stitching XML string $result $client->managementmemberinfo ($param); // return value

Then, the other person said to receive the data ...

I hereby record it. PS: For why must be arg0 not too understand, if have clear, hope to small white pointing, thank you.

PHP calls WebService interface, Java code cannot receive 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.