Saturday, 18 June 2011

Problem with PHP's SoapClient and the hash symbol

I am writing an integration piece with a Learning Management System (LMS) called QuestionMark, and I was using PHP's out of the box SoapClient to retrieve information from a web service, but I kept getting this message after checking all my other parameters were correct:

Server did not recognize the value of HTTP Header SOAPAction: http://questionmark.com/QMWISe/#GetParticipant.

It turns out that I needed to specify the correct version of SOAP in order for this to work. So to fix this issue, add this to the array while constructing the SoapClient object:

'soap_version' => SOAP_1_2

More context:

$params = array('location' => $this->wsdlUrl, 'uri' => $this->targetNamespace, 'soap_version' => SOAP_1_2, 'trace' => 1)

$this->client = new SoapClient(null, $params);

1 comment:

  1. Nice, thanks! I just filed a documentation bug after finding this post
    https://bugs.php.net/bug.php?id=69098

    ReplyDelete