Generate Service Proxy with wsimport
Start
To generate a Web Service Capture Point service proxy for Java, use the wsimport utility, which is included in JDK:
wsimport -d <output directory> <WSDL URL>
For example:
wsimport -d c:\Temp\MyJSClient http://zoolander.us.int.genesyslab.com:10080/Genesys/Interaction/WSCP_812_zoo/WebServiceCapturePoint?wsdl
The tool generates a set of files for the proxy.
Create a simple Java console application to ping the service:
import java.net.URL; import javax.xml.namespace.QName; import javax.xml.ws.Holder; import com.genesyslab.interaction.*; public class Test { public static void main(String[] args) throws Exception { WebServiceCapturePoint service = new WebServiceCapturePoint(new URL("http://zoolander.us.int.genesyslab.com:10080/Genesys/Interaction/WSCP_812_zoo/WebServiceCapturePoint/?WSDL"),new QName("http://www.genesyslab.com/interaction", "WebServiceCapturePoint")); IWebServiceCapturePoint cp = service.getIWebServiceCapturePointHttpBinding(); KVPairValue val = new KVPairValue(); val.setValueString("I am coming from JAXWS client"); KVPair pair = new KVPair(); pair.setKey("Source"); pair.setValue(val); KVList extList = new KVList(); extList.getKvitem().add(pair); Holder<KVList> extension = new Holder<KVList>(extList); Holder<String> eventTime = new Holder<String>(); Holder<KVList> userData = new Holder<KVList>(); Holder<KVList> pingInfo = new Holder<KVList>(); cp.ping(extension, eventTime, userData, pingInfo); System.out.println("Ping response time:" + eventTime.value); printKVList("PingInfo", pingInfo.value); printKVList("UserData", userData.value); printKVList("Extension", extension.value); } public static void printKVList(String name, KVList kvList) { printKVList(name, kvList, ""); } private static void printKVList(String name, KVList kvList, String shift) { if (null == kvList) { System.out.println(shift + name + "[KVList]=null"); } else { System.out.println(shift + name + "[KVList]="); for (KVPair pair : kvList.getKvitem()) { KVPairValue value = pair.getValue(); if (value.getValueInt() != null) { System.out.println(shift + "\t" + pair.getKey() + "[int]=" + value.getValueInt()); } else if (null != value.getValueList()) { printKVList(pair.getKey(), value.getValueList(), shift + "\t"); } else { System.out.println(shift + "\t" + pair.getKey() + "[string]=" + value.getValueString()); } } } } }
End
This page was last edited on June 18, 2020, at 10:43.
Comments or questions about this documentation? Contact us for support!