Jump to content

soap error


homer.j.simpson

Recommended Posts

<?php $client = new SoapClient("http://services.aonaware.com/DictService/DictService.asmx?WSDL"); $client->define('hello'); ?>
I've been trying to access funtion from particular soap server using above code with no luck. I still can't overcome this error.
Fatal error: Uncaught SoapFault exception: [soap:Client] System.Web.Services.Protocols.SoapException: Parameter not specified (null) Parameter name: word at Utility.RaiseSoapException.Raise(String uri, String webServiceNS, String errorMessage, ExceptionSource source) at DictService.DictService.ProcessEndMethod(IAsyncResult call) at DictService.DictService.EndDefine(IAsyncResult call) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\scrap\phpdesigner_tmp.php:6 Stack trace: #0 [internal function]: SoapClient->__call('define', Array) #1 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\scrap\phpdesigner_tmp.php(6): SoapClient->define('hello') #2 {main} thrown in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\scrap\phpdesigner_tmp.php on line 6
this is the function list which i got through __getFunctions
(0)ServerInfoResponse ServerInfo(ServerInfo $parameters) (1)DictionaryListResponse DictionaryList(DictionaryList $parameters) (2)DictionaryListExtendedResponse DictionaryListExtended(DictionaryListExtended $parameters) (3)DictionaryInfoResponse DictionaryInfo(DictionaryInfo $parameters) (4)DefineResponse Define(Define $parameters) (5)DefineInDictResponse DefineInDict(DefineInDict $parameters) (6)StrategyListResponse StrategyList(StrategyList $parameters) (7)MatchResponse Match(Match $parameters) (8)MatchInDictResponse MatchInDict(MatchInDict $parameters) (9)string ServerInfo() (10)ArrayOfDictionary DictionaryList() (11)ArrayOfDictionary DictionaryListExtended() (12)string DictionaryInfo(string $dictId) (13)WordDefinition Define(string $word) (14)WordDefinition DefineInDict(string $dictId, string $word) (15)ArrayOfStrategy StrategyList() (16)ArrayOfDictionaryWord Match(string $word, string $strategy) (17)ArrayOfDictionaryWord MatchInDict(string $dictId, string $word, string $strategy) (18)string ServerInfo() (19)ArrayOfDictionary DictionaryList() (20)ArrayOfDictionary DictionaryListExtended() (21)string DictionaryInfo(string $dictId) (22)WordDefinition Define(string $word) (23)WordDefinition DefineInDict(string $dictId, string $word) (24)ArrayOfStrategy StrategyList() (25)ArrayOfDictionaryWord Match(string $word, string $strategy) (26)ArrayOfDictionaryWord MatchInDict(string $dictId, string $word, string $strategy)
the one in bold is the function which i'm trying to use. can anyone point out my mistake? thanks in advance
Link to comment
Share on other sites

Not so familiar with SOAP, but you may want to try capitalising the function as it appears in the function list

<?php$client = new SoapClient("http://services.aonaware.com/DictService/DictService.asmx?WSDL");$client->Define('hello');?>

Link to comment
Share on other sites

If you are trying all this in your code, try building everything using soapUI (free, open-source download), it was a great help to me with the recent web service marathon I ran for the last 4 months for a recent project. If you can get it to run in this tool, then you should be able to translate it into what ever language you are using (php in this case). This is a must have tool for web service development, IMO.

Link to comment
Share on other sites

If you are trying all this in your code, try building everything using soapUI (free, open-source download), it was a great help to me with the recent web service marathon I ran for the last 4 months for a recent project. If you can get it to run in this tool, then you should be able to translate it into what ever language you are using (php in this case). This is a must have tool for web service development, IMO.
Its not my service. I'm trying to use other's which is dictionary. thanks for ur response.
Link to comment
Share on other sites

This could be a bug with PHP's SOAP extension. Try it with the latest PHP 5.2 snapshot, and if it still occurs, report it.I tried sending a request with Stylus Studio, and it was completed successfully, so this means that PHP's SOAP implementation is either buggy somewhere or misses a SOAP/WSDL feature this service requires.In the meantime, you may try to use their alternative methods such as the GET method. The only thing it really requires you to do is to open a specific URL and parse the XML from it. Something like:

<?php$query = 'hello';$word = new DOMDocument;$word->load('http://services.aonaware.com/DictService/DictService.asmx/Define?word=' . $query);header('Content-type: application/xml');echo $word->saveXML();?>

Note that the XML is a little different than the one SOAP receives.

Link to comment
Share on other sites

Its not my service. I'm trying to use other's which is dictionary. thanks for ur response.
It doesn't need to be your service - in fact that is the purpose of the application. When you define the web service it will automatically break it down for you so that you can review all the details. Maybe seeing it from another angle might help you realize the issue you are having.
Link to comment
Share on other sites

can u explain what do u mean by different?thanks for the code. :)
Well, according to the human readable documentation for the Define() function, the XML you get with SOAP is:
	<DefineResponse xmlns="http://services.aonaware.com/webservices/">	  <DefineResult>		<Word>string</Word>		<Definitions>		  <Definition>			<Word>string</Word>			<Dictionary xsi:nil="true" />			<WordDefinition>string</WordDefinition>		  </Definition>		  <Definition>			<Word>string</Word>			<Dictionary xsi:nil="true" />			<WordDefinition>string</WordDefinition>		  </Definition>		</Definitions>	  </DefineResult>	</DefineResponse>

And with the GET method, the XML is:

<WordDefinition xmlns="http://services.aonaware.com/webservices/">  <Word>string</Word>  <Definitions>	<Definition>	  <Word>string</Word>	  <Dictionary>		<Id>string</Id>		<Name>string</Name>	  </Dictionary>	  <WordDefinition>string</WordDefinition>	</Definition>	<Definition>	  <Word>string</Word>	  <Dictionary>		<Id>string</Id>		<Name>string</Name>	  </Dictionary>	  <WordDefinition>string</WordDefinition>	</Definition>  </Definitions></WordDefinition>

The first (and acutally, so far the only significant) difference I see is that the root element is different.

Link to comment
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...