1 package com.freemindcafe.apache.cxf.wsdl.sample1;
6 import javax.xml.namespace.QName;
8 import org.
apache.cxf.interceptor.LoggingInInterceptor;
9 import org.
apache.cxf.interceptor.LoggingOutInterceptor;
10 import org.
apache.cxf.jaxws.JaxWsProxyFactoryBean;
14 import org.junit.Test;
25 QName SERVICE_NAME =
new QName(
"http://apache.org/hello_world_soap_http",
"SOAPService");
28 File wsdlFile =
new File(
"src\\com\\freemindcafe\\apache\\cxf\\wsdl\\helloworld.wsdl");
29 wsdlURL = wsdlFile.toURL();
31 System.out.println(wsdlURL);
36 System.out.println(
"Invoking sayHi...");
38 System.out.println(
"Server responded with: " + resp);
41 System.out.println(
"Invoking greetMe...");
42 resp = port.greetMe(System.getProperty(
"user.name"));
43 System.out.println(
"Server responded with: " + resp);
46 System.out.println(
"Invoking greetMeOneWay...");
47 port.greetMeOneWay(System.getProperty(
"user.name"));
48 System.out.println(
"No response from server as method is OneWay");
52 System.out.println(
"Invoking pingMe, expecting exception...");
55 System.out.println(
"Expected exception: PingMeFault has occurred.");
56 System.out.println(ex.toString());
67 JaxWsProxyFactoryBean factory =
new JaxWsProxyFactoryBean();
68 factory.getInInterceptors().add(
new LoggingInInterceptor());
69 factory.getOutInterceptors().add(
new LoggingOutInterceptor());
70 factory.setServiceClass(
Greeter.class);
71 factory.setAddress(
"http://localhost:9001/SoapContext/SoapPort");
74 String reply = client.greetMe(
"nik");
75 System.out.println(
"Server said: " + reply);
void JaxWsProxyFactoryBean_based_client()
void soap_service_based_client()