Search in sources :

Example 6 with HelloResponse

use of org.jboss.test.ws.jaxws.samples.schemavalidation.types.HelloResponse in project jbossws-cxf by jbossws.

the class ValidatingHelloImpl method helloRequest.

public HelloResponse helloRequest(String input) {
    System.out.println("ValidatingHello: " + input);
    HelloResponse response = new HelloResponse();
    response.setReturn(1);
    return response;
}
Also used : HelloResponse(org.jboss.test.ws.jaxws.samples.schemavalidation.types.HelloResponse)

Example 7 with HelloResponse

use of org.jboss.test.ws.jaxws.samples.schemavalidation.types.HelloResponse in project jbossws-cxf by jbossws.

the class DefaultSchemaValidationTestCaseForked method testDefaultServerValidation.

/**
 * Verifies the default endpoint configuration can be used to always set schema validation from AS model
 *
 * @throws Exception
 */
@Test
@RunAsClient
public void testDefaultServerValidation() throws Exception {
    final QName serviceName = new QName("http://jboss.org/schemavalidation", "HelloService");
    final QName portName = new QName("http://jboss.org/schemavalidation", "HelloPort");
    URL wsdlURL = getResourceURL("jaxws/samples/schemavalidation/client.wsdl");
    Service service = Service.create(wsdlURL, serviceName);
    Hello proxy = (Hello) service.getPort(portName, Hello.class);
    ((BindingProvider) proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://" + baseURL.getHost() + ":" + baseURL.getPort() + "/jaxws-samples-schemavalidation/hello");
    HelloResponse hr;
    try {
        deployer.deploy(DEPLOYMENT);
        hr = proxy.helloRequest("JBoss");
        assertNotNull(hr);
        assertEquals(2, hr.getReturn());
        hr = proxy.helloRequest("number");
        assertNotNull(hr);
        assertEquals(2, hr.getReturn());
    } finally {
        deployer.undeploy(DEPLOYMENT);
    }
    // -- modify default conf to enable default endpoint schema validation
    try {
        runInContainer("enableDefaultEndpointSchemaValidation");
        try {
            deployer.deploy(DEPLOYMENT);
            hr = proxy.helloRequest("JBoss");
            assertNotNull(hr);
            assertEquals(2, hr.getReturn());
            try {
                proxy.helloRequest("number");
                fail();
            } catch (Exception e) {
                assertTrue(e.getMessage().contains("is not facet-valid with respect to enumeration"));
            }
        } finally {
            deployer.undeploy(DEPLOYMENT);
        }
    } finally {
        // -- restore default conf --
        runInContainer("disableDefaultEndpointSchemaValidation");
    // --
    }
}
Also used : QName(javax.xml.namespace.QName) HelloResponse(org.jboss.test.ws.jaxws.samples.schemavalidation.types.HelloResponse) Service(javax.xml.ws.Service) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) JBossWSTest(org.jboss.wsf.test.JBossWSTest)

Example 8 with HelloResponse

use of org.jboss.test.ws.jaxws.samples.schemavalidation.types.HelloResponse in project jbossws-cxf by jbossws.

the class HelloImpl method helloRequest.

public HelloResponse helloRequest(String input) {
    System.out.println("Hello: " + input);
    HelloResponse response = new HelloResponse();
    response.setReturn(2);
    return response;
}
Also used : HelloResponse(org.jboss.test.ws.jaxws.samples.schemavalidation.types.HelloResponse)

Aggregations

HelloResponse (org.jboss.test.ws.jaxws.samples.schemavalidation.types.HelloResponse)8 URL (java.net.URL)6 QName (javax.xml.namespace.QName)6 Service (javax.xml.ws.Service)6 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)5 JBossWSTest (org.jboss.wsf.test.JBossWSTest)5 Test (org.junit.Test)5 ClientConfig (org.jboss.wsf.spi.metadata.config.ClientConfig)1 WrapThreadContextClassLoader (org.jboss.wsf.test.WrapThreadContextClassLoader)1