Infopath and WSE? - InfoPath Dev
in

InfoPath Dev

Infopath and WSE?

Last post 02-14-2013 09:09 AM by IamJohnStevens. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 09-18-2012 09:01 AM

    Infopath and WSE?

    I'm trying to figure out any way to get data from my WCF service (BasicHttpBinding, requires username and password in the header). I have tried just using Visual Studio 2005 Web Services only to be reminded that they do not support the type of authentication I require. I am now looking into the old WSE 3.0. I have never used it before but it seems pretty straight forward. I just cannot find any information about how to use WSE with Visual Studio Tools for Applications and, being new to Infopath, was starting to wonder if there's an easier way, such as consuming a 4.0 dll that exposes some sort of data set that is compatible with Infopath? Just looking for direction Help appreciated.
  • 02-14-2013 09:09 AM In reply to

    I ran into this same issue using VS2010. The solution is to create a custom client using WSE security without encryption. I found information
    http://webservices20.blogspot.co.il/2008/11/introducing-wcf-clearusernamebinding.html

    The web method creates a new request and the custom client, and then calls that request using the client:

    //Create request object
                        wsRequest req = new wsRequest(Param1, Param2);

                        //Create client object
                        CostpointwsClient client = CreateClient();

                        //Call web method using client and request objects, catch with response object
                        resp = client.wsMethod(req);

    Here is the code for creating the custom client:

            private wsClient CreateClient()
            {

                SecurityBindingElement securityElement = SecurityBindingElement.CreateUserNameOverTransportBindingElement();
                securityElement.AllowInsecureTransport = true;
                securityElement.EnableUnsecuredResponse = true;
                securityElement.IncludeTimestamp = false;
                TextMessageEncodingBindingElement encodingelement = new TextMessageEncodingBindingElement(MessageVersion.Soap11, Encoding.UTF8);
                HttpTransportBindingElement transportElement = new HttpTransportBindingElement();
                CustomBinding binding = new CustomBinding(securityElement, encodingelement, transportElement);
                EndpointAddress ea = new EndpointAddress(WebserviceURL());
                wsClient client = new wsClient(binding, ea);
                var cred = client.ClientCredentials.UserName;
                cred.UserName = username;
                cred.Password = password;
                return client;
            }

    John Stevens
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.