0

I have a web service implemented in Java that is currently being invoked by a WSE 3.0 client, and I would like to migrate from WSE to WCF. Using the standard tools, I have created a client that can invoke the web service, but it returns a SoapException with a message of "Required parameter value is missing". The web service uses HTTPS and requires a username & password to be provided. In the existing WSE client code, the credentials area supported by subclassing SecurityPolicyAssertion and SendSecurityFilter, as follows:

            public class UTClientAssertion : SecurityPolicyAssertion
            {
                public UTClientAssertion()
                {
                }

                public override SoapFilter CreateClientOutputFilter(FilterCreationContext context)
                {
                    return new ClientOutputFilter(this, context);
                }

                public override SoapFilter CreateClientInputFilter(FilterCreationContext context)
                {
                    // we don't provide ClientInputFilter
                    return null;
                }

                public override SoapFilter CreateServiceInputFilter(FilterCreationContext context)
                {
                    // we don't provide any processing for web service side
                    return null;
                }

                public override SoapFilter CreateServiceOutputFilter(FilterCreationContext context)
                {
                    // we don't provide any processing for web service side
                    return null;
                }

                #region ClientOutputFilter
                class ClientOutputFilter : SendSecurityFilter
                {
                    public ClientOutputFilter(UTClientAssertion parentAssertion, FilterCreationContext context)
                        : base(parentAssertion.ServiceActor, false, parentAssertion.ClientActor)
                    {
                    }

                    public override void SecureMessage(SoapEnvelope envelope, Security security)
                    {
                        UsernameToken token = new UsernameToken("UserName", "Password", PasswordOption.SendPlainText);
                        security.Tokens.Add(token);
                        security.MustUnderstand = false;
                    }
                }
                #endregion

These classes are applied to the generated proxy class in the client as follows:

                // Create the web service client
                ListService objListSvc = new ListService();

                //code to set up the security policy and user assertion
                UTClientAssertion objAssertion = new UTClientAssertion();

                // create policy, add the assertion, and set it on the web service
                Policy objPolicy = new Policy();
                objPolicy.Assertions.Add(objAssertion);
                objListSvc.SetPolicy(objPolicy);

What I've found is that if I edit the WSE client code to remove the line objListSvc.SetPolicy(objPolicy), I get the same error message of "Required parameter value is missing".

What is the equivalent WCF configuration/code to match the WSE code above that configures the Username and Password for this web service? The WCF configuration being used is the default that was generated:

        <basicHttpBinding>
            <binding name="ListBinding" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
              <security mode="Transport">
                <transport clientCredentialType="None" proxyCredentialType="None"
                    realm="" />
                <message clientCredentialType="UserName" algorithmSuite="Default" />
              </security>
            </binding>
        </basicHttpBinding>

Thanks in advance

James
  • 127
  • 2
  • 8

1 Answers1

0

It is hard to tell without a sample of how your SOAP message from WSE3 looks on the wire. Try to get one via Fiddler and publish it here.

Generally if you use SSL try something like this:

<bindings>
        <basicHttpBinding>
            <binding name="NewBinding0">
                <security mode="TransportWithMessageCredential " />
            </binding>
        </basicHttpBinding>
</bindings>

If you do not use ssl try CUB.

Yaron Naveh
  • 23,560
  • 32
  • 103
  • 158
  • Thanks for the reply. In the post above, I don't see anything listed after the sentence about SSL. I am using SSL, so I would be interested to view the suggestion. I would like to use fiddler or tcpmon to view the data being transferred, but I work in a secure enviroment, and we are not able to download anything from the internet, and those tools are not available to me. I tried to turn on diagnostic tracing inside the WSE application, but that resulted in a null pointer exception on the line of code above where I'm creating the new instance of UsernameToken, just by adding diagnostics. – James Sep 04 '13 at 13:17
  • Thanks - it is posted now. I changed my WCF client to use this binding, but the result was an InvalidOperationException with the message "BasicHttp binding requires that BasicHttpBinding.Security.Message.ClientCredentialType be equivalent to the BasicHttpMessageCredentialType.Certificate credential type for secure messages. Select Transport or TransportWithMessageCredential security for UserName credentials" – James Sep 04 '13 at 13:27
  • This results in a MessageSecurityException with the message "An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail." & the inner exception is a FaultException with the message "[ISS.0088.9117] One or more header entries were not understood by the SOAP processor". Any idea what the call to SetPolicy() above changes in the message sent? Thanks again – James Sep 04 '13 at 13:57
  • in this case please publish a sample of a working SOAP and a failing SOAP (e.g. the last one). Then we can see what exactly is missing. Use fiddler or alike to get it – Yaron Naveh Sep 04 '13 at 14:09
  • Unfortunately, I work in a secure enviroment, and we are not able to download anything from the internet, and fiddler, tcpmon, etc. are not available to me – James Sep 04 '13 at 14:26
  • you need to find some way to see how the messages look like on the wire. On the WCF side you can use WCF logging but not sure if there is a built in equivalent in WSE. I guess you could build a dummy http endpoint that published to a console every message it gets and then direct the WSE3 app to send something to it (response will fail but you're only interested in looking at the request anyweay) – Yaron Naveh Sep 04 '13 at 14:37