Sending XML input to WSDL using SoapClient

前端 未结 2 855
深忆病人
深忆病人 2021-02-09 05:33

I have this WSDL: https://secure.softwarekey.com/solo/webservices/XmlCustomerService.asmx?WSDL

I am trying to use SoapClient to send a request to the CustomerSearch meth

相关标签:
2条回答
  • 2021-02-09 06:02

    try passing $client->CustomerSearch($CustomerSearch); or pass a string

    0 讨论(0)
  • 2021-02-09 06:09

    I think you need to look more into the documentation (with regards to the any parameter). But your request should be something like this:

    $url = 'https://secure.softwarekey.com/solo/webservices/XmlCustomerService.asmx?WSDL';
    $client = new SoapClient($url);
    
    $xmlr = new SimpleXMLElement("<CustomerSearch></CustomerSearch>");
    $xmlr->addChild('AuthorID', $authorID);
    $xmlr->addChild('UserID', $userID);
    $xmlr->addChild('UserPassword', $userPassword);
    $xmlr->addChild('Email', $customerEmail);
    
    $params = new stdClass();
    $params->xml = $xmlr->asXML();
    
    $result = $client->CustomerSearchS($params);
    

    EDIT: This is how I've done it in similar project. It may not be best practice. SoapVar might be the better way to do it (SoapVoar example with ANY_XML).

    0 讨论(0)
提交回复
热议问题