Hi All,
I'm trying to make a java or JSP client to invoke webservice. I'm using Axis2
and Windows Vista.
Few days ago I asked about Service Object throwing exception of Can not
Initiliaze then Mr Deepal replied me that i was using Axis1 coding.
Then I move on to Axis2 coding. But I'm having the same Issue with Axis2 as
well.
I'm copying simple code and trying to access it but seems throwing exception
where i'm catching all exceptions with general "Exception" class. I know it is
not a good practice but if i put AxisFault exception, I get Exception "
Exception in thread "main" java.lang.NoClassDefFoundError:
org.apache.axis2.AxisFault"
In general terms I have realize that org.apache.axis2 's every class is
throwing an exception of java.lang.NoClassDefFoundError whereas I have pasted
axis2-kernel-1.2 into jdk1.6.\jre\lib\ext.
What do you think the problem is?
Below is coding:
import org.apache.axiom.om.OMAbstractFactory;import
org.apache.axiom.om.OMElement;import org.apache.axiom.om.OMFactory;import
org.apache.axiom.om.OMNamespace;import org.apache.axis2.AxisFault;import
org.apache.axis2.addressing.EndpointReference;import
org.apache.axis2.client.Options;import org.apache.axis2.client.ServiceClient;
public class EchoBlockingClient { private static EndpointReference
targetEPR = new
EndpointReference("http://127.0.0.1:8080/axis2/services/Random"); public
static void main(String[] args) { try {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace ns = fac.createOMNamespace("http://soapinterop.org/", "ns1");
OMElement payload = fac.createOMElement("echoString", ns);
payload.setText("Hello!"); Options
options = new Options(); ServiceClient client = new
ServiceClient(); options.setTo(targetEPR);
client.setOptions(options); //Blocking
invocation OMElement result =
client.sendReceive(payload); System.out.println("Sent
Hello, got : " + result.toString());
} catch (Exception e) {
}
}}
_________________________________________________________________
Kick back and relax with hot games and cool activities at the Messenger Café.
http://www.cafemessenger.com?ocid=TXT_TAGLM_SeptWLtagline