Note: JDK 1.8 is having issue and we have WTP plugin till 2.X version of CXF hence used CXF 2.7.1 Jar even though latest CXF 3.2 version is available.
Eclipse Set UP :-
Installing CXF
CXF Server Project and CXF Client Project using Eclipse
package com.test;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
public class TestSiddhuMain {
private static final QName SERVICE_NAME = new QName("http://test.com/", "TestSiddhuService");
public static void main(String args[])
{
try {
URL wsdlURL = TestSiddhuService.WSDL_LOCATION;
if (args.length > 0 && args[0] != null && !"".equals(args[0])) {
File wsdlFile = new File(args[0]);
try {
if (wsdlFile.exists()) {
wsdlURL = wsdlFile.toURI().toURL();
} else {
wsdlURL = new URL(args[0]);
}
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
TestSiddhuService ss = new TestSiddhuService(wsdlURL, SERVICE_NAME);
TestSiddhu port = ss.getTestSiddhuPort();
{
System.out.println("Invoking add...");
java.lang.String _add_arg0 = "3";
java.lang.String _add_arg1 = "4";
java.lang.String _add__return = port.add(_add_arg0, _add_arg1);
System.out.println("add.result=" + _add__return);
}
}catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
public class TestSiddhuMain {
private static final QName SERVICE_NAME = new QName("http://test.com/", "TestSiddhuService");
public static void main(String args[])
{
try {
URL wsdlURL = TestSiddhuService.WSDL_LOCATION;
if (args.length > 0 && args[0] != null && !"".equals(args[0])) {
File wsdlFile = new File(args[0]);
try {
if (wsdlFile.exists()) {
wsdlURL = wsdlFile.toURI().toURL();
} else {
wsdlURL = new URL(args[0]);
}
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
TestSiddhuService ss = new TestSiddhuService(wsdlURL, SERVICE_NAME);
TestSiddhu port = ss.getTestSiddhuPort();
{
System.out.println("Invoking add...");
java.lang.String _add_arg0 = "3";
java.lang.String _add_arg1 = "4";
java.lang.String _add__return = port.add(_add_arg0, _add_arg1);
System.out.println("add.result=" + _add__return);
}
}catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
No comments:
Post a Comment