Reputation: 66
I am new to SOAP and tryign to call webservice which is hosted on somewhereelse.
I am trying to call "IsUniqueUser" webservice which check whether the user is unique or not.
Following is schema for service..
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ser="some service" xmlns:xsd="some xsd" xmlns:xsd1="">
<soap:Header/>
<soap:Body>
<ser:isUniqueUser>
<!--Optional:-->
<ser:request>
<xsd:userName>SomeValidUserName</xsd:userName>
</ser:request>
</ser:isUniqueUser>
</soap:Body>
</soap:Envelope>
And i am trying to invoke this xervice in php using following code
$client = new SoapClient('Some.wsdl');
And after http authentication i am trying to call the isUniqueUser Method and passed "userName" as parameter.
$unique = $client->__soapCall('isUniqueUser', array('userName' =>'vish123'));
But nothing work out and i am getting following error
stdClass Object
(
[return] => stdClass Object
(
[errorCode] => 11ARPMWS1004
[errorMessage] => null. null
[status] => Failure
[uniqueUser] =>
)
)
I ahve tried to pass parameter in many ways like
$params = array('UserName' =>$_POST['userName']);
$unique = $client->__soapCall("isUniqueUser", $params);
OR
$unique = $client->isUniqueUser($params);
OR
$unique = $client->_soapCall('isUniqueUser', array('paramaters'=>$params));
OR
$unique = $client->_soapCall('isUniqueUser', array('request'=>$params));
And still i am getting the same error. I have contacted with provider for this issue and they said there is something wrong with code while passing the parameter.
Can anyone please let me know how to fix this issue?
Thanks
Upvotes: 0
Views: 4826
Reputation: 1
I had the same problem. I tried everything you did.
This one solved for me:
$result = $soapClient->somefunction(array(
"param1" => "value1",
"param2" => "value2"
));
Upvotes: 0
Reputation: 614
What I can see from you request is you have xsd:userName node under "ser:request", Can you try with creating array of request having array of userName.
$params = array('UserName' =>$_POST['userName']);
$paramsrequest = array('request' =>$param);
$unique = $client->__soapCall("isUniqueUser",$paramsrequest);
Upvotes: 1
Reputation: 11
In one of my project I use this :
$soapClient = new SoapClient($wsdl,$params);
$reponseclient=$soapClient->authentification($username,$password);
if($reponseclient->demandeRealisee===false){
error_log("Couldn't log ".$username);
}
Upvotes: 0
Reputation: 9211
see if this helps:
<?php
$sClient = new SoapClient('Some.wsdl');
$wrapper = null;
$wrapper->isUniqueUser->request->userName = new SoapVar('SomeValidUserName', XSD_STRING);
$result = $sClient->isUniqueUser($wrapper);
echo $sClient->__getLastResponse();
?>
Also, have you tried to fire manually using some soap client like soapUI? is it working?
Upvotes: 0