Hello arcane.

Today is the first time I had to work with SOAP.
In principle, I read a little on this subject, more or less clear.

But to realize and could not. But it is not clear what parameters are passed to methods.

There is a file WSDL and the description of its types

About how to raise SoapServer I get it, but because I need to know which data is sent him I had to lift the client, but then came to a standstill as I've never used SOAP did not understand what parameters you need to pass in

<br / > $client = new SoapClient("soap.wsdl", array("trace"=>true));<br> print($client-><b>PerformTransaction()</b>);<br> <br / >

What would I had not passed an error is thrown:

Fatal error: Uncaught SoapFault exception: [Client] looks like we got no XML document in F:\AppServ\www\soap\client.php:9
Stack trace:
#0 [internal function]: SoapClient->__call('PerformTransact...', Array)
#1 F:\AppServ\www\soap\client.php(9): SoapClient->PerformTransaction()
#2 C:\Program Files\Zend\ZendStudio-5.5.1\bin\php5\dummy.php(1): include('F:\AppServ\www\...')
#3 {main}
thrown in F:\AppServ\www\soap\client.php on line 9
Please help good people. The gugleniya on this subject, almost no to no avail, you last hope.

I would push and then myself.

In advance very grateful.

P. S. Documentation from the service provider (payment terminal) also did track gave. They have a pancake even an example of implementing a no!
October 8th 19 at 00:39
5 answers
October 8th 19 at 00:41
public SoapClient::SoapClient ( mixed $wsdl [, array $options ] ) // notice the first parameter is a valid xml for the soap. In fact it needs to be the same which handles the server.
Judging by the error it You and do not give, either he is corrupt or the wrong way.
No, I give up, server, client, and wsdl file are in 1 place, close to them and lying xsd - Sherman_Reinger commented on October 8th 19 at 00:44
Free for a limited then the PHP file in utf-8 without bom and check to - aniya.Kertzmann65 commented on October 8th 19 at 00:47
Because the server sees this file. I just wouldn't know what parameters to pass in the $client->PerformTransaction()
Or rather what type, and what is also. Maybe someone from the xsd will understand and tell?! - Sherman_Reinger commented on October 8th 19 at 00:50
No, nothing like that. Files originally created in utf8 - Sherman_Reinger commented on October 8th 19 at 00:53
Parameters you need to pass the usual, You've described in the wsdl what functions You have and what parameters they accept? wsdl in fact a description of what functions You call and what data they will accept/return, and if the data is complex (array) then they must separately describe and then refer to these records. By the way you would put your files, people will look at we can see what was happening, ATO telepaths, like on vacation, and errors are not always informative. - aniya.Kertzmann65 commented on October 8th 19 at 00:56
Yes, the fact that I soap never worked until today, neuil know him, and the files were the service provider. the files are available, I link to them put in the post. - Sherman_Reinger commented on October 8th 19 at 00:59
October 8th 19 at 00:43
Offer a solution that helped me:
$server = new SoapServer('./wsdl/wsdl.wsdl');

Let me explain. Before initializing your SoapServer clean the contents of the command ob_clean();
Thank you very much, helped! - Sherman_Reinger commented on October 8th 19 at 00:46
October 8th 19 at 00:45
That would be to look at them need to know what parameters to pass into functions, I do not know why, and asking for help.
My tip need only 1 line: $client->PerformTransaction(), or more precisely parameters which are supposed to transmit there. - Sherman_Reinger commented on October 8th 19 at 00:48
October 8th 19 at 00:47
Disclaimer: also not really worked with soap

Where you, the client sends a request? They are written in WSDL: <soap:address location=""></soap:address>

And where really to send, they give You when you connect, as I understand it.

Thus it is necessary either to fix the wsdl (substitute the address of your test server SOAP or obtain them), or pass the option location."/>
This address, I ordered, as raised soap server on the LAN for testing. The goal itself is the provider providing service connected to the site as the client, and the website processes the request and returns the values. I now that would raise a full soap server, you need to it client for tests to write, but the client gives an error.
- Sherman_Reinger commented on October 8th 19 at 00:50
OK, then your server sends is not XML, but something else on the client and swears. See tcpdump'ohms.

The settings that you like to convey through an array or object (some of it exactly worked):
 'id' => 21,
 'name' => 'Vasya Pupkin'

// or

$arg = new stdClass;
$arg->id = 17;
$arg->name = 'Vasya Pupkin';
$arg->foo = 3.14;


// for complex types we need to do something like:
$arg->name = new SoapVar('Vasya Pupkin', XSD_STRING, 'string', '');

Parameters xsd:
<xs:complextype name="PerformTransactionArguments"><br> <xs:complexcontent><br> <xs:extension base="tns:GenericArguments"><br> <xs:sequence><br> <xs:element name="amount" type="xs:long" minoccurs="1"><br> <xs:element name="parameters" type="tns:GenericParam" nillable="true" minoccurs="0" maxoccurs="unbounded"><br> <xs:element name="serviceId" type="xs:long" minoccurs="1"><br> <xs:element name="transactionId" type="xs:long" minoccurs="1"><br> <xs:element name="transactionTime" type="xs:dateTime" minoccurs="1"><br> </xs:element></xs:element></xs:element></xs:element></xs:element></xs:sequence><br> </xs:extension><br> </xs:complexcontent><br> </xs:complextype><br> - aniya.Kertzmann65 commented on October 8th 19 at 00:53
Just in case: if you have soap.wsdl_cache_enabled=1, the wsdl key will be cached... And I've spat, she always to the old address breaking - Sherman_Reinger commented on October 8th 19 at 00:56
Caching disabled immediately. Thanks, Your example got me on the path. - Sherman_Reinger commented on October 8th 19 at 00:59
October 8th 19 at 00:49
Had the same problem on one of the servers — half day puzzled trying to find the cause in the end the bug was that when you build blaze pointed out some flag which is responsible for the file_get_contents. The fact that the class constructor SoapClient inside makes a call similar to file_get_contents, well, there where the latter does not work will not work and epau.
As a variant to test put on some sort of remote hosting and set new SoapClient('http://bla-bla.tld/some.wsdl') if using remote file everything works then the problem is with file_get_content

Find more questions by tags SOAPComputer networksPHP