Groups | Blog | Home
all groups > dotnet web services > june 2007 >

dotnet web services : WSHttpBinding in WCF



DanM
6/27/2007 8:40:03 AM
Hi,

If I have a WCF web service deployed that uses the WSHttpBinding, is it
possible for a web service client to connect to my service if that client
does not support WS-Addressing, or is WS-Addressing mandatory when the
WSHttpBinding is in use?

Many thanks,
stcheng NO[at]SPAM online.microsoft.com
6/28/2007 2:47:45 AM
Hi Dan,

As for the WCF binding's WS-Addressing feature, it does be configurable.
Actually, it is controlled at the transport layer through the "MappingMode"
property of the HttpTransportBindingElement and you set it to
"HttpMappingMode.Soap"(By default, the HttpTransportBindingElement in
WSHttpBinding set it to "HttpMappingMode.SoapWithWsAddressing" which will
add WS-Addressing feature. The following article has mentioned this:

http://wcf.netfx3.com/content/WindowsCommunicationFoundationWCFInteroperabil
ityandMigrationwithWSE20.aspx

However, currently since WSHttpBinding is a well encapsulated one, if you
do need to customize this WS-Addressing feature, I suggeset you create a
custom binding in which you can customize the inner bindingElements(such as
adjust the properties on the HttpTransportBindingElement). Here is the MSDN
document introducing this:

#Creating User-Defined Bindings
http://msdn2.microsoft.com/en-us/library/ms733893.aspx

In addition, here is another article mentioned customizing WCF binding
which can also give you some ideas on this:

http://www.pluralsight.com/blogs/aaron/archive/2006/04/18/21943.aspx

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


DanM
6/28/2007 8:46:02 AM
Hi Steven,

Thanks for the advice. I had thought that the MappingMode property you
mentioned was just for WCF clients, but if it can be used on a WCF service as
well thats good.

Unfortunately, I cant get the MappingMode property to be accepted by the
compiler. The 3rd example URI you sent shows this for a WCF client, but when
I try it the compiler says its not a valid property.

There is no mention of the property in the MSDN doc for the
HTTPTransportBindingElement here.

http://msdn2.microsoft.com/en-us/library/system.servicemodel.channels.httptransportbindingelement_properties.aspx

and when I try to compile the following 2 lines of code, I get the compiler
errors shown below:

HttpTransportBindingElement httpElement =
(HttpTransportBindingElement)be;
httpElement.MappingMode = HttpMappingMode.Soap;


Done building target "CoreCompile" in project "WCFServiceLibrary1.csproj" --
FAI
LED.

Done building project "WCFServiceLibrary1.csproj" -- FAILED.

Build FAILED.
App_Code\WCFService2.cs(49,33): error CS0117:
'System.ServiceModel.Channels.Http
TransportBindingElement' does not contain a definition for 'MappingMode'
App_Code\WCFService2.cs(49,47): error CS0103: The name 'HttpMappingMode'
does not exist in the current context
0 Warning(s)
2 Error(s)


Is there any documentation you can point me at that shows how to do this, or
have I missed something?

Thanks, Dan

--------------------------------------------------------------------------------------

[quoted text, click to view]
stcheng NO[at]SPAM online.microsoft.com
7/2/2007 11:47:10 AM
Hi Dan,

Thanks for your reply and pointed out this issue.

After some further checking and I found that this
setting(HttpTransportBindingElement.MappingMode and HttpMappingMode) has
been obsoleted in the release version. And with some further research, I've
found the current corresponding setting for define the message addressing
feature of the WCF binding. You can use the
"TextMessageEncodingBindingElement.MessageVersion" to specify the
Addressing information(it contains some predefined values such as SOAP11,
SOAP11WSAddressing10 .....)

#TextMessageEncodingBindingElement Members
http://msdn2.microsoft.com/en-us/library/system.servicemodel.channels.textme
ssageencodingbindingelement_members.aspx

Also, here are some msdn reference mentioned customize binding element(such
as the TextMessageEncoding element):

#How to: Configure WCF Services to Interoperate with WSE 3.0 Clients
http://msdn2.microsoft.com/en-us/library/ms730049.aspx

#WCF Messaging Fundamentals
http://msdn.microsoft.com/msdnmag/issues/07/04/ServiceStation/default.aspx

Hope this helps and sorry for the previous confusion.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


stcheng NO[at]SPAM online.microsoft.com
7/4/2007 2:44:49 PM
Hi Dan,

How are you doing? Just want to check whether you've got any further
progress or does the further information in my last reply helps some? If
there is anything else we can help, please don't hesitate to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


DanM
7/5/2007 2:48:01 AM
Hi Steven,

We are trying out your suggestions this week. I will update this again to
let you know whether we got it working.

Thanks, Dan

[quoted text, click to view]
stcheng NO[at]SPAM online.microsoft.com
7/6/2007 1:31:22 AM
Thanks for your reply Dan,

Looking forward to your good news.


Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


AddThis Social Bookmark Button