By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,395 Members | 2,505 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,395 IT Pros & Developers. It's quick & easy.

Configuration error in web.config while accessing SOAP webservice

P: n/a
Hi all,

I am creating a webservice to accept SOAP messages, parse the
message and send a SOAP response back to the client accessing my web service
using WSE-2 in ASP.NET.
I am creating a class which derives from "SoapReceiver" class and
do the processing here. To register this class by using the HTTP protocol, I
am editing the "web.config" file. I am adding an "add" element to this config
file as follows:
<httpHandlers>
<add verb="*" path="MyReceiver.ashx"
type="CodeService.HttpService"/>
</httpHandlers>

Here "HttpService" is the class I have created in "CodeService" namespace.
Also I am adding a "configSections" element to the "configuration" section of
the "web.config" file to add microsoft.web.services2 configuration section.

When I try accessing this webservice from a browser say like
"http://localhost/CodeService/CodeWebService.asmx", I get an error

Parser Error Message: Could not load type CodeService.HttpService from
assembly System.Web, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a.

Could anyone please let me know where I am going wrong?

Thanks,
kaush
Nov 23 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
The type field needs the assembly name as well as the namespace and
class name

Try

<add verb="*" path="MyReceiver.ashx" type="CodeService.HttpService,
myassemblyname"/> (change myassemblyname to whatever your assemblies
name is)

Peter Kelcey

Nov 23 '05 #2

P: n/a
Hey Peter,

Thanks for the information. But still not working. I
changed the "add" element section as follows:

<add verb="*" path="*.ashx"
type="SOAPSERVEMON.HttpService,Microsoft.Web.Servi ces2, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

Not sure where I am going wrong.
Some more information on my "HttpService" class. I have defined it in
"SOAPSERVEMON" namespace. The class derives from the WSE's "SoapService"
class which is found in "Microsoft.Web.Services2.Messaging".

Any clue where I am going wrong.

kaushik


"Peter Kelcey" wrote:
The type field needs the assembly name as well as the namespace and
class name

Try

<add verb="*" path="MyReceiver.ashx" type="CodeService.HttpService,
myassemblyname"/> (change myassemblyname to whatever your assemblies
name is)

Peter Kelcey

Nov 23 '05 #3

P: n/a
Kaush

You need to specify your assembly, not the Microsoft assembly

Example

I create a new class called HttpService, derive it from the
Microsoft.Web.Services2.Messaging.SoapReceiver class.
My new class is in namespace SOAPSERVEMON.
The project that I've got this class in is configured to create an
assembly called asynctest.dll (You can check your assembly name by
right clicking on the project, selecting properties and looking at the
"general" section under the "common properties" folder.

Now, in order to use this class, I would add the following section to
my web.config

<httpHandlers>
<add verb="*" path="mytest.ashx" type="SOAPSERVEMON.HTTPService,
asynctest"/>
</httpHandlers>

As you can see, you need to specific the assembly that contains your
new class, not the existing Microsoft assembly that holds the Services2
classes.

The only thing you need to watch for at this point is that your project
doesn't have a root namespace. If it does, then you will need to
include that root namespace in you web.config as well.

Example

<httpHandlers>
<add verb="*" path="mytest.ashx"
type="projectrootnamespace.SOAPSERVEMON.HTTPServic e, asynctest"/>
</httpHandlers>

If done this in a quick little application I through together and it
compiles and runs fine.

Hope that helps.

Peter Kelcey

Nov 23 '05 #4

P: n/a
Hi Peter,

Thanks a lot. That was really helpful. And it worked. I am
very new to Web Service. So bit struggling.

Thanks again.
kaush

"Peter Kelcey" wrote:
Kaush

You need to specify your assembly, not the Microsoft assembly

Example

I create a new class called HttpService, derive it from the
Microsoft.Web.Services2.Messaging.SoapReceiver class.
My new class is in namespace SOAPSERVEMON.
The project that I've got this class in is configured to create an
assembly called asynctest.dll (You can check your assembly name by
right clicking on the project, selecting properties and looking at the
"general" section under the "common properties" folder.

Now, in order to use this class, I would add the following section to
my web.config

<httpHandlers>
<add verb="*" path="mytest.ashx" type="SOAPSERVEMON.HTTPService,
asynctest"/>
</httpHandlers>

As you can see, you need to specific the assembly that contains your
new class, not the existing Microsoft assembly that holds the Services2
classes.

The only thing you need to watch for at this point is that your project
doesn't have a root namespace. If it does, then you will need to
include that root namespace in you web.config as well.

Example

<httpHandlers>
<add verb="*" path="mytest.ashx"
type="projectrootnamespace.SOAPSERVEMON.HTTPServic e, asynctest"/>
</httpHandlers>

If done this in a quick little application I through together and it
compiles and runs fine.

Hope that helps.

Peter Kelcey

Nov 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.