Search in sources :

Example 1 with SOAPHeaderService

use of org.apache.header_test.SOAPHeaderService in project cxf by apache.

the class HeaderClientServerTest method testOutHeader.

@Test
public void testOutHeader() throws Exception {
    URL wsdl = getClass().getResource("/wsdl/soapheader.wsdl");
    assertNotNull(wsdl);
    SOAPHeaderService service = new SOAPHeaderService(wsdl, serviceName);
    assertNotNull(service);
    TestHeader proxy = service.getPort(portName, TestHeader.class);
    try {
        TestHeader2 in = new TestHeader2();
        String val = new String(TestHeader2Response.class.getSimpleName());
        Holder<TestHeader2Response> out = new Holder<TestHeader2Response>();
        Holder<TestHeader2Response> outHeader = new Holder<TestHeader2Response>();
        for (int idx = 0; idx < 2; idx++) {
            val += idx;
            in.setRequestType(val);
            proxy.testHeader2(in, out, outHeader);
            assertEquals(val, out.value.getResponseType());
            assertEquals(val, outHeader.value.getResponseType());
        }
    } catch (UndeclaredThrowableException ex) {
        ex.printStackTrace();
        throw (Exception) ex.getCause();
    }
}
Also used : TestHeader(org.apache.header_test.TestHeader) Holder(javax.xml.ws.Holder) UndeclaredThrowableException(java.lang.reflect.UndeclaredThrowableException) SOAPHeaderService(org.apache.header_test.SOAPHeaderService) TestHeader2Response(org.apache.header_test.types.TestHeader2Response) TestHeader2(org.apache.header_test.types.TestHeader2) URL(java.net.URL) Endpoint(javax.xml.ws.Endpoint) Test(org.junit.Test) AbstractJaxWsTest(org.apache.cxf.jaxws.AbstractJaxWsTest)

Example 2 with SOAPHeaderService

use of org.apache.header_test.SOAPHeaderService in project cxf by apache.

the class HeaderClientServerTest method testHolderOutIsTheFirstMessagePart.

@Test
public void testHolderOutIsTheFirstMessagePart() throws Exception {
    URL wsdl = getClass().getResource("/wsdl/soapheader.wsdl");
    assertNotNull(wsdl);
    SOAPHeaderService service = new SOAPHeaderService(wsdl, serviceName);
    assertNotNull(service);
    TestHeader proxy = service.getPort(portName, TestHeader.class);
    Holder<SimpleAll> simpleAll = new Holder<SimpleAll>();
    SimpleAll sa = new SimpleAll();
    sa.setVarAttrString("varAttrString");
    sa.setVarInt(100);
    sa.setVarString("varString");
    simpleAll.value = sa;
    SimpleChoice sc = new SimpleChoice();
    sc.setVarString("scVarString");
    SimpleStruct ss = proxy.sendReceiveAnyType(simpleAll, sc);
    assertEquals(simpleAll.value.getVarString(), "scVarString");
    assertEquals(ss.getVarInt(), 200);
    assertEquals(ss.getVarAttrString(), "varAttrStringRet");
}
Also used : SimpleChoice(org.apache.tests.type_test.choice.SimpleChoice) TestHeader(org.apache.header_test.TestHeader) Holder(javax.xml.ws.Holder) SOAPHeaderService(org.apache.header_test.SOAPHeaderService) SimpleAll(org.apache.tests.type_test.all.SimpleAll) SimpleStruct(org.apache.tests.type_test.sequence.SimpleStruct) URL(java.net.URL) Test(org.junit.Test) AbstractJaxWsTest(org.apache.cxf.jaxws.AbstractJaxWsTest)

Example 3 with SOAPHeaderService

use of org.apache.header_test.SOAPHeaderService in project cxf by apache.

the class HeaderClientServerTest method testHeaderPartBeforeBodyPart.

@Test
public void testHeaderPartBeforeBodyPart() throws Exception {
    URL wsdl = getClass().getResource("/wsdl/soapheader.wsdl");
    assertNotNull(wsdl);
    SOAPHeaderService service = new SOAPHeaderService(wsdl, serviceName);
    assertNotNull(service);
    TestHeader proxy = service.getPort(portName, TestHeader.class);
    TestHeader6 in = new TestHeader6();
    String val = new String(TestHeader6.class.getSimpleName());
    Holder<TestHeader3> inoutHeader = new Holder<TestHeader3>();
    for (int idx = 0; idx < 1; idx++) {
        val += idx;
        in.setRequestType(val);
        inoutHeader.value = new TestHeader3();
        TestHeader6Response returnVal = proxy.testHeaderPartBeforeBodyPart(inoutHeader, in);
        // inoutHeader copied to return
        // in copied to inoutHeader
        assertNotNull(returnVal);
        assertNull(returnVal.getResponseType());
        assertEquals(val, inoutHeader.value.getRequestType());
        in.setRequestType(null);
        inoutHeader.value.setRequestType(val);
        returnVal = proxy.testHeaderPartBeforeBodyPart(inoutHeader, in);
        assertNotNull(returnVal);
        assertEquals(val, returnVal.getResponseType());
        assertNull(inoutHeader.value.getRequestType());
    }
}
Also used : TestHeader(org.apache.header_test.TestHeader) TestHeader6Response(org.apache.header_test.types.TestHeader6Response) Holder(javax.xml.ws.Holder) SOAPHeaderService(org.apache.header_test.SOAPHeaderService) TestHeader6(org.apache.header_test.types.TestHeader6) URL(java.net.URL) TestHeader3(org.apache.header_test.types.TestHeader3) Endpoint(javax.xml.ws.Endpoint) Test(org.junit.Test) AbstractJaxWsTest(org.apache.cxf.jaxws.AbstractJaxWsTest)

