Search in sources :

Example 1 with AddNumbersService

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

the class WSADisableTest method getService.

private AddNumbersService getService() {
    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);
    return service;
}
Also used : AddNumbersService(org.apache.cxf.systest.ws.addr_feature.AddNumbersService) URL(java.net.URL)

Example 2 with AddNumbersService

use of org.apache.cxf.systest.ws.addr_feature.AddNumbersService 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 3 with AddNumbersService

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

the class WSAPureWsdlTest method getPort.

private AddNumbersPortType getPort() {
    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);
    return service.getAddNumbersPort();
}
Also used : AddNumbersService(org.apache.cxf.systest.ws.addr_feature.AddNumbersService) URL(java.net.URL)

Example 4 with AddNumbersService

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

the class WSAPureWsdlTest method testBasicDispatchInvocation.

@Test
public void testBasicDispatchInvocation() throws Exception {
    String req = "<addNumbers xmlns=\"http://apache.org/cxf/systest/ws/addr_feature/\">" + "<number1>1</number1><number2>2</number2></addNumbers>";
    String base = "http://apache.org/cxf/systest/ws/addr_feature/AddNumbersPortType/";
    ByteArrayOutputStream input = setupInLogging();
    ByteArrayOutputStream output = setupOutLogging();
    URL wsdl = getClass().getResource("/wsdl_systest_wsspec/add_numbers.wsdl");
    assertNotNull("WSDL is null", wsdl);
    AddNumbersService service = new AddNumbersService(wsdl, serviceName);
    Dispatch<Source> disp = service.createDispatch(AddNumbersService.AddNumbersPort, Source.class, Mode.PAYLOAD);
    disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + PORT + "/jaxws/add");
    disp.invoke(new StreamSource(new StringReader(req)));
    assertLogContains(output.toString(), "//wsa:Action", base + "addNumbersRequest");
    assertLogContains(input.toString(), "//wsa:Action", base + "addNumbersResponse");
    output.reset();
    input.reset();
    disp = service.createDispatch(AddNumbersService.AddNumbersPort, Source.class, Mode.PAYLOAD);
    disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + PORT + "/jaxws/add");
    // set the operation name so action can be pulled from the wsdl
    disp.getRequestContext().put(MessageContext.WSDL_OPERATION, new QName("http://apache.org/cxf/systest/ws/addr_feature/", "addNumbers"));
    disp.invoke(new StreamSource(new StringReader(req)));
    assertLogContains(output.toString(), "//wsa:Action", base + "addNumbersRequest");
    assertLogContains(input.toString(), "//wsa:Action", base + "addNumbersResponse");
}
Also used : AddNumbersService(org.apache.cxf.systest.ws.addr_feature.AddNumbersService) QName(javax.xml.namespace.QName) StreamSource(javax.xml.transform.stream.StreamSource) StringReader(java.io.StringReader) ByteArrayOutputStream(java.io.ByteArrayOutputStream) URL(java.net.URL) StreamSource(javax.xml.transform.stream.StreamSource) Source(javax.xml.transform.Source) Test(org.junit.Test)

Example 5 with AddNumbersService

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

the class WSAPureWsdlTest method testDispatchActionMissmatch.

@Test
public void testDispatchActionMissmatch() throws Exception {
    String req = "<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\">" + "<S:Body><addNumbers3 xmlns=\"http://apache.org/cxf/systest/ws/addr_feature/\">" + "<number1>1</number1><number2>2</number2></addNumbers3>" + "</S:Body></S:Envelope>";
    // String base = "http://apache.org/cxf/systest/ws/addr_feature/AddNumbersPortType/";
    String expectedOut = "http://bad.action";
    URL wsdl = getClass().getResource("/wsdl_systest_wsspec/add_numbers.wsdl");
    assertNotNull("WSDL is null", wsdl);
    AddNumbersService service = new AddNumbersService(wsdl, serviceName);
    Dispatch<Source> disp = service.createDispatch(AddNumbersService.AddNumbersPort, Source.class, Mode.MESSAGE);
    disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + PORT + "/jaxws/add");
    // manually set the action
    disp.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, expectedOut);
    disp.getRequestContext().put(ContextUtils.ACTION, expectedOut + "/wsaAction");
    try {
        disp.invoke(new StreamSource(new StringReader(req)));
        fail("no exception");
    } catch (SOAPFaultException f) {
    // expected
    }
}
Also used : AddNumbersService(org.apache.cxf.systest.ws.addr_feature.AddNumbersService) StreamSource(javax.xml.transform.stream.StreamSource) StringReader(java.io.StringReader) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) URL(java.net.URL) StreamSource(javax.xml.transform.stream.StreamSource) Source(javax.xml.transform.Source) Test(org.junit.Test)

Aggregations

URL (java.net.URL)5 AddNumbersService (org.apache.cxf.systest.ws.addr_feature.AddNumbersService)5 StringReader (java.io.StringReader)2 Source (javax.xml.transform.Source)2 StreamSource (javax.xml.transform.stream.StreamSource)2 Test (org.junit.Test)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 QName (javax.xml.namespace.QName)1 AddressingFeature (javax.xml.ws.soap.AddressingFeature)1 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)1 AddNumbersPortTypeProxy (org.apache.cxf.systest.ws.addr_feature.AddNumbersService.AddNumbersPortTypeProxy)1