I'm new to using SOAP and I'm having trouble getting my soap request to go through. I'm using PHP5 and I'm trying to interface with an API. I am suppose to send credential information and get a sessionID string back.
These are the chunks from the WSDL that I'm dealing with.
- <s:element name="Authenticate">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="req" type="tns:AuthenticationRequest" />
</s:sequence>
</s:complexType>
</s:element>
- <s:complexType name="AuthenticationRequest">
- <s:complexContent mixed="false">
- <s:extension base="tns:RequestBase">
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="UserName" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="CoveredPassword" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="RandomNumber" type="s:string" />
</s:sequence>
</s:extension>
</s:complexContent>
</s:complexType>
<s:complexType name="RequestBase" abstract="true" />
- <s:element name="AuthenticateResponse">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="AuthenticateResult" type="tns:AuthenticationResponse" />
</s:sequence>
</s:complexType>
</s:element>
- <s:complexType name="AuthenticationResponse">
- <s:complexContent mixed="false">
- <s:extension base="tns:ResponseBase">
- <s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="SessionID" type="s:decimal" />
<s:element minOccurs="0" maxOccurs="1" name="Method" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="TransactionID" type="s:decimal" />
<s:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="ErrorLocation" type="s:string" />
</s:sequence>
</s:extension>
</s:complexContent>
</s:complexType>
Port Type section:
<wsdl:portType name="exampleSoap">
- <wsdl:operation name="Authenticate">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Required to begin WebService session. The SessionID returned must be submitted with every Method invoked during session. The SessionID is only valid when received from the same machine the Authentication originates from.</wsdl:documentation>
<wsdl:input message="tns:AuthenticateSoapIn" />
<wsdl:output message="tns:AuthenticateSoapOut" />
</wsdl:operation>
This is the code I am using to submit the request. It seems that my values for username, etc are not formatted correctly.
[code=php]<?php
$client = new SoapClient("http://server/webservice.asmx?WSDL");
$results = $client->Authenticate(name, pw, 11);
echo $results;
?>[/code]
But I'm getting this:
Catchable fatal error: Object of class stdClass could not be converted to string in /var/www/webfiles/file.php on line 5
Any help is appreciated.
--UPDATE--
I replaced:
echo $results;
with
print_r($results);
Niow it doesn't error out and I think I am getting my response, but I'm not sure how to handle it:
stdClass Object ( ) // //