none
Test wcf service with SOAPUI (or another Java client) RRS feed

  • Question

  • I need to test a wcf wsHttpBinding service using SOAPUI. It uses message security with certificate and also need a valid certificate from the client (a custom validation is used to verify it). I've read this article https://www.soapui.org/soapui-projects/ws-security.html but cannot get it to work for this scenario. The service config:

    <system.serviceModel>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true">
          <baseAddressPrefixFilters>
            <add prefix="http://myserver/myservice/"/>
          </baseAddressPrefixFilters>
        </serviceHostingEnvironment>
    
    	<behaviors>
          <endpointBehaviors>
            <behavior name="EPBehavior">
              <wsdlExtensions location="http://myserver/myservice/service.svc" singleFile="true" />
            </behavior>
          </endpointBehaviors>
          <serviceBehaviors>
            <behavior name="Servicebehavior">
              <serviceDebug includeExceptionDetailInFaults="true" />
              <serviceMetadata httpGetEnabled="true"/>
              <serviceCredentials>
                <clientCertificate>
                  <authentication customCertificateValidatorType="myApp.ValidadorCertificado, myApp" certificateValidationMode="Custom" />
                </clientCertificate>
                <serviceCertificate findValue="Serial_of_service_certificate_here" x509FindType="FindBySerialNumber" />
              </serviceCredentials>
            </behavior>
          </serviceBehaviors>
        </behaviors>
    
        <services>
          <service behaviorConfiguration="Servicebehavior" name="myApp.myService">
    		<endpoint address="/Java" behaviorConfiguration="EPBehavior"
              binding="wsHttpBinding" bindingConfiguration="ConfiguracionEnlaceJava"
              name="JavaEP" bindingNamespace="http://services.company.es/myservice"
              contract="myApp.myContract" />
          </service>
        </services>
    
    	<bindings>
          <wsHttpBinding>
            <binding name="ConfiguracionEnlaceJava">
              <security>
                <message clientCredentialType="Certificate" negotiateServiceCredential="false" establishSecurityContext="false" />
              </security>
            </binding>
          </wsHttpBinding>
        </bindings>
    
        <extensions>
          <behaviorExtensions>
            <add name="wsdlExtensions" type="WCFExtras.Wsdl.WsdlExtensionsConfig, WCFExtras, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
          </behaviorExtensions>
        </extensions>
    </system.serviceModel>

    I have a client in .Net working, this is the config:

    <system.serviceModel>
        <behaviors>
          <endpointBehaviors>
            <behavior name="ClientCredentialsBehavior">
              <clientCredentials>
                <clientCertificate findValue="Serial_of_client_certificate_here" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySerialNumber" />
                <serviceCertificate>
                  <authentication revocationMode="NoCheck" />
                  <defaultCertificate findValue="Serial_of_service_certificate_here" storeLocation="LocalMachine" storeName="TrustedPeople" x509FindType="FindBySerialNumber" />
                </serviceCertificate>
              </clientCredentials>
            </behavior>
          </endpointBehaviors>
        </behaviors>
    
        <bindings>
          <wsHttpBinding>
            <binding name="BindingJavaEP">
              <security>
                <message clientCredentialType="Certificate" negotiateServiceCredential="false" establishSecurityContext="false" />
              </security>
            </binding>
          </wsHttpBinding>
        </bindings>
        <client>
          <endpoint address="http://myserver/myservice/service.svc/Java" behaviorConfiguration="ClientCredentialsBehavior"
            binding="wsHttpBinding" bindingConfiguration="BindingJavaEP"
            contract="myApp.myContract" name="JavaEP">
            <identity>
              <certificate encodedValue="base64_public_key_service_certificate_here" />
            </identity>
          </endpoint>
        </client>
    </system.serviceModel>
    Can anyone help please?
    Thanks in advance.

    Monday, March 28, 2016 6:23 AM

All replies

  • Hello,

    In order to test the WCF Service with SOAPUI.
    Firstly, please make sure in SOAPUI you check mark "Add default WSA To".
    Secondly, please make sure that you have passed the correct client certificate to WCF service.
    For more information, please refer to this similar thread:
    http://stackoverflow.com/questions/19305946/wcf-soapui-wshttpbinding .

    Besides, you can also try to consume the WCF Services by using the add services reference.

    In addition, SOAPUI is a third-part tool. It will be better to post your issue on SOAPUI forum.

    Thanks for your understanding.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, March 31, 2016 2:09 AM
    Moderator