We have the following scenario:
- Setup a web service - wsdl and all, supposed to be listening for data sent by the client, receive it, do stuff with it and send a response as 'ok' if everything is okay, and 'false' if something died
- Client side runs a script that generates the soap/xml request bit, creates a soap client and sends the request to the wsdl.
- Client side gets a result indicating that the data was not processed by the web service - false. And the web service receives no data at all.
I don't have access to the web service - it is someone else's. The generated request body (the whole etc.) is being generated correctly - when I send it through soapUI it works, but not through my php soap client.
I tried using the built-in Soap with the SoapClient
, __doRequest
, __call
(kind of tried everything), but nothing happens - still getting 'false'
result. I tried re-writing the NuSoap in order to work with Soap 1.2, but still only a 'false'
result for something that returns true.
So, I was wondering if someone can answer me the following questions:
on the server do I need something specially install to get it to work with Soap 1.2 ?
When the client has to send data to the web service's function do I use __doRequest or __call? Or something else?
According to my php.ini the server header_accept values do not have the application/soap+xml that is needed to work with soap 1.2 - could this be the problem, if yes - back to question 1, or how can I add the type to the header_accept?
EDIT:
$client = new SoapClient(
"the_wsdl_url_correct_for_sure.wsdl",
array(
'soap_version' => SOAP_1_2,
'trace' => 1,
)
);
$result = $client->__doRequest(
$the_var_i_use_to_store_the_soap_xml_thingie_that_works_through_soapUI_so_it_is_correct, $location,
$the_function_I_try_to_call,
"1.2"
);
For $location
I am the namespace of the action (the function I'm trying to call and send the data from the first parameter to). And for the action/function I tried using just the name of the action as it's defined in the namespace, and using the full path with the "full_namespace/action"
Should I use __doRequest
or __call
when I'm trying to send the data to the WSDL?
EDIT2:
The request I'm sending is:
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:soapenc="http://www.w3.org/2003/05/soap-encoding" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Header/>
<env:Body>
<ns2:FunctionName xmlns:ns2="namespace_of_the_service">
<arg0>
<data1>Some data</data1>
</arg0>
</ns2:FunctionName>
</env:Body>
</env:Envelope>
More about the problems from this can read in my previous post: PHP Soap Client - sending the wrong headers "soapenv:VersionMismatch"
SoapClient
class for starters, it supports SOAP 1.2. You most likely provide the wrong argument. Are you in WSDL mode or not? Where is your code (stick to SoapClient with an example code here if you ask me)? - hakreSoapClient
, explained with the docs forSoapClient::__getLastResponse
. - Then check the request and the response XML of the SOAP communication. - hakre