soapAction of NuSoap in pure PHP

1

I have tried everywhere to achieve it but it has been impossible for me, I do not want to use NuSoap and the only thing I need to match everything with the PHP SoapClient is to be able to indicate the soapaction as I can mount it in the NuSoap.

In NuSoap I have it like this:

$result = $this->proxy->call('getData', array($data), 'http://tempuri.org/','server.com.co/service.asmx/getData', false);

There it works perfectly note that I must put the soapaction as a REST type "server.com.co/service.asmx/getData"

In pure PHP I've tried it this way:

        $header = new SoapHeader('http://tempuri.org/','server.com.co/service.asmx/getData',$data,false);
        $this->client->__setSoapHeaders(array($header));
        // Se realiza la solicitud
        $result = $this->client->getData($data);

But it returns me error. Can someone tell me if there is a way to achieve this? Thanks

    
asked by hdaleman 18.05.2018 в 01:01
source

1 answer

1

Thank you very much for your answers, after several attempts I managed to come up with the trick, I imagine it's something simple and silly, but I prefer to leave the solution here for those who like me may get stuck a bit.

$result = $this->client->__soapCall('getData',array($data),array('soapaction' => 'server.com.co/service.asmx/getData'));

As you can see with the soapCall native method of PHP SoapServer as the third parameter, an array is placed indicating the soapaction that you want to execute, in this case I must specify it as a get call of the method I want to use as well. Thank you.

    
answered by 21.05.2018 / 16:26
source