Search Web Service : System.ArgumentNullException
Hi, I'm having trouble with search web services :
We have an application that was built on Sharepoint 2003 web services. It still works for one of our MOSS 2007 server, but not on the other one :
<ResponsePacket xmlns="urn:Microsoft.Search.Response">
<Response domain="">
<Status>ERROR_SERVER</Status>
<DebugErrorMessage>System.ArgumentNullException</DebugErrorMessage>
</Response></ResponsePacket>
Query:
SELECT "DAV:getcontentlength", "DAV:getcontenttype", "DAV:getlastmodified", "DAV:href", "urn: schemas-microsoft-com: office: office#Author", "urn: schemas.microsoft.com:fulltextqueryinfo: description", "urn: schemas.microsoft.com:fulltextqueryinfo: displaytitle"
FROM ( TABLE Portal_Content..Scope() )
WHERE (( (Contains("ALL",'"ECIS*"')) ) ) ORDER BY "urn: schemas.microsoft.com:fulltextqueryinfo:rank" DESCWeb services are activated, authentication is validated. We get this error after submitting the query.
Any idea ?
Thanks!
Hi Everyone,
I've got the same error. I tested the same code, from the same machine (changing the web reference) to another sharepoint server (in dev env) and it worked fine. Please let me know any ideas.
Thanks!!!!
Hugo Martinez Granada (::HMG:
After working on the problem, I figured that the problem is related with the FQN (Fully Qualified Name). When I send the query to the query service using the server name <server.mydomain.com> i got the exception but when i send the query to the queryservice using only the server name <server> it works fine.
I think this is related with MOSS in how you include your servers in the server farm. Please post so we can complete this case.
Hugo Martinez Granada ( ::HMG:: )
http://www.xpait.com
XPAIT Ltda.
Could you share your query XML? I'd like to take a look.
Thanks,
Ki
KI,
The XML is:
private static string prepareWordQuery(string wordQuery)
{
string query = "<QueryPacket xmlns='urn:Microsoft.Search.Query'> " +
"<Query>" +
"<QueryId />" +
"<SupportedFormats>" +
"<Format revision='3'>" +
"urn:Microsoft.Search.Response.Document
ocument" +
"</Format>" +
"</SupportedFormats>" +
"<Context>" +
"<QueryText language='ES' type='STRING'>" +
wordQuery +
"</QueryText>" +
"</Context>" +
"</Query>" +
"</QueryPacket>";
return query;
}
KI,
The XML is:
private static string prepareWordQuery(string wordQuery)
{
string query = "<QueryPacket xmlns='urn:Microsoft.Search.Query'> " +
"<Query>" +
"<QueryId />" +
"<SupportedFormats>" +
"<Format revision='3'>" +
"urn:Microsoft.Search.Response.Document: Document" +
"</Format>" +
"</SupportedFormats>" +
"<Context>" +
"<QueryText language='ES' type='STRING'>" +
wordQuery +
"</QueryText>" +
"</Context>" +
"</Query>" +
"</QueryPacket>";
return query;
}
Note that this is the XML found in the Microsoft page that explains how to use the QueryService. For MOSS see http://msdn2.microsoft.com/en-us/library/ms497054.aspx and for Services 3.0 see http://msdn2.microsoft.com/en-us/library/ms774561.aspx
Complementing my previous post, you have to be careful adding the Web Service Reference in Visual Studio 2005. When you use Sharepoint Services 3.0 the is no much problem but when using MOSS 2007 with a personalized web application configuration (creation of new web application in other ports than 80) you must add the Web Reference using WSDL word, for example:
http://sharepointserver:1311/portals/principal/_vti_bin/search.asmx?WSDL
Another thing to have in mind is that you must choose which service you want to use (choosing between spsearch.asmx or search.asmx). Although the both have the QueryService Object and in design time you would have a successful compilation, in execution time you will have a soap exception.
Hope this helps KI.
Hugo Martinez Granada ( ::HMG:: )
http://www.xpait.com
XPAIT Ltda.
Thanks. I didn't understand what you mean about the FQN (Fully Qualified Name) in one of your previous e-mails, e.g. <server.mydomain.com>. Where is the tag?
Thanks,
Ki
Hi,
Even i am running into same problem............! i have tried all the suggestions but still not able to resolve the problem.
Please could any one place the actual code....:-( i am running out of time .Your help will be most valuable.
if you could email code it would be of great help honey008@gmail.com.
Thanks Hugo. It helped a lot. It's working now. 
Our test server is on a sub-domain. With the IP: credentials were validated but the search returned the (very valuable) error message "System.ArgumentNullException".
Our other test server is on the same domain, we have used the hostname at first and it worked.
I have updated the hosts file, and it is now working on both of them, using the server name. We get the same error when using the IP.
The error message returned by the web service DOES NOT make any sense. This has to be improved or (at least) documented.
Authentication works with the IP, search fails. If both were not working, we would probably have investigated in this direction.