2

I'm trying to access a .NET SOAP web service with PHP SoapClient. The thing is i get the following error:

looks like we got no XML document

When I call __getLastResponse() on the client object, the xml is kind of weird:

--uuid:a2591cd7-7b7b-44bb-b93e-2750cc651efc+id=14
Content-ID: <http://tempuri.org/0>
Content-Transfer-Encoding: 8bit
Content-Type: application/xop+xml;charset=utf-8;type="application/soap+xml"

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><a:Action s:mustUnderstand="1">http://tempuri.org/IRemoteRegForDeposit/GetHelloWorldResponse</a:Action><a:RelatesTo>uudi:6e612bfb-6d03-9c4f-ea90-2af98bad1885</a:RelatesTo></s:Header><s:Body><GetHelloWorldResponse xmlns="http://tempuri.org/"><GetHelloWorldResult>Ти ми изпрати числото:1</GetHelloWorldResult></GetHelloWorldResponse></s:Body></s:Envelope>
--uuid:a2591cd7-7b7b-44bb-b93e-2750cc651efc+id=14--

Here's my code:

$client = new CustomSoapClient($wsdl, array(
    'trace' => true,
    'soap_version' => SOAP_1_2,
    'exceptions' => 0,
    'cache_wsdl' => 0,
));

$data = new stdClass();
$data->dummyNumber = '3';
$response = $client->GetHelloWorld($data);

My CustomSoapClient extends the PHP's SoapClient and uses this class to add ws-address stuff to the soap request.

class CustomSoapClient extends SoapClient
{
    public function __doRequest($request, $location, $saction, $version, $one_way = NULL)
    {
        $dom = new DOMDocument();

        $dom->loadXML($request);
        $wsa = new WSASoap($dom);
        $wsa->addAction($saction);
        $wsa->addTo($location);
        $wsa->addMessageID();
        $wsa->addReplyTo();
        $request = $wsa->saveXML();

        return parent::__doRequest($request, $location, $saction, $version, $one_way);
    }
}

I'm not sure why the response is not clean xml. Any ideas what should I do?

brslv
  • 526
  • 7
  • 16

1 Answers1

1

OK, so I've managed to solve this stupid problem, using this trick here. For more detailed information, check out this post, too. Hope I made someone's day a better one. Cheers.

Community
  • 1
  • 1
brslv
  • 526
  • 7
  • 16