Example 4 with SOAPHeaderService

use of org.apache.header_test.SOAPHeaderService in project cxf by apache.

the class HeaderClientServerTest method testReturnHeader.

@Test
public void testReturnHeader() throws Exception {
    URL wsdl = getClass().getResource("/wsdl/soapheader.wsdl");
    assertNotNull(wsdl);
    SOAPHeaderService service = new SOAPHeaderService(wsdl, serviceName);
    assertNotNull(service);
    TestHeader proxy = service.getPort(portName, TestHeader.class);
    try {
        Holder<TestHeader5ResponseBody> out = new Holder<TestHeader5ResponseBody>();
        Holder<TestHeader5> outHeader = new Holder<TestHeader5>();
        TestHeader5 in = new TestHeader5();
        String val = new String(TestHeader5.class.getSimpleName());
        for (int idx = 0; idx < 2; idx++) {
            val += idx;
            in.setRequestType(val);
            proxy.testHeader5(out, outHeader, in);
            assertEquals(1000, out.value.getResponseType());
            assertEquals(val, outHeader.value.getRequestType());
        }
    } catch (UndeclaredThrowableException ex) {
        throw (Exception) ex.getCause();
    }
}
Also used : TestHeader(org.apache.header_test.TestHeader) Holder(javax.xml.ws.Holder) UndeclaredThrowableException(java.lang.reflect.UndeclaredThrowableException) SOAPHeaderService(org.apache.header_test.SOAPHeaderService) TestHeader5(org.apache.header_test.types.TestHeader5) URL(java.net.URL) Endpoint(javax.xml.ws.Endpoint) TestHeader5ResponseBody(org.apache.header_test.types.TestHeader5ResponseBody) Test(org.junit.Test) AbstractJaxWsTest(org.apache.cxf.jaxws.AbstractJaxWsTest)

Example 5 with SOAPHeaderService

use of org.apache.header_test.SOAPHeaderService in project cxf by apache.

the class HeaderClientServerTest method testHeader7.

@Test
public void testHeader7() {
    URL wsdl = getClass().getResource("/wsdl/soapheader.wsdl");
    assertNotNull(wsdl);
    SOAPHeaderService service = new SOAPHeaderService(wsdl, serviceName);
    assertNotNull(service);
    TestHeader proxy = service.getPort(portName, TestHeader.class);
    assertEquals("Hello", proxy.testHeader7());
}
Also used : TestHeader(org.apache.header_test.TestHeader) SOAPHeaderService(org.apache.header_test.SOAPHeaderService) URL(java.net.URL) Test(org.junit.Test) AbstractJaxWsTest(org.apache.cxf.jaxws.AbstractJaxWsTest)

Aggregations

URL (java.net.URL)8 AbstractJaxWsTest (org.apache.cxf.jaxws.AbstractJaxWsTest)8 SOAPHeaderService (org.apache.header_test.SOAPHeaderService)8 TestHeader (org.apache.header_test.TestHeader)8 Test (org.junit.Test)8 UndeclaredThrowableException (java.lang.reflect.UndeclaredThrowableException)5 Endpoint (javax.xml.ws.Endpoint)5 Holder (javax.xml.ws.Holder)5 TestHeader3 (org.apache.header_test.types.TestHeader3)2 TestHeader1 (org.apache.header_test.types.TestHeader1)1 TestHeader1Response (org.apache.header_test.types.TestHeader1Response)1 TestHeader2 (org.apache.header_test.types.TestHeader2)1 TestHeader2Response (org.apache.header_test.types.TestHeader2Response)1 TestHeader3Response (org.apache.header_test.types.TestHeader3Response)1 TestHeader5 (org.apache.header_test.types.TestHeader5)1 TestHeader5ResponseBody (org.apache.header_test.types.TestHeader5ResponseBody)1 TestHeader6 (org.apache.header_test.types.TestHeader6)1 TestHeader6Response (org.apache.header_test.types.TestHeader6Response)1 SimpleAll (org.apache.tests.type_test.all.SimpleAll)1 SimpleChoice (org.apache.tests.type_test.choice.SimpleChoice)1