Thursday, August 17, 2017   Login
You are here: Project » Blog  
Making IWebCF work with VS 2005 (.asmx) clients
Location: BlogsIWeb    
Posted by: Michael Washington 2/18/2008 2:59 PM

When the next IWeb comes out it will be called IWebCF and you will be able to run it side by site with the current IWeb. The new IWeb uses WCF (Windows Communication Foundation) and it is completely different than the web services in the current IWeb.

The problem I faced today was allowing a client created with Visual Studio 2005 to connect with IWebCF. It is SUPPOSE to work because WCF is backward compatible... and it is... mostly. But, of course we ran into issues.

I have it working. I'm still waiting for Ian to look at my solution (it is checked into source code if you want to take a look yourself). Here are my emails to him today which describe my painful process. I'm posting it in case my notes help somone else working with WCF:


From: Michael Washington
Sent: Monday, February 18, 2008 10:59 AM
To: 'Ian Lackey'
Subject: Making IWeb work with VS 2005 (.asmx)
 
I have been trying to use VS 2005 to create a normal web service. It will create the proxy but when you try to call it you get this error:
 
Method CoreService.GetVersion cannot be reflected.
 
{"The XML element 'IWebRequest' from namespace 'http://webservices.DotNetNuke.com/2007/12/CoreService' references a method and a type. Change the method's message name using WebMethodAttribute or change the type's root element using the XmlRootAttribute."}
 
This post recommends exposing your WCF methods as a .asmx:
 
here is a good article describing the process:
 
I added the attributes and it works!
 
I just checked the code in. I did not alter the Filemanager methods because I didn’t want to mess you up so you will have to add the attributes to those.
 
I will make a version of the IWeb connector this weekend.

 


From: Michael Washington
Sent: Monday, February 18, 2008 11:25 AM
To: 'Ian Lackey'
Subject: RE: Making IWeb work with VS 2005 (.asmx)
 
Arrgg
 
It works on the .asmx side but it now throws this error on the .svc :
 
Type 'System.Web.Services.Protocols.SoapHeader' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.
 
It’s because I added “SoapHeader“ to IWebAuthenticationHeader otherwise the .asmx header would not work:
 
    Public Class IWebAuthenticationHeader
        Inherits SoapHeader
 
I
 
I tried overloading all the properties of SoapHeader but I still get the error.
 
 
If I comment the line out it works with .svc but with .asmx I get:
 
"System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.InvalidOperationException: Method CoreService.PortalsOnServer can not be reflected. ---> System.Exception: The header property/field CoreService.IWebCredentials must be of type SoapHeader or a derived type, or an array of SoapHeader or SoapUnknownHeader.\n   at System.Web.Services.Protocols.SoapReflector.ReflectMethod(LogicalMethodInfo methodInfo, Boolean client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, String defaultNs)\n   --- End of inner exception stack trace ---\n   at System.Web.Services.Protocols.SoapReflector.ReflectMethod(LogicalMethodInfo methodInfo, Boolean client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, String defaultNs)\n   at System.Web.Services.Protocols.SoapServerType..ctor(Type type, WebServiceProtocols protocolsSupported)\n   at System.Web.Services.Protocols.SoapServerProtocol.Initialize()\n   at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)\n   --- End of inner exception stack trace ---"
 
 
I also tried overloading all the properties of SoapHeader but I still get the error.
 

I commented it out for now and cheked it in again so the .svc is not broken.


From: Michael Washington
Sent: Monday, February 18, 2008 11:35 AM
To: 'Ian Lackey'
Subject: RE: Making IWeb work with VS 2005 (.asmx)

I think this may help:
 
 
I will try it this weekend. 

 


From: Michael Washington
Sent: Monday, February 18, 2008 2:57 PM
To: 'Ian Lackey'
Subject: RE: Making IWeb work with VS 2005 (.asmx)

 
I hate to email bomb you but of course I could not let this go. So I’m screwing around trying everything under the sun and this seems to work:
 
1)      Remove “SoapHeader("IWebCredentials")” from the attributes on all the methods
2) This of course causes the Headers to go away for every method except “GetUser” and “Portals on server”
3) I did more poking around and saw that those had contracts that had “Private _header As New IWebAuthenticationHeader” directly in their method parameter type. The others did not., They inherited from IWebRequest and should therefore have it but they didn’t.
4)      I removed the inheritance of IWebRequest and placed the “Private _header As New IWebAuthenticationHeader” directly in the classes
5)      Now the .asmx and the .svc works J
 
I just checked everything in. Please tell me I didn’t break something!
Permalink |  Trackback
  
Home  |  Screen Shots  |  Example Code  |  Installing  |  Download  |  Project
Copyright 2006-2009 by OpenLightGroup.net   |  Privacy Statement  |  Terms Of Use