Hey there.
I recently stumbled upon the "Projekt Deutscher Wortschatz" (project
german vocabulary) of the Leipzig Univesity, Germany, which is somewhat
similar to Princeton's WordNet project.
The Leipzig University provides a SOAP-based web interface that is
briefly described here >
http://wortschatz.uni-leipzig.de/axi...verviewServlet <
Since I never ever used SOAP programmatically I throught it would be a
nice idea to start right away with the "ServiceOverview" function they
provide.
So I fired up VS and added the WSDL file
http://wortschatz.uni-leipzig.de/axi...eOverview?wsdl
as a web reference.
The ping method works fine, but if I execute() the class, a
SoapException is fired stating that I should provide a username.
Since there is no function for that and the Java examples show that they
are not sent as a execute() argument, I'm not sure what to do.
I found a example on the net that introduced a CredentialCache to me,
which I tried to use, without success.
By now the code looks like this:
~~ snip ~~
using System.Net;
using Test.de.uni_leipzig.wortschatz;
namespace Test
{
class Program
{
static void Main(string[] args)
{
ServiceOverviewService sos =
new ServiceOverviewService();
CredentialCache cache = new CredentialCache();
cache.Add(
new Uri(sos.Url),
"Basic",
new NetworkCredential(
"anonymous",
"anonymous"
));
cache.Add(
new Uri(sos.Url),
"Digest",
new NetworkCredential(
"anonymous",
"anonymous"
));
sos.Credentials = cache;
RequestParameter param = new RequestParameter();
param.corpus = "services"; // whatever ...
ResponseParameter response = sos.execute(param);
}
}
}
~~ snap ~~
As I said, the execute() line throws the exception:
~~ snip ~~
System.Web.Services.Protocols.SoapException was unhandled
Message="Please enter a username!"
Source="System.Web.Services"
Actor=""
Lang=""
Node=""
Role=""
StackTrace:
at
System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)
at
System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String
methodName, Object[] parameters)
at
Test.de.uni_leipzig.wortschatz.ServiceOverviewServ ice.execute(RequestParameter
objRequestParameters) in I:\dev\EigeneSources\Test.root\Test\Test\Web
References\de.uni-leipzig.wortschatz\Reference.cs:line 84
at Test.Program.Main(String[] args) in
I:\dev\EigeneSources\Test.root\Test\Test\Program.c s:line 23
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)
at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context( Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
~~ snap ~~
There are plenty of examples on this using Java or Perl, both give
username and password within a SOAP connection object's constructor -
which I don't have in VS.
I tried to add the authentication to the URL so that it is
http://anonymous:anonymous@...etc...
without success.
Can anyone help me out with this?
Best regards,
Markus