SOAP Authorization

M

Markus Mayer

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/axis/servlet/ServiceOverviewServlet <

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/axis/services/ServiceOverview?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.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)
at
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at
Test.de.uni_leipzig.wortschatz.ServiceOverviewService.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.cs: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.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext
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:[email protected]...
without success.

Can anyone help me out with this?
Best regards,
Markus
 
C

Chan Ming Man

You are using "servlet" I realized. So what web server are you using? IIS?
If you not using IIS then I think it is a bit hard for VS to handle it.

chanmm

Markus Mayer said:
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/axis/servlet/ServiceOverviewServlet <

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/axis/services/ServiceOverview?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.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)
at
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at
Test.de.uni_leipzig.wortschatz.ServiceOverviewService.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.cs: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.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext
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:[email protected]...
without success.

Can anyone help me out with this?
Best regards,
Markus
 
M

Markus Mayer

Chan Ming Man, 22.12.2006 11:42:
You are using "servlet" I realized. So what web server are you using?
IIS? If you not using IIS then I think it is a bit hard for VS to handle
it.

Hi,

It is not /my/ server, but as far as I know, it is driven by Java (on
Apache - but this is an assumption).

Regards,
Markus
 
R

Ronald Siegel

Hi,


Am Thu, 21 Dec 2006 19:38:27 +0100 schrieb Markus Mayer:
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/axis/servlet/ServiceOverviewServlet <

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/axis/services/ServiceOverview?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);
}
}
}

[...]

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:[email protected]...
without success.

Can anyone help me out with this?
Best regards,
Markus

look at this:
http://mark.michaelis.net/Blog/default.aspx?month=2005-03
and don't forget
http://forums.microsoft.com/msdn/showpost.aspx?postid=112770&siteid=1

Best regards
Ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top