Search in sources :

Example 46 with SOAPService

use of org.apache.hello_world_soap_http.SOAPService in project cxf by apache.

the class ClientEndpointCreationLoop method iteration.

private void iteration() throws URISyntaxException {
    SOAPService service = new SOAPService();
    service.getPort(portName, Greeter.class);
}
Also used : SOAPService(org.apache.hello_world_soap_http.SOAPService)

Example 47 with SOAPService

use of org.apache.hello_world_soap_http.SOAPService in project cxf by apache.

the class Client method main.

public static void main(String[] args) throws Exception {
    if (args.length == 0) {
        System.out.println("please specify wsdl");
        System.exit(1);
    }
    Server.main(new String[] { "inProcess" });
    URL wsdlURL;
    File wsdlFile = new File(args[0]);
    if (wsdlFile.exists()) {
        wsdlURL = wsdlFile.toURI().toURL();
    } else {
        wsdlURL = new URL(args[0]);
    }
    System.out.println(wsdlURL);
    SOAPService ss = new SOAPService(wsdlURL, SERVICE_NAME);
    Greeter port = ss.getSoapPort();
    String resp;
    System.out.println("Invoking sayHi...");
    resp = port.sayHi();
    System.out.println("Server responded with: " + resp);
    System.out.println();
    System.out.println("Invoking greetMe...");
    resp = port.greetMe(System.getProperty("user.name"));
    System.out.println("Server responded with: " + resp);
    System.out.println();
    try {
        System.out.println("Invoking pingMe, expecting exception...");
        port.pingMe();
    } catch (PingMeFault ex) {
        System.out.println("Expected exception: PingMeFault has occurred: " + ex.getMessage());
        FaultDetail detail = ex.getFaultInfo();
        System.out.println("FaultDetail major:" + detail.getMajor());
        System.out.println("FaultDetail minor:" + detail.getMinor());
    }
    System.exit(0);
}
Also used : SOAPService(org.apache.hello_world_soap_http.SOAPService) PingMeFault(org.apache.hello_world_soap_http.PingMeFault) Greeter(org.apache.hello_world_soap_http.Greeter) FaultDetail(org.apache.hello_world_soap_http.types.FaultDetail) File(java.io.File) URL(java.net.URL)

Example 48 with SOAPService

use of org.apache.hello_world_soap_http.SOAPService in project cxf by apache.

the class Client method main.

public static void main(String[] args) throws Exception {
    URL wsdlURL = Client.class.getResource("/wsdl/hello_world.wsdl");
    SOAPService ss = new SOAPService(wsdlURL, SERVICE_NAME);
    Greeter port = ss.getSoapPort();
    org.apache.cxf.endpoint.Client client = ClientProxy.getClient(port);
    client.getInInterceptors().add(new StreamInterceptor());
    client.getInFaultInterceptors().add(new StreamInterceptor());
    System.out.println("Invoking sayHi...");
    String resp = port.sayHi();
    System.out.println("Server responded with: " + resp);
    System.out.println();
    System.exit(0);
}
Also used : SOAPService(org.apache.hello_world_soap_http.SOAPService) Greeter(org.apache.hello_world_soap_http.Greeter) StreamInterceptor(demo.stream.interceptor.StreamInterceptor) URL(java.net.URL)

Example 49 with SOAPService

use of org.apache.hello_world_soap_http.SOAPService in project cxf by apache.

the class Client method main.

public static void main(String[] args) throws Exception {
    if (args.length == 0) {
        System.out.println("please specify wsdl");
        System.exit(1);
    }
    try {
        URL wsdlURL;
        File wsdlFile = new File(args[0]);
        if (wsdlFile.exists()) {
            wsdlURL = wsdlFile.toURI().toURL();
        } else {
            wsdlURL = new URL(args[0]);
        }
        SpringBusFactory bf = new SpringBusFactory();
        URL busFile = Client.class.getResource("/client.xml");
        Bus bus = bf.createBus(busFile.toString());
        BusFactory.setDefaultBus(bus);
        SOAPService service = new SOAPService(wsdlURL, SERVICE_NAME);
        Greeter port = service.getSoapPort();
        implicitPropagation(port);
        explicitPropagation(port);
        implicitPropagation(port);
    } catch (UndeclaredThrowableException ex) {
        ex.getUndeclaredThrowable().printStackTrace();
    } catch (Throwable ex) {
        ex.printStackTrace();
    } finally {
        System.exit(0);
    }
}
Also used : SOAPService(org.apache.hello_world_soap_http.SOAPService) Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) Greeter(org.apache.hello_world_soap_http.Greeter) UndeclaredThrowableException(java.lang.reflect.UndeclaredThrowableException) File(java.io.File) URL(java.net.URL)

Example 50 with SOAPService

use of org.apache.hello_world_soap_http.SOAPService in project cxf by apache.

the class NettyServerTest method start.

@BeforeClass
public static void start() throws Exception {
    Bus b = createStaticBus();
    BusFactory.setThreadDefaultBus(b);
    ep = Endpoint.publish("netty://http://localhost:" + PORT + "/SoapContext/SoapPort", new org.apache.hello_world_soap_http.GreeterImpl());
    URL wsdl = NettyServerTest.class.getResource("/wsdl/hello_world.wsdl");
    assertNotNull("WSDL is null", wsdl);
    SOAPService service = new SOAPService(wsdl);
    assertNotNull("Service is null", service);
    g = service.getSoapPort();
    assertNotNull("Port is null", g);
}
Also used : SOAPService(org.apache.hello_world_soap_http.SOAPService) Bus(org.apache.cxf.Bus) URL(java.net.URL) BeforeClass(org.junit.BeforeClass)

Aggregations

SOAPService (org.apache.hello_world_soap_http.SOAPService)84 URL (java.net.URL)67 Test (org.junit.Test)56 Greeter (org.apache.hello_world_soap_http.Greeter)49 InputStream (java.io.InputStream)20 UndeclaredThrowableException (java.lang.reflect.UndeclaredThrowableException)18 SOAPMessage (javax.xml.soap.SOAPMessage)14 Bus (org.apache.cxf.Bus)14 BindingProvider (javax.xml.ws.BindingProvider)13 Endpoint (javax.xml.ws.Endpoint)13 SOAPServiceBogusAddressTest (org.apache.hello_world_soap_http.SOAPServiceBogusAddressTest)13 SOAPServiceMultiPortTypeTest (org.apache.hello_world_soap_http.SOAPServiceMultiPortTypeTest)13 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)12 TimeoutException (java.util.concurrent.TimeoutException)8 WebServiceException (javax.xml.ws.WebServiceException)8 File (java.io.File)7 ExecutionException (java.util.concurrent.ExecutionException)7 QName (javax.xml.namespace.QName)7 BeforeClass (org.junit.BeforeClass)7 GreetMeLaterResponse (org.apache.hello_world_soap_http.types.GreetMeLaterResponse)6