Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / November 2004

Tip: Looking for answers? Try searching our database.

Can We Create one WebService and call Both way Http & Soap.TCP

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MrDotNet - 17 Nov 2004 18:01 GMT
I want know can we create one webservice and call both way Http and soap.tcp
if any one know so pls let me know with code.

Thanks
Signature

-MrDotNet MCAD, MCSD
Sr. Software Engineer / Lead Architect

Drew Marsh - 17 Nov 2004 18:52 GMT
> I want know can we create one webservice and call both way Http and
> soap.tcp  if any one know so pls let me know with code.

Absolutely!

With WSE you just make sure to write your web service class as a standalone assembly (i.e. not a web project). Next step is to derive your service class from WSE's SoapService. Finally, you write all your web methods like you normally would using WSE.

As for hosting, if you want to host using soap.tcp you write a lightweight host application (console, winforms, winservice) and do the following (simple logic just for illustration purposes):

SoapReceivers.Add(new EndpointReference(new Uri("soap.tcp://<your hostname or ip>/MyService")), typeof(MyService));

For hosting in ASP.NET, all you need to do is add the following entries to a web.config:

<!-- add this to register the WSE 2.0 section handler -->
<configuration>
 <configSections>
   <section name="microsoft.web.services2" type="Microsoft.Web.Services2.Configuration.WebServicesConfiguration, Microsoft.Web.Services2, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
 </configSections>
</configuration>

<!-- then add this to register your service -->
<httpHandlers>
 <add verb="*" path="MyService.ashx" type="WhateverYourNamespaceIs.MyService, WhateverYourAssemblyNameIs"/>
</httpHandlers>

One class. Any protocol. Nice, right? Great design on WSE's part.

HTH,
Drew
EP - 17 Nov 2004 18:55 GMT
what about the proxy?

The XXServiceWse classes generated by WSE2.0 don't support "tcp://" prefix.
Is there a way to do this?

> > I want know can we create one webservice and call both way Http and
> > soap.tcp  if any one know so pls let me know with code.
>
> Absolutely!
>
> With WSE you just make sure to write your web service class as a standalone assembly (i.e. not a web project). Next step is to derive your
service class from WSE's SoapService. Finally, you write all your web
methods like you normally would using WSE.

> As for hosting, if you want to host using soap.tcp you write a lightweight host application (console, winforms, winservice) and do the following
(simple logic just for illustration purposes):

> SoapReceivers.Add(new EndpointReference(new Uri("soap.tcp://<your hostname or ip>/MyService")), typeof(MyService));
>
[quoted text clipped - 4 lines]
>   <configSections>
>     <section name="microsoft.web.services2" type="Microsoft.Web.Services2.Configuration.WebServicesConfiguration,
Microsoft.Web.Services2, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" />
>   </configSections>
> </configuration>
[quoted text clipped - 8 lines]
> HTH,
> Drew
Drew Marsh - 17 Nov 2004 20:21 GMT
> what about the proxy?
>
> The XXServiceWse classes generated by WSE2.0 don't support "tcp://"
> prefix. Is there a way to do this?

I assume you're talking about proxies generated by WSDL2.exe?? If so, yes you're pretty much out of luck using that tool since it creates subclasses of WebServicesClientProtocol (which is bound specifically to HTTP). Therefore you end up having to hand roll your own proxies when using the soap.tcp protocol.  You just subclass SoapClient and provide method signatures that mimic your web methods decorated with the proper attributes.

It's not *that* hard, but you shouldn't have to do it. I guess they went with the 80/20 which is most people will be using HTTP.

HTH,
Drew
MrDotNet - 17 Nov 2004 21:07 GMT
So main problem is I have one web service and that web service works
internal and external too. if I use HTTP then its slow I dnot slow internal
that why I want that call soap.tcp.

> > what about the proxy?
> >
[quoted text clipped - 7 lines]
> HTH,
> Drew

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.