Your problem is that JAX-WS doesn't support the same WS protocols that are used in the wsHttpBinding. You need to use WSIT instead. WSIT is available as part of the Metro library, which is also available on Glassfish.
I recommend using wsHttpBinding or ws2007HttpBinding where possible, but you can still do a fairly secure service with basicHttpBinding over SSL/Transport Auth.
There's two things you need to consider here:
if your hosting in IIS (or WAS as part of IIS7), you cannot set a base address - the base address for your service will be the virtual directory where the MyService.svc
file lives. You can still set relative addresses, though
if you self-host, you typically will add base addresses in your config, so you can spare yourself having to spell out the entire address all the time (but you can - if you wish to do so).
So if you have your MyService.svc
inside a virtual directory called MyApp
on your localhost
machine, and then use this config:
<service name="MyService" behaviorConfiguration="Default">
<endpoint
address="wsHttp"
binding="wsHttpBinding"
contract="IMyService" />
<endpoint
address="basic"
binding="basicHttpBinding"
contract="IMyService" />
</service>
then your "old-style" basicHttp service will be reachable at:
http://localhost/MyApp/MyService.svc/basic
and your new wsHttp driven service will be reachable at:
http://localhost/MyApp/MyService.svc/wsHttp
You can name those relative addresses (anything after .../MyApp/MyService.svc
) anything you like - just make sure they're different from one another.
Hosting in IIS --> location (virtual directory) of your *.svc file becomes your base address.
If you self-host your service inside a console app or a Windows NT Service, you get to set your base addresses yourself:
<services>
<service name="MyService" behaviorConfiguration="Default">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8185/Services/" />
</baseAddresses>
</host>
</service>
</services>
Now in this case, your "old-style" basicHttp service will be reachable at:
http://localhost:8185/Services/basic
and your new wsHttp driven service will be reachable at:
http://localhost:8185/Services/wsHttp
You can define a base address for each of the transports, e.g. one for http://, one for net.tcp:// and so on.
And of course, if you really must, you can also define your complete addresses inside your <endpoint>
element for each of the service endpoints - this gives you total flexibility (but only works in self-hosting scenarios).
Marc
Best Answer
-- Ladislav Mrnka pointed me in the right direction with this. Thanks very much.
I tried to keep the question simple as I thought the answer may be straight forward. However I should have explained my set up in a little bit more detail as this is where the answer to my problem lay.
Instead of having my service contract (IMyService) residing in my WCF Service Application I had it in another Domain project where I keep all my interfaces so that they can be reused throughout many different projects. In my WCF Service Application .web.config I had the service name pointing at the interface project rather than at the implementation. This caused VS2010 (svcutil.exe) to create a proxy and config based on default settings (I presume reside in the machine.config (for WCF 4)).
So to summarise for anybody else who may come across this issue it was service name pointing to the wrong location. Ensure that the service name points to the implementation (usually in the WCF Service Application - MyProject.MyService) and that the endpoint contract points to the service contract (In the WCF Service Application or external project - MyProject.IMyService or AnotherProject.Interfaces.IMyService).
Thanks for all your help.