UPDATE:
The custom WCF binding implementation discussed below in comments is already available at https://www.rebex.net/getfile/b541b39f9c334407b148786cd6fbdbc4/RebexWcfBinding.zip
You can use it like this:
new MyServiceClient(new WcfBinding(), new EndpointAddress("https://..."))
To configure various properties, use WcfBinding.RequestCreator
property.
Original answer:
Hello,
you are right. The problem is caused by impossibility to cast Rebex class HttpRequest
into system class HttpWebRequest
.
Unfortunately, the HttpWebRequest
class on .NET CF has no public or protected constructor, so we cannot derive from it. We can derive only from WebRequest
class.
Also the HttpChannelFactory
class is written in a way it can use HttpWebRequest
class only.
We are not familiar with WCF, but I used to create some Web References. There you get a partial class XyzService, which inherits from System.Web.Services.Protocols.SoapHttpClientProtocol
. Using partial keyword, you can simply reimplement some functionality which remains unchanged even when you recreate the web reference.
Try to look at some way to reimplement CFClientBase1.Invoke
or CFClientBase1.getReply
or RequestChannel.Request
or inject your implementation of HttpChannelFactory
which doesn't require HttpWebRequest
class only or something similar.
For example in my VB.NET project I do similar this way:
Partial Public Class MyService
Protected Overrides Function GetWriterForMessage(message As SoapClientMessage, bufferSize As Integer) As XmlWriter
' inject code for signing the request here
Return New SigningXmlTextWriter(MyBase.GetWriterForMessage(message, bufferSize))
End Function
End Class
I implemented SigningXmlTextWriter
class to sign the SOAP request message with an X509 certificate.
If you send us your project at support@rebex.net (so we can reproduce the issue) we will look at it and hopefully find a solution to solve this issue.