Sending XML input to WSDL using SoapClient

前端 未结 2 1327
囚心锁ツ
囚心锁ツ 2021-02-09 05:28

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 05:56

    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("");
    $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).

提交回复
热议问题