I'm tring to run my web service client. Below is the code. I'm getting the following error. Can you please help me?
Exception in thread "main" java.lang.ClassCastException: java.lang.NoSuchMethodError
at com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.doSend(SOAPMessageDispatcher.java:266)
at com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.send(SOAPMessageDispatcher.java:137)
at com.sun.xml.ws.client.dispatch.impl.DispatchDelegate.send(DispatchDelegate.java:71)
at com.sun.xml.ws.client.dispatch.DispatchBase.sendAndReceive(DispatchBase.java:295)
at com.sun.xml.ws.client.dispatch.DispatchBase.invoke(DispatchBase.java:120)
at com.citi.cibtech.esf.ESFJAXWSClient.invokeSubmitTrade(ESFJAXWSClient.java:117)
at com.citi.cibtech.esf.ESFJAXWSClient.main(ESFJAXWSClient.java:70)
private void invokeSubmitTrade(String msgString) throws RemoteException {
SOAPMessage message = null;
try {
MessageFactory factory = MessageFactory.newInstance();
message = factory.createMessage();
message.getSOAPPart().setContent((Source) new StreamSource(new StringReader(msgString)));
message.saveChanges();
} catch (SOAPException e) {
e.printStackTrace();
}
Dispatch<SOAPMessage> smDispatch = null;
smDispatch = service.createDispatch(portQName, SOAPMessage.class, Service.Mode.MESSAGE);
System.out.println("\nInvoking message: " + msgString);
SOAPMessage response = (SOAPMessage)smDispatch.invoke(message);
String xmlString = null;
try {
Source result = response.getSOAPPart().getContent();
xmlString = sourceToXMLString(result);
} catch (SOAPException e) {
e.printStackTrace();
}
System.out.println("Received response: " + xmlString);
}
Thanks,
Raj Devershetty