1

I'm getting "Namespace must not match the enclosing schema" error when trying to create SoapClient object. Code is simple:

<?php $client = new \SoapClient('http://www.server.com/Service?wsdl');

How can I create object by ignoring this error?

1 Answer 1

2

I'm not sure what the WSDL looks like, so it's a bit hard to tell if the error can be avoided. However, you can switch to creating a SoapClient using non WSDL mode:

$client = new SoapClient(null, array('location' => "http://localhost/soap.php",
                                 'uri'      => "http://test-uri/"));

Where location and uri are described as:

An array of options. If working in WSDL mode, this parameter is optional. If working in non-WSDL mode, the location and uri options must be set, where location is the URL to request and uri is the target namespace of the SOAP service.

Source: http://www.php.net/manual/en/soapclient.soapclient.php

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.