从现有的wsdl获取PHP SOAP位置和uri

which attributes from existing WSDL do I have to use in order to get the same functionality in non-wsdl mode? I would like to use non wsdl SoapClient in PHP but I can't get the correct configuration. I want to use Salesforce SOAP API but I don't want to store the wsdl file localy. I created that wsdl file and it works when i use it like this

$soap = new \SoapClient("enterprise.wsdl.xml"); 

but I would prefer this way

$soap = new \SoapClient(null, [
     "location" => "#SomeValueThatICanFindInTheActualWSDL#",
     "uri" => "#SomeOtherValueThatICanFindInTheActualWSDL#",
]);

which wsdl attributes should I use as location and uri?

  • uri - Should be actual address of a service http://someservice
  • location - Operation you want to execute

If you paste the WSDL url into your web browser, this will give you a large XML document (you may need to add ?wsdl to the url), which has the 2 variables you are looking for.

To find the location, search for the following node:

<wsdl:import namespace="http://www.[some namespaceurl]" location="https://[the location url you want]" /> 

For the URI, you generally just remove the file name and/or folder structure off the URL. For example if your service is:

https://somedomain.com/folder1/folder2/somefile.svc?wsdl

Then the URI could be:

https://somedomain.com/folder1/folder2

or

https://somedomain.com/folder1

or

https://somedomain.com

You'll just need to trial and error until you find what works. Hope this helps.