Search in sources :

Example 1 with SOAPServiceRPCLit

use of org.apache.hello_world_rpclit.SOAPServiceRPCLit 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);
    }
    URL wsdlURL;
    File wsdlFile = new File(args[0]);
    if (wsdlFile.exists()) {
        wsdlURL = wsdlFile.toURI().toURL();
    } else {
        wsdlURL = new URL(args[0]);
    }
    SOAPServiceRPCLit service = new SOAPServiceRPCLit(wsdlURL, SERVICE_NAME);
    GreeterRPCLit greeter = (GreeterRPCLit) service.getPort(PORT_NAME, GreeterRPCLit.class);
    System.out.println("Invoking sayHi...");
    System.out.println("server responded with: " + greeter.sayHi());
    System.out.println();
    System.out.println("Invoking greetMe...");
    System.out.println("server responded with: " + greeter.greetMe(System.getProperty("user.name")));
    System.out.println();
    MyComplexStruct argument = new MyComplexStruct();
    MyComplexStruct retVal = null;
    String str1 = "this is element 1";
    String str2 = "this is element 2";
    int int1 = 42;
    argument.setElem1(str1);
    argument.setElem2(str2);
    argument.setElem3(int1);
    System.out.println("Invoking sendReceiveData...");
    retVal = greeter.sendReceiveData(argument);
    System.out.println("Response from sendReceiveData operation :");
    System.out.println("Element-1 : " + retVal.getElem1());
    System.out.println("Element-2 : " + retVal.getElem2());
    System.out.println("Element-3 : " + retVal.getElem3());
    System.out.println();
    System.exit(0);
}
Also used : SOAPServiceRPCLit(org.apache.hello_world_rpclit.SOAPServiceRPCLit) GreeterRPCLit(org.apache.hello_world_rpclit.GreeterRPCLit) MyComplexStruct(org.apache.hello_world_rpclit.types.MyComplexStruct) File(java.io.File) URL(java.net.URL)

Example 2 with SOAPServiceRPCLit

use of org.apache.hello_world_rpclit.SOAPServiceRPCLit in project cxf by apache.

the class ProviderRPCClientServerTest method testPayloadModeWithSAXSourceData.

@Test
public void testPayloadModeWithSAXSourceData() throws Exception {
    URL wsdl = getClass().getResource("/wsdl/hello_world_rpc_lit.wsdl");
    assertNotNull(wsdl);
    QName serviceName = new QName("http://apache.org/hello_world_rpclit", "SOAPServiceProviderRPCLit");
    QName portName = new QName("http://apache.org/hello_world_rpclit", "SoapPortProviderRPCLit6");
    SOAPServiceRPCLit service = new SOAPServiceRPCLit(wsdl, serviceName);
    assertNotNull(service);
    doGreeterRPCLit(service, portName, 1, false);
}
Also used : SOAPServiceRPCLit(org.apache.hello_world_rpclit.SOAPServiceRPCLit) QName(javax.xml.namespace.QName) URL(java.net.URL) Test(org.junit.Test)

Example 3 with SOAPServiceRPCLit

use of org.apache.hello_world_rpclit.SOAPServiceRPCLit in project cxf by apache.

the class ProviderRPCClientServerTest method testSOAPMessageModeWithDOMSourceData.

@Test
public void testSOAPMessageModeWithDOMSourceData() throws Exception {
    QName serviceName = new QName("http://apache.org/hello_world_rpclit", "SOAPServiceProviderRPCLit");
    QName portName = new QName("http://apache.org/hello_world_rpclit", "SoapPortProviderRPCLit2");
    URL wsdl = getClass().getResource("/wsdl/hello_world_rpc_lit.wsdl");
    assertNotNull(wsdl);
    SOAPServiceRPCLit service = new SOAPServiceRPCLit(wsdl, serviceName);
    assertNotNull(service);
    doGreeterRPCLit(service, portName, 2, false);
}
Also used : SOAPServiceRPCLit(org.apache.hello_world_rpclit.SOAPServiceRPCLit) QName(javax.xml.namespace.QName) URL(java.net.URL) Test(org.junit.Test)

Example 4 with SOAPServiceRPCLit

use of org.apache.hello_world_rpclit.SOAPServiceRPCLit in project cxf by apache.

the class ProviderRPCClientServerTest method testMessageModeWithSAXSourceData.

@Test
public void testMessageModeWithSAXSourceData() throws Exception {
    URL wsdl = getClass().getResource("/wsdl/hello_world_rpc_lit.wsdl");
    assertNotNull(wsdl);
    QName serviceName = new QName("http://apache.org/hello_world_rpclit", "SOAPServiceProviderRPCLit");
    QName portName = new QName("http://apache.org/hello_world_rpclit", "SoapPortProviderRPCLit4");
    SOAPServiceRPCLit service = new SOAPServiceRPCLit(wsdl, serviceName);
    assertNotNull(service);
    doGreeterRPCLit(service, portName, 1, false);
}
Also used : SOAPServiceRPCLit(org.apache.hello_world_rpclit.SOAPServiceRPCLit) QName(javax.xml.namespace.QName) URL(java.net.URL) Test(org.junit.Test)

Example 5 with SOAPServiceRPCLit

use of org.apache.hello_world_rpclit.SOAPServiceRPCLit in project cxf by apache.

the class ProviderRPCClientServerTest method testMessageModeWithStreamSourceData.

@Test
public void testMessageModeWithStreamSourceData() throws Exception {
    URL wsdl = getClass().getResource("/wsdl/hello_world_rpc_lit.wsdl");
    assertNotNull(wsdl);
    QName serviceName = new QName("http://apache.org/hello_world_rpclit", "SOAPServiceProviderRPCLit");
    QName portName = new QName("http://apache.org/hello_world_rpclit", "SoapPortProviderRPCLit5");
    SOAPServiceRPCLit service = new SOAPServiceRPCLit(wsdl, serviceName);
    assertNotNull(service);
    doGreeterRPCLit(service, portName, 1, false);
}
Also used : SOAPServiceRPCLit(org.apache.hello_world_rpclit.SOAPServiceRPCLit) QName(javax.xml.namespace.QName) URL(java.net.URL) Test(org.junit.Test)

Aggregations

SOAPServiceRPCLit (org.apache.hello_world_rpclit.SOAPServiceRPCLit)11 Test (org.junit.Test)10 URL (java.net.URL)8 QName (javax.xml.namespace.QName)7 GreeterRPCLit (org.apache.hello_world_rpclit.GreeterRPCLit)5 UndeclaredThrowableException (java.lang.reflect.UndeclaredThrowableException)3 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)3 UnmarshalException (javax.xml.bind.UnmarshalException)2 MyComplexStruct (org.apache.hello_world_rpclit.types.MyComplexStruct)2 File (java.io.File)1 StringReader (java.io.StringReader)1 XmlRootElement (javax.xml.bind.annotation.XmlRootElement)1 Source (javax.xml.transform.Source)1 StreamSource (javax.xml.transform.stream.StreamSource)1 Endpoint (javax.xml.ws.Endpoint)1 WebServiceException (javax.xml.ws.WebServiceException)1 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)1 XPathUtils (org.apache.cxf.helpers.XPathUtils)1 W3CNamespaceContext (org.apache.cxf.staxutils.W3CNamespaceContext)1 Document (org.w3c.dom.Document)1