- Code: Select all
<?php
$wsdl = "http://www.restfulwebservices.net/wcf/StockQuoteService.svc?wsdl";
$endpoint = "http://www.restfulwebservices.net/wcf/StockQuoteService.svc";
$client = new SoapClient($wsdl, array('location'=>$endpoint,
'trace'=>1,
'exceptions'=>0));
$value = $client->GetStockQuote('IBM');
print "<pre>\n";
print "<br />\n Request : ".htmlspecialchars($client->__getLastRequest());
print "<br />\n Response: ".htmlspecialchars($client->__getLastResponse());
print "</pre>";
?>
Here's the output:
- Code: Select all
Request : <?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.restfulwebservices.net/ServiceContracts/2008/01"><SOAP-ENV:Body><ns1:GetStockQuote/></SOAP-ENV:Body></SOAP-ENV:Envelope>
Response: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</faultcode><faultstring xml:lang="en-US">Object reference not set to an instance of an object.</faultstring><detail><ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><HelpLink i:nil="true"/><InnerException i:nil="true"/><Message>Object reference not set to an instance of an object.</Message><StackTrace> at GOTLServices.ServiceImplementation.StockQuoteService.GetStockQuote(String symbol)
at SyncInvokeGetStockQuote(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace><Type>System.NullReferenceException</Type></ExceptionDetail></detail></s:Fault></s:Body></s:Envelope>
For testing purposes we installed soapui to test this as well. It works just fine when we put 'IBM' in the request. However it's also a .NET client.
Any help would be greatly appreciated.

