I'm trying to write a WCF wrapper web service for a WSE3/ASMX web service. [The ugly reason why is that a 3rd party vendor won't support SSL and that is what's needed for BizTalk 2009 WCF adapter to work with WS-Security. So if the vendor doesn't change - I need to call a local WCF web service...]
I followed this article to get the WSE3 proxy-builder built-in to VS2008: http://blogs.imeta.co.uk/jyoung/archive/2008/08/29/345.aspx I make a web reference to the vendor's .asmx remote web service.
I build and publish my webservice locally, and just try to bring it up in the browser, and get this error:
System.InvalidOperationException: An exception was thrown in a call to a WSDL export extension: System.ServiceModel.Description.DataContractSerializerOperationBehavior contract: http://tempuri.org/%3AIValuationService ----> System.Runtime.Serialization.InvalidDataContractException: Type 'Microsoft.Web.Services3.Addressing.Address' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. See the Microsoft .NET Framework documentation for other supported types.
How can I make an object that I didn't write ('Microsoft.Web.Services3.Addressing.Address') serializeable? Is it possible to accomplish what I am trying?
Thanks,
Neal Walters
Additional Info - Monday Nov 16, 2009:
[ServiceContract]
public interface IValuationService
{
[OperationContract]
ExpressLync.ValuationServiceWse GetPropertyInfoSourceRecordPolicyNum(string PolicyNumber);
}
// end of interface
// here is part of reference.cs...
public partial class ValuationServiceWse : Microsoft.Web.Services3.WebServicesClientProtocol {
...
The only place I can find any reference what-so-ever to 'Microsoft.Web.Services3.Addressing.Address' is here, on the metadata when I do a "go to definition" of the Microsoft.Web.Services3.WebServicesClientProtocol
using Microsoft.Web.Services3.Addressing;
using Microsoft.Web.Services3.Design;
using System;
using System.Net;
using System.Web.Services.Protocols;
using System.Xml;
namespace Microsoft.Web.Services3
{
public class WebServicesClientProtocol : SoapHttpClientProtocol
{
public WebServicesClientProtocol();
public EndpointReference Destination { get; set; }
public Pipeline Pipeline { get; set; }
public SoapContext RequestSoapContext { get; }
public bool RequireMtom { get; set; }
public SoapContext ResponseSoapContext { get; }
public string Url { get; set; }
public bool UseDefaultCredentials { get; set; }
public TSecurityToken GetClientCredential<TSecurityToken>() where TSecurityToken : Microsoft.Web.Services3.Security.Tokens.SecurityToken;
protected override XmlReader GetReaderForMessage(SoapClientMessage message, int bufferSize);
public TSecurityToken GetServiceCredential<TSecurityToken>() where TSecurityToken : Microsoft.Web.Services3.Security.Tokens.SecurityToken;
protected override WebRequest GetWebRequest(Uri uri);
protected override WebResponse GetWebResponse(WebRequest request);
protected override WebResponse GetWebResponse(WebRequest request, IAsyncResult result);
protected override XmlWriter GetWriterForMessage(SoapClientMessage message, int bufferSize);
public void SetClientCredential<TSecurityToken>(TSecurityToken clientToken) where TSecurityToken : Microsoft.Web.Services3.Security.Tokens.SecurityToken;
public void SetPolicy(Policy policy);
public void SetPolicy(string policyName);
public void SetServiceCredential<TSecurityToken>(TSecurityToken serviceToken) where TSecurityToken : Microsoft.Web.Services3.Security.Tokens.SecurityToken;
}
}
So in other words, how do I get rid of 'Microsoft.Web.Services3.Addressing.Address'? It seems that EndpointReference is in the 'Microsoft.Web.Services3.Addressing.Address' object. So if I use the WSE3 generated code, it tries to serialize it.
So I think the solution will be to write yet another wrapper that is WSE3 free - and expose it via WCF. But the trick is that the vendors web services has numerous large and complex objects - which now all inherit from Microsoft.Web.Services3.WebServicesClientProtocol (since I'm using the WS3 code generator). I really don't want to manually build all of them again. In the example above, "ValuationService" is just one of such objects.