Search in sources :

Example 1 with AddNumbersPortTypeProxy

use of org.apache.cxf.systest.ws.addr_feature.AddNumbersService.AddNumbersPortTypeProxy in project cxf by apache.

the class WSAFromWSDLTest method getPort.

private AddNumbersPortTypeProxy getPort() throws Exception {
    URL wsdl = getClass().getResource("/wsdl_systest_wsspec/add_numbers.wsdl");
    assertNotNull("WSDL is null", wsdl);
    AddNumbersService service = new AddNumbersService(wsdl, serviceName);
    assertNotNull("Service is null ", service);
    AddNumbersPortTypeProxy port = service.getAddNumbersPort(new AddressingFeature());
    updateAddressPort(port, PORT);
    return port;
}
Also used : AddNumbersService(org.apache.cxf.systest.ws.addr_feature.AddNumbersService) AddressingFeature(javax.xml.ws.soap.AddressingFeature) URL(java.net.URL) AddNumbersPortTypeProxy(org.apache.cxf.systest.ws.addr_feature.AddNumbersService.AddNumbersPortTypeProxy)

Example 2 with AddNumbersPortTypeProxy

use of org.apache.cxf.systest.ws.addr_feature.AddNumbersService.AddNumbersPortTypeProxy in project cxf by apache.

the class WSAFromWSDLTest method testAddNumbersFault3.

@Test
public void testAddNumbersFault3() throws Exception {
    ByteArrayOutputStream input = setupInLogging();
    ByteArrayOutputStream output = setupOutLogging();
    try (AddNumbersPortTypeProxy port = getPort()) {
        try {
            port.addNumbers3(-1, 2);
        } catch (AddNumbersFault_Exception ex) {
            assert true;
        } catch (Exception e) {
            e.printStackTrace();
            assert false;
        }
        String expectedOut = "3in";
        String expectedIn = "3fault";
        assertTrue(output.toString(), output.toString().indexOf(expectedOut) != -1);
        assertTrue(input.toString(), input.toString().indexOf(expectedIn) != -1);
    }
}
Also used : AddNumbersFault_Exception(org.apache.cxf.systest.ws.addr_feature.AddNumbersFault_Exception) ByteArrayOutputStream(java.io.ByteArrayOutputStream) AddNumbersPortTypeProxy(org.apache.cxf.systest.ws.addr_feature.AddNumbersService.AddNumbersPortTypeProxy) AddNumbersFault_Exception(org.apache.cxf.systest.ws.addr_feature.AddNumbersFault_Exception) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) Test(org.junit.Test)

Example 3 with AddNumbersPortTypeProxy

use of org.apache.cxf.systest.ws.addr_feature.AddNumbersService.AddNumbersPortTypeProxy in project cxf by apache.

the class WSAFromWSDLTest method testNonAnonToAnon.

@Test
public void testNonAnonToAnon() throws Exception {
    try (AddNumbersPortTypeProxy port = getPort()) {
        port.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + PORT + "/jaxws/addAnon");
        AddressingProperties maps = new AddressingProperties();
        EndpointReferenceType ref = new EndpointReferenceType();
        AttributedURIType add = new AttributedURIType();
        add.setValue("http://localhost:" + INVALID_PORT + "/not/a/real/url");
        ref.setAddress(add);
        maps.setReplyTo(ref);
        maps.setFaultTo(ref);
        port.getRequestContext().put("javax.xml.ws.addressing.context", maps);
        try {
            port.addNumbers3(-1, 2);
        } catch (SOAPFaultException e) {
            assertTrue(e.getFault().getFaultCode().contains("OnlyAnonymousAddressSupported"));
        }
    }
}
Also used : EndpointReferenceType(org.apache.cxf.ws.addressing.EndpointReferenceType) AttributedURIType(org.apache.cxf.ws.addressing.AttributedURIType) AddressingProperties(org.apache.cxf.ws.addressing.AddressingProperties) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) AddNumbersPortTypeProxy(org.apache.cxf.systest.ws.addr_feature.AddNumbersService.AddNumbersPortTypeProxy) Test(org.junit.Test)

Aggregations

AddNumbersPortTypeProxy (org.apache.cxf.systest.ws.addr_feature.AddNumbersService.AddNumbersPortTypeProxy)3 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)2 Test (org.junit.Test)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 URL (java.net.URL)1 AddressingFeature (javax.xml.ws.soap.AddressingFeature)1 AddNumbersFault_Exception (org.apache.cxf.systest.ws.addr_feature.AddNumbersFault_Exception)1 AddNumbersService (org.apache.cxf.systest.ws.addr_feature.AddNumbersService)1 AddressingProperties (org.apache.cxf.ws.addressing.AddressingProperties)1 AttributedURIType (org.apache.cxf.ws.addressing.AttributedURIType)1 EndpointReferenceType (org.apache.cxf.ws.addressing.EndpointReferenceType)1