How do I call WebService in PHP?

Source: Internet
Author: User
Other systems have a webservice,http://118.145.3.40:9082/mblwebservice/services/maicarinfoservice?wsdl.
I want to use PHP to invoke this webservice. Online check, so write:

$client = new SoapClient ("http://118.145.3.40:9082/mblWebService/services/MaiCarInfoService?wsdl",
Array (' encoding ' = ' UTF-8 '));
$parm 1 = "ABCDEFG";
$param = Array (' param0 ' = = $parm 1);
$arr = $client->sendmaicarinfo ($param);
Var_dump ($arr);

Should have passed the XML string, I first passed a ABCDEFG test, but the other side said there was no call.
Please look at what's going on. I'm not familiar with PHP either.


Reply to discussion (solution)

$parm 1  = "ABCDEFG"; $param = Array (' in0 ' = = $parm 1); $arr = $client->sendmaicarinfo ($param);

Return
StdClass Object
(
[out] = Error parsing XML, not conforming to XML standard
)

$parm 1 = '
 
  
   
  1234
 
  '; $param = Array (' In0 ' + $parm 1); $arr = $client->sendmaicarinfo ($param);

Return
StdClass Object
(
[Out] = success
)

Thank you so much.
Is there anything wrong with my code? Is it possible to return to success without any modification?

Yes, the code is not the same as you want to modify
Just pay attention to the name of the parameter
$client->__getfunctions () returns all method names
$client->__gettypes () returns all data structures
You can check it out.

Your problem is to write the parameter names wrong.

If you call webservice, what do you want to change in php.ini?

  • 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.