orikon117 Posted November 10, 2009 Share Posted November 10, 2009 I am trying to get a simple SOAP request working but I keep getting this error: Fatal error: Uncaught SoapFault exception: [soap:Server] Server was unable to process request. ---> Object reference not set to an instance of an object. Basically, I should be able to send my credentials to the web service and get the version information of their system. Here is my code, I am using the built-in PHP5 SOAP functions. The error is on the line with $result = $client->About($params); <?php $client = new SoapClient("http://XXXXXX.asmx?WSDL"); $params = array( 'sUserName' => 'string', 'sCompanyName' => 'string', 'sPassword' => 'string' ); $result = $client->About($params); ?> Here is the WSDL Request I need to send: <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <About xmlns="http://XXXXX"> <oCredentials> <sUserName>string</sUserName> <sCompanyName>string</sCompanyName> <sPassword>string</sPassword> </oCredentials> </About> </soap:Body> </soap:Envelope> Here is the response: <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <AboutResponse xmlns="XXXXX"> <AboutResult> <sProdName>string</sProdName> <sVersion>string</sVersion> <sBuild>string</sBuild> <sCopyright>string</sCopyright> </AboutResult> </AboutResponse> </soap:Body> </soap:Envelope> The section in the WSDL file: <s:element name="About"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="oCredentials" type="tns:Credentials"/> </s:sequence> </s:complexType> </s:element> <s:complexType name="Credentials"> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="sUserName" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="sCompanyName" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="sPassword" type="s:string"/> </s:sequence> </s:complexType> <s:element name="AboutResponse"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="AboutResult" type="tns:CAbout"/> </s:sequence> </s:complexType> </s:element> <s:complexType name="CAbout"> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="sProdName" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="sVersion" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="sBuild" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="sCopyright" type="s:string"/> </s:sequence> </s:complexType> I have also tried other things like $result = $client->About->oCredentials($params); Any help would be greatly appreciated. Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/180937-need-help-with-simple-soap-request/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.