Soap problems connecting to .NET server

General discussion on Zend Server for IBM System i

Soap problems connecting to .NET server

Postby deathcomp on Wed Mar 21, 2012 4:16 pm

So we are just starting to learn how to use soap with php. So I'm pretty new with this. We decided to consume a simple stock quote web service to start with because it was very simple. However, we are getting an error and from what I read it's a problem with php/soap talking to .NET soap servers. Anyone get this error and figure out a solution?

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)&#xD;
   at SyncInvokeGetStockQuote(Object , Object[] , Object[] )&#xD;
   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp; outputs)&#xD;
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc&amp; rpc)&#xD;
   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.
deathcomp
 
Posts: 30
Joined: Mon Feb 13, 2012 5:17 pm

Re: Soap problems connecting to .NET server

Postby timo_karvinen on Mon May 14, 2012 10:33 am

Actually SoapUI is Java program, not .NET.

About your actual problem, I'm not sure about the cause of that, but when I was starting out with SOAP Web Services and I had problems with getting everything right agains .NET services/clients I went with NuSOAP toolkit because regular PHP Soap didn't seem to work very well in those situations.

Maybe you should try it out:
http://sourceforge.net/projects/nusoap/

-Timo
timo_karvinen
 
Posts: 74
Joined: Wed Aug 12, 2009 7:58 am
Location: Tampere, Finland


Return to Zend Server for IBM i

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest