views:

46

answers:

1

Hey All,

My team and I are working against a few webservices that require SOAP Message Headers to be available when making a request. We are not in control of these webservices so we can't change the implementation, even if we wanted to (or at least not without a lot of pain). We just need to be able to have authentication related information & a couple of other items passed through our message headers.

I've read of a few people who've had this problem in the past with no clear indication on if they succeeded in pulling it off on Monotouch.

Here's what I've read: http://forums.monotouch.net/yaf_postsm2104.aspx so far.

Any ideas on what we can do to overcome this on the Monotouch framework?

Here's what i'm trying to do for now:

        using (var scope = new OperationContextScope (client.InnerChannel)) 
        {
            client.GetHistories += handler;
            OperationContext.Current.OutgoingMessageHeaders.Add (MessageHeader.CreateHeader ("EnvironmentInfo", "http://schemas.contoso.com", 
                                                                 ServiceContext.Current.OperatingEnvironment));
            OperationContext.Current.OutgoingMessageHeaders.Add (MessageHeader.CreateHeader ("AuthenticationToken", "http://schemas.contoso.com", 
                                                                 ServiceContext.Current.Token));

            client.GetHistoriesAsync (ServiceContext.Current.OperatingEnvironment, ServiceContext.Current.Token, request);
        }

Thanks for your time.

JM

A: 

I was not able to get Message Headers to work with WCF in Mono 2.6. I tried several different ways (including how you do it in your example) - it just doesn't work in Mono 2.6.

I raised a bug for this, which I then closed after discovering it is fixed in the latest trunk. So if you run against Mono 2.7 or greater, this should work.

TheNextman
I should have added - you should try writing a regular web services client rather than using WCF. I would expect it to work in that case. WCF is missing lots and has lots of bugs in the current Mono release.
TheNextman
That's absolutely what I ended up doing. I had suspected that the way to go about this was to generate the proxy using wsdl.exe and in the 11th hour, I found a resource that confirmed that it was very much possible.Check it out at: http://msdn.microsoft.com/en-us/library/ms751433.aspxI hope this helps anyone else that stumbles into this problem.Happy coding.
John Mathews