Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Cloud-hosted SOAP reference in PCL not working

$
0
0

I am trying to get a SOAP service reference working in a PCL. If I add the SOAP service to the Android or IOS project directly, it works fine, but when added to the PCL I notice a few differences...

1) It forces me to use asynchronous API calls. 2) I am not able to set the clientCredentialType in the transport or message in the bindings configuration.

Using asynchronous calls is not an issue, I am just noting the difference within the PCL, however #2 here is an issue. However, because I am not able to set clientCredentialType programmatically, it is defaulting to "Anonymous" instead of "Basic", so the result I get back from the SOAP call is "401 - Unauthorized". I tried to find a way to set the binding configuration in the app.config, but I am not sure if that is the right place - as a result I am trying to programmatically set the parameters like so:

        BasicHttpBinding binding = new BasicHttpBinding
        {
            Name = "basicHttpBinding",
            MaxBufferSize = 2147483647,
            MaxReceivedMessageSize = 2147483647
        };

        binding.Security.Mode = BasicHttpSecurityMode.Transport;
        binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; //this line doesn't work in PCL
        binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName; //this line doesn't work in PCL

The last two lines of code work fine when I added a service reference within a web project and the SOAP call works fine, however in the Xamarin solution within a PCL the last two lines of code do not resolve. I could be going about this the wrong way - all I am trying to do is get the SOAP call into a separate project so we can build some shared logic around it to use across multiple platforms.

Anyone have an idea of how I can solve this issue?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>