Java Code Examples for javax.xml.ws.Service#create()

The following examples show how to use javax.xml.ws.Service#create() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: cxf   File: X509TokenTest.java    License: Apache License 2.0 6 votes vote down vote up
@org.junit.Test
public void testAsymmetricSP11() throws Exception {

    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = X509TokenTest.class.getResource("client.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    URL wsdl = X509TokenTest.class.getResource("DoubleItX509.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSP11Port");
    DoubleItPortType x509Port =
            service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(x509Port, test.getPort());

    if (test.isStreaming()) {
        SecurityTestUtil.enableStreaming(x509Port);
    }

    assertEquals(50, x509Port.doubleIt(25));

    ((java.io.Closeable)x509Port).close();
    bus.shutdown(true);
}
 
Example 2
Source Project: cxf   File: X509TokenTest.java    License: Apache License 2.0 6 votes vote down vote up
@org.junit.Test
public void testAsymmetricPKIPath() throws Exception {

    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = X509TokenTest.class.getResource("client.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    URL wsdl = X509TokenTest.class.getResource("DoubleItX509.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricPKIPathPort");
    DoubleItPortType x509Port =
            service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(x509Port, test.getPort());

    if (test.isStreaming()) {
        SecurityTestUtil.enableStreaming(x509Port);
    }

    assertEquals(50, x509Port.doubleIt(25));

    ((java.io.Closeable)x509Port).close();
    bus.shutdown(true);
}
 
Example 3
Source Project: cxf   File: GCMTest.java    License: Apache License 2.0 6 votes vote down vote up
@org.junit.Test
public void testAESGCM128() throws Exception {

    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = GCMTest.class.getResource("client.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    URL wsdl = GCMTest.class.getResource("DoubleItGCM.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItGCM128Port");
    DoubleItPortType gcmPort =
            service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(gcmPort, test.getPort());

    if (test.isStreaming()) {
        SecurityTestUtil.enableStreaming(gcmPort);
    }

    assertEquals(50, gcmPort.doubleIt(25));

    ((java.io.Closeable)gcmPort).close();
    bus.shutdown(true);
}
 
Example 4
Source Project: cxf   File: TransformationTest.java    License: Apache License 2.0 6 votes vote down vote up
@org.junit.Test
public void testTokenTransformationClaims() throws Exception {

    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = TransformationTest.class.getResource("cxf-client.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    URL wsdl = TransformationTest.class.getResource("DoubleIt.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItTransportUTClaimsPort");
    DoubleItPortType transportUTPort =
        service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(transportUTPort, PORT);

    doubleIt(transportUTPort, 25);

    ((java.io.Closeable)transportUTPort).close();
    bus.shutdown(true);
}
 
Example 5
Source Project: cxf   File: UsernameTokenDerivedTest.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Here the key derived from a UsernameToken (and derived again) is used as a protection
 * token for the symmetric binding, and used to sign the SOAP Body.
 */
@org.junit.Test
public void testSymmetricProtectionSignatureDKToken() throws Exception {

    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = UsernameTokenDerivedTest.class.getResource("client-derived.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    URL wsdl = UsernameTokenDerivedTest.class.getResource("DoubleItUtDerived.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItSymmetricProtectionSigDKPort");
    DoubleItPortType utPort =
            service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(utPort, PORT);

    assertEquals(50, utPort.doubleIt(25));

    ((java.io.Closeable)utPort).close();
    bus.shutdown(true);
}
 
Example 6
Source Project: cxf   File: MTOMSecurityTest.java    License: Apache License 2.0 6 votes vote down vote up
@org.junit.Test
public void testAsymmetricBinaryEncryptBeforeSigningBytesInAttachment() throws Exception {

    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = MTOMSecurityTest.class.getResource("client.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    URL wsdl = MTOMSecurityTest.class.getResource("DoubleItMtom.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricBinaryEncryptBeforeSigningPort");
    DoubleItMtomPortType port =
            service.getPort(portQName, DoubleItMtomPortType.class);
    updateAddressPort(port, PORT);

    DataSource source = new FileDataSource(new File("src/test/resources/java.jpg"));
    DoubleIt4 doubleIt = new DoubleIt4();
    doubleIt.setNumberToDouble(25);
    assertEquals(50, port.doubleIt4(25, new DataHandler(source)));

    ((java.io.Closeable)port).close();
    bus.shutdown(true);
}
 
Example 7
Source Project: cxf   File: ActionTest.java    License: Apache License 2.0 6 votes vote down vote up
@org.junit.Test
public void testEncryption() throws Exception {

    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = ActionTest.class.getResource("client.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    URL wsdl = ActionTest.class.getResource("DoubleItAction.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItEncryptionPort");
    DoubleItPortType port =
            service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(port, PORT);

    // Successful call
    assertEquals(50, port.doubleIt(25));

    ((java.io.Closeable)port).close();
    bus.shutdown(true);
}
 
Example 8
Source Project: cxf   File: JAASTest.java    License: Apache License 2.0 5 votes vote down vote up
@org.junit.Test
public void testSuccessfulInvocationWithProperties() throws Exception {

    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = JAASTest.class.getResource("cxf-client.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    URL wsdl = JAASTest.class.getResource("DoubleIt.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItUTPort2");
    DoubleItPortType utPort =
        service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(utPort, PORT);

    ((BindingProvider)utPort).getRequestContext().put(
        SecurityConstants.USERNAME, "alice");
    ((BindingProvider)utPort).getRequestContext().put(
        SecurityConstants.PASSWORD, "clarinet");

    doubleIt(utPort, 25);

    // Note that the UsernameToken should be cached for the second invocation
    doubleIt(utPort, 35);

    ((java.io.Closeable)utPort).close();
    bus.shutdown(true);
}
 
Example 9
Source Project: cxf   File: ClaimsTest.java    License: Apache License 2.0 5 votes vote down vote up
@org.junit.Test
public void testSaml2Claims() throws Exception {

    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = ClaimsTest.class.getResource("cxf-client.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    URL wsdl = ClaimsTest.class.getResource("DoubleIt.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML2ClaimsPort");
    DoubleItPortType transportClaimsPort =
        service.getPort(portQName, DoubleItPortType.class);

    updateAddressPort(transportClaimsPort, test.getPort());

    TokenTestUtils.updateSTSPort((BindingProvider)transportClaimsPort, test.getStsPort());

    if (test.isStreaming()) {
        SecurityTestUtil.enableStreaming(transportClaimsPort);
    }

    doubleIt(transportClaimsPort, 25);

    ((java.io.Closeable)transportClaimsPort).close();
    bus.shutdown(true);
}
 
Example 10
Source Project: cxf   File: ActionTest.java    License: Apache License 2.0 5 votes vote down vote up
@org.junit.Test
public void testSignatureNegativeClientStreaming() throws Exception {

    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = ActionTest.class.getResource("client.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    URL wsdl = ActionTest.class.getResource("DoubleItAction.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItSignatureNegativeClientPort2");
    DoubleItPortType port =
            service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(port, PORT);

    try {
        port.doubleIt(25);
        fail("Failure expected as the client doesn't trust the cert of the service");
    } catch (javax.xml.ws.soap.SOAPFaultException ex) {
        // expected
    }

    ((java.io.Closeable)port).close();
    bus.shutdown(true);
}
 
Example 11
@Test
public void goodUser() throws Exception {
    QName serviceName = new QName("http://wildfly.camel.test.cxf", "EndpointService");
    Service service = Service.create(getWsdl("/"+ APP_NAME), serviceName);
    Endpoint port = service.getPort(Endpoint.class);
    BindingProvider prov = (BindingProvider)port;
    prov.getRequestContext().put(SecurityConstants.USERNAME, "cxfuser");
    prov.getRequestContext().put(SecurityConstants.PASSWORD, "cxfpassword");
    Assert.assertEquals("Hello Foo", port.echo("Foo"));
}
 
Example 12
Source Project: cxf   File: SamlTokenTest.java    License: Apache License 2.0 5 votes vote down vote up
@org.junit.Test
public void testSaml2OverSymmetricSupporting() throws Exception {

    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = SamlTokenTest.class.getResource("client.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItSaml2SymmetricSupportingPort");
    DoubleItPortType saml2Port =
            service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(saml2Port, test.getPort());

    if (test.isStreaming()) {
        SecurityTestUtil.enableStreaming(saml2Port);
    }

    ((BindingProvider)saml2Port).getRequestContext().put(
        SecurityConstants.SAML_CALLBACK_HANDLER, new SamlCallbackHandler()
    );

    try {
        saml2Port.doubleIt(25);
        fail("Expected failure on an invocation with an unsigned SAML SV Assertion");
    } catch (javax.xml.ws.soap.SOAPFaultException ex) {
        assertTrue(ex.getMessage().contains("SamlToken not satisfied")
                   || ex.getMessage().equals(WSSecurityException.UNIFIED_SECURITY_ERR));
    }

    ((java.io.Closeable)saml2Port).close();
    bus.shutdown(true);
}
 
Example 13
Source Project: cxf   File: FaultTest.java    License: Apache License 2.0 5 votes vote down vote up
@org.junit.Test
public void testSoap11PolicyWithParts() throws Exception {

    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = FaultTest.class.getResource("client.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    URL wsdl = FaultTest.class.getResource("DoubleItFault.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItSoap11PolicyWithPartsPort");
    DoubleItPortType utPort =
            service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(utPort, PORT);

    // Make a successful invocation
    ((BindingProvider)utPort).getRequestContext().put(SecurityConstants.USERNAME, "alice");
    assertEquals(50, utPort.doubleIt(25));

    // Now make an invocation using another username
    ((BindingProvider)utPort).getRequestContext().put(SecurityConstants.USERNAME, "bob");
    ((BindingProvider)utPort).getRequestContext().put("security.password", "password");
    try {
        utPort.doubleIt(25);
        fail("Expected failure on bob");
    } catch (Exception ex) {
        assertTrue(ex.getMessage().contains("This is a fault"));
    }

    ((java.io.Closeable)utPort).close();
    bus.shutdown(true);
}
 
Example 14
Source Project: cxf   File: STSSenderVouchesTest.java    License: Apache License 2.0 5 votes vote down vote up
@org.junit.Test
public void testSAML2SenderVouches() throws Exception {

    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = STSSenderVouchesTest.class.getResource("cxf-client.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    URL wsdl = STSSenderVouchesTest.class.getResource("DoubleIt.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSAML2Port");
    DoubleItPortType port =
        service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(port, test.getPort());

    TokenTestUtils.updateSTSPort((BindingProvider)port, test.getStsPort());

    if (test.isStreaming()) {
        SecurityTestUtil.enableStreaming(port);
    }

    doubleIt(port, 25);

    ((java.io.Closeable)port).close();
    bus.shutdown(true);
}
 
Example 15
Source Project: cxf   File: Soap12Test.java    License: Apache License 2.0 5 votes vote down vote up
@org.junit.Test
public void testSAML2() throws Exception {

    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = Soap12Test.class.getResource("cxf-client.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    URL wsdl = Soap12Test.class.getResource("DoubleIt.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML2Port");
    DoubleItPortType transportSaml2Port =
        service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(transportSaml2Port, test.getPort());

    TokenTestUtils.updateSTSPort((BindingProvider)transportSaml2Port, test.getStsPort());

    if (test.isStreaming()) {
        SecurityTestUtil.enableStreaming(transportSaml2Port);
    }

    doubleIt(transportSaml2Port, 30);

    ((java.io.Closeable)transportSaml2Port).close();
    bus.shutdown(true);
}
 
Example 16
Source Project: cxf   File: TransportBindingTest.java    License: Apache License 2.0 5 votes vote down vote up
@org.junit.Test
public void testSAML1Endorsing() throws Exception {

    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = TransportBindingTest.class.getResource("cxf-client.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    URL wsdl = TransportBindingTest.class.getResource("DoubleIt.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML1EndorsingPort");
    DoubleItPortType transportSaml1Port =
        service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(transportSaml1Port, test.getPort());

    TokenTestUtils.updateSTSPort((BindingProvider)transportSaml1Port, test.getStsPort());

    if (test.isStreaming()) {
        SecurityTestUtil.enableStreaming(transportSaml1Port);
    }

    doubleIt(transportSaml1Port, 25);

    ((java.io.Closeable)transportSaml1Port).close();
    bus.shutdown(true);
}
 
Example 17
Source Project: cxf   File: BindingPropertiesTest.java    License: Apache License 2.0 4 votes vote down vote up
@org.junit.Test
public void testSignatureConfirmation() throws Exception {

    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = BindingPropertiesTest.class.getResource("client.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    URL wsdl = BindingPropertiesTest.class.getResource("DoubleItBindings.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);

    // This should work, as SignatureConfirmation is enabled
    QName portQName = new QName(NAMESPACE, "DoubleItSignatureConfirmationPort");
    DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(port, test.getPort());

    if (test.isStreaming()) {
        SecurityTestUtil.enableStreaming(port);
    }

    assertEquals(50, port.doubleIt(25));

    // This should fail, as SignatureConfirmation is not enabled
    portQName = new QName(NAMESPACE, "DoubleItSignatureConfirmationPort2");
    port = service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(port, test.getPort());

    if (test.isStreaming()) {
        SecurityTestUtil.enableStreaming(port);
    }

    try {
        port.doubleIt(25);
        fail("Failure expected on not enabling SignatureConfirmation");
    } catch (javax.xml.ws.soap.SOAPFaultException ex) {
        // expected
    }

    ((java.io.Closeable)port).close();
    bus.shutdown(true);
}
 
Example 18
Source Project: cxf   File: BindingPropertiesTest.java    License: Apache License 2.0 4 votes vote down vote up
@org.junit.Test
public void testTimestampFirst() throws Exception {

    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = BindingPropertiesTest.class.getResource("client.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    URL wsdl = BindingPropertiesTest.class.getResource("DoubleItBindings.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);

    // Successful invocation
    QName portQName = new QName(NAMESPACE, "DoubleItTimestampFirstPort");
    DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(port, test.getPort());

    if (test.isStreaming()) {
        SecurityTestUtil.enableStreaming(port);
    }

    // TODO Timestamp First/Last validation not working - see WSS-444
    if (!STAX_PORT.equals(test.getPort())) {
        assertEquals(50, port.doubleIt(25));
    }

    // This should fail, as the client is sending the timestamp last
    portQName = new QName(NAMESPACE, "DoubleItTimestampFirstPort2");
    port = service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(port, test.getPort());

    if (test.isStreaming()) {
        SecurityTestUtil.enableStreaming(port);
    }

    try {
        // TODO Timestamp First/Last validation not working - see WSS-444
        if (!STAX_PORT.equals(test.getPort())) {
            port.doubleIt(25);
            fail("Failure expected on on sending the timestamp last");
        }
    } catch (javax.xml.ws.soap.SOAPFaultException ex) {
        String error = "Layout does not match the requirements";
        assertTrue(ex.getMessage().contains(error));
    }

    ((java.io.Closeable)port).close();
    bus.shutdown(true);
}
 
Example 19
Source Project: cxf   File: UsernameTokenPolicyTest.java    License: Apache License 2.0 4 votes vote down vote up
@org.junit.Test
public void testNonce() throws Exception {

    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = UsernameTokenPolicyTest.class.getResource("policy-client.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    URL wsdl = UsernameTokenPolicyTest.class.getResource("DoubleItUtPolicy.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItNoncePort");
    DoubleItPortType port =
            service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(port, test.getPort());

    if (test.isStreaming()) {
        SecurityTestUtil.enableStreaming(port);
    }

    assertEquals(50, port.doubleIt(25));

    // This should fail, as the client is not sending a Nonce element
    portQName = new QName(NAMESPACE, "DoubleItNoncePort2");
    port = service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(port, test.getPort());

    if (test.isStreaming()) {
        SecurityTestUtil.enableStreaming(port);
    }

    try {
        port.doubleIt(25);
        fail("Failure expected on not sending a Nonce element");
    } catch (javax.xml.ws.soap.SOAPFaultException ex) {
        String error = "These policy alternatives can not be satisfied";
        assertTrue(ex.getMessage().contains(error)
                   || ex.getMessage().contains("UsernameToken does not contain a nonce"));
    }

    ((java.io.Closeable)port).close();
    bus.shutdown(true);
}
 
Example 20
Source Project: cxf   File: HttpsTokenTest.java    License: Apache License 2.0 4 votes vote down vote up
@org.junit.Test
public void testNoClientCertRequirement() throws Exception {

    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = HttpsTokenTest.class.getResource("client.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    URL wsdl = HttpsTokenTest.class.getResource("DoubleItHttps.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItNoClientCertRequirementPort");
    DoubleItPortType port =
            service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(port, test.getPort());

    if (test.isStreaming()) {
        SecurityTestUtil.enableStreaming(port);
    }

    try {
        port.doubleIt(25);
        fail("(Policy) Failure expected on not using a client cert");
    } catch (Exception ex) {
        // expected
    }

    // This should work, as we're disable the RequireClientCertificate check via a
    // JAX-WS property
    portQName = new QName(NAMESPACE, "DoubleItNoClientCertRequirementPort2");
    port = service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(port, test.getPort());

    if (test.isStreaming()) {
        SecurityTestUtil.enableStreaming(port);
    }

    assertEquals(50, port.doubleIt(25));

    ((java.io.Closeable)port).close();
    bus.shutdown(true);
}