Reputation: 339
The SOAP server I call has two functions
GetUserInfo and GetAllUserInfo
the client calls the second function perfectly and displays all users. But the first function returns a null. I know it has something to do with the parameters, so I have tried a number of possible ways, still nothing. Here is the xml of soap and the function I used.
1.GetUserInfo
Request Xml:
<GetUserInfo>
<ArgComKey xsi:type="xsd:integer”>ComKey</ArgComKey>
<Arg>
<PIN xsi:type="xsd:integer”>Job Number</PIN>
</Arg>
</GetUserInfo>
Response Xml:
<GetUserInfoResponse>
<Row>
<PIN>XXXXX</PIN>
<Name>XXXX</Name>
<Password>XXX</Password>
2.GetAllUserInfo *
Request Xml:
<GetAllUserInfo>
<ArgComKey xsi:type="xsd:integer”>ComKey</ArgComKey>
</GetAllUserInfo>
Response Xml:
<GetAllUserInfoResponse>
<Row>
<PIN>XXXXX</PIN>
<Name>XXXX</Name>
<Password>XXX</Password>
< Group>X</ Group>
And here is the code I wrote for the client I use to get a specific user and all users.
try {
$opts = array('location' => 'http://192.168.0.201/iWsService',
'uri' => 'iWsService');
$client = new \SOAPClient(null, $opts);
$attendance = $client->__soapCall('GetUserInfo', array('PIN'=> 2));
var_dump($attendance);
} catch (SOAPFault $exception) {
print $exception;
}
When I called GetAllUserInfo with a parameter of empty array() it returns all the users. Including a user with PIN = 2. But the GetUserInfo method returns null. Am I missing something when I called the GetUserInfo method?
Upvotes: 1
Views: 1204
Reputation: 521429
In order to make the correct SOAP call for GetUserInfo
, you will need to know 2 parameters: the ComKey
and the PIN
. In my SOAP call below, I assume that the ComKey
is 12345
, but you will have to replace this value with something meaningful. Try using the following code:
try {
$opts = array('location' => 'http://192.168.0.201/iWsService',
'uri' => 'iWsService');
$client = new \SOAPClient(null, $opts);
$attendance = $client->__soapCall('GetUserInfo', array('ArgComKey'=>12345,
'Arg' => array('PIN' => 2)));
var_dump($attendance);
} catch (SOAPFault $exception) {
print $exception;
}
Here I am trying to match the XML format for the GetUserInfo
request as closely as possible.
Upvotes: 1