ClassCastException in axis2_09

2005-11-22 Thread thilina madu
  Hi all,I am accessing a web service by using axis2_0.9 version.That give bellow mention error while accessing the that.(when I check it out by using TCPMON that returned same soapmessage.The error is pointed to serializattion)  any kind of comment is highly appreciatedkind regards,madushan thilina.//errorjava.lang.ClassCastExceptionat Test.main(Test.java:88)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java.lang.reflect.Method.invoke(Method.java:324)at
 com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)Exception in thread "main" Process finished with exit code 1  //method where define the getEchoFloat()   public class InteropTestClass { private OMElement CreatOMObject(String elementName){  OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace omNs = fac.createOMNamespace("http://example1.org/example1", "exam");  OMElement value = fac.createOMElement(elementName,
 omNs); return value; } //1.method for eachoing the float public OMElement getEchoFloat(String nameSpace,String schema,String elementName, EndpointReference targetEPR ) throws AxisFault {   OMElement value=CreatOMObject("float"); BufferedReader br = new BufferedReader(new
 InputStreamReader(System.in)); String text = ""; try { text = br.readLine(); } catch (IOException e) { e.printStackTrace(); }
   
  value.setText(text);   OMElement payload = value;   Call call = new Call(); call.setTo(targetEPR); call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP, false); OMElement result= call.invokeBlocking("echoFloat",payload); 
  return result;   }  }//main method for accessing  public static void main(String args[]) throws IOException, XMLStreamException {   EndpointReference targetEPR = new EndpointReference(AddressingConstants.WSA_TO, "http://127.0.0.1:8080/axis2/services/InteropTest/echoFloat");  InteropTestClass objInterop=new InteropTestClass();   //1.Echoing 
 the
 float value System.out.println("Enter the value");   OMElement resultfloat = objInterop.getEchoFloat("http://example1.org/example1","exam", "Float",targetEPR);   System.out.println("Display the result");   StringWriter writer1 = new StringWriter(); resultfloat.serializeWithCache((OMOutput) XMLOutputFactory.newInstance().createXMLStreamWriter(writer1)); writer1.flush();   System.out.println();
 mp;n
 bsp; System.out.println(resultfloat.getText()); }  Yahoo! FareChase - Search multiple travel sites in one click. 
		 Yahoo! FareChase - Search multiple travel sites in one click.

 

 

Re: ClassCastException in axis2_09

2005-11-22 Thread Thilina Gunarathne
Here's the error...
resultfloat.serializeWithCache((OMOutput) XMLOutputFactory.newInstance().createXMLStreamWriter(writer1));

createXMLStreamWriter returns a XMLStreamWriter... You cannot cast it to am OMOutput. You can construct an OMOutput giving a XMLStreamWriter instance. 

BTW lot of things have changed since .9. Even the OMOutput is renamed to OMOutputImpl..

~Thilina
On 11/22/05, thilina madu [EMAIL PROTECTED] wrote:





Hi all,I am accessing a web service by using axis2_0.9 version.That give bellow mention error while accessing the that.(when I check it out by using TCPMON that returned same soapmessage.The error is pointed to serializattion)

any kind of comment is highly appreciated

kind regards,madushan thilina.

//errorjava.lang.ClassCastExceptionat Test.main(Test.java:88)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java
:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java.lang.reflect.Method.invoke(Method.java:324)at com.intellij.rt.execution.application.AppMain.main(AppMain.java
:78)Exception in thread main Process finished with exit code 1


//method where define the getEchoFloat()
 public class InteropTestClass {

 private OMElement CreatOMObject(String elementName){  OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace omNs = fac.createOMNamespace(
http://example1.org/example1, exam);  OMElement value = fac.createOMElement(elementName, omNs); return value; }

 //1.method for eachoing the float public OMElement getEchoFloat(String nameSpace,String schema,String elementName, EndpointReference targetEPR ) throws AxisFault {

 OMElement value=CreatOMObject(float); BufferedReader br = new BufferedReader(new InputStreamReader(
System.in)); String text = ; try { text = br.readLine(); } catch (IOException e) { 
e.printStackTrace(); } 
 value.setText(text);
 OMElement payload = value;
 Call call = new Call(); call.setTo(targetEPR); call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP, false); OMElement result= 
call.invokeBlocking(echoFloat,payload);
 return result;
 }
}



//main method for accessing  public static void main(String args[]) throws IOException, XMLStreamException {
 EndpointReference targetEPR = new EndpointReference(AddressingConstants.WSA_TO, 
http://127.0.0.1:8080/axis2/services/InteropTest/echoFloat);
 
 InteropTestClass objInterop=new InteropTestClass();
 //1.Echoing the float value System.out.println(Enter the value);
 OMElement resultfloat = objInterop.getEchoFloat(http://example1.org/example1,exam
, Float,targetEPR);
 System.out.println(Display the result);
 StringWriter writer1 = new StringWriter(); resultfloat.serializeWithCache((OMOutput) XMLOutputFactory.newInstance().createXMLStreamWriter(writer1)); writer1.flush();

 System.out.println();a mp;n bsp; System.out.println(resultfloat.getText()); }



Yahoo! FareChase - Search multiple travel sites in one click. 




Yahoo! FareChase - Search multiple travel sites in one click. 
-- May the SourcE be with uhttp://webservices.apache.org/~thilina/
http://thilinag.blogspot.com/ http://www.bloglines.com/blog/Thilina 


ClassCastException in axis2_09

2005-11-20 Thread thilina madu
  Hi all,I am accessing a web service by using axis2_0.9 version.That give bellow mention error while accessing the that.(when I check it out by using TCPMON that returned same soapmessage.The error is pointed to serializattion)  any kind of comment is highly appreciatedkind regards,madushan thilina.//errorjava.lang.ClassCastExceptionat Test.main(Test.java:88)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java.lang.reflect.Method.invoke(Method.java:324)at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)Exception in thread "main" Process finished with exit code 1 
 //method where define the getEchoFloat()   public class InteropTestClass { private OMElement CreatOMObject(String elementName){  OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace omNs = fac.createOMNamespace("http://example1.org/example1", "exam");  OMElement value = fac.createOMElement(elementName, omNs); return
 value; } //1.method for eachoing the float public OMElement getEchoFloat(String nameSpace,String schema,String elementName, EndpointReference targetEPR ) throws AxisFault {   OMElement value=CreatOMObject("float"); BufferedReader br = new BufferedReader(new
 InputStreamReader(System.in)); String text = ""; try { text = br.readLine(); } catch (IOException e) { e.printStackTrace(); }
  
  value.setText(text);   OMElement payload = value;   Call call = new Call(); call.setTo(targetEPR); call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP, false); OMElement result= call.invokeBlocking("echoFloat",payload); 
  return result;   }  }//main method for accessing  public static void main(String args[]) throws IOException, XMLStreamException {   EndpointReference targetEPR = new EndpointReference(AddressingConstants.WSA_TO, "http://127.0.0.1:8080/axis2/services/InteropTest/echoFloat");  InteropTestClass objInterop=new InteropTestClass();   //1.Echoing 
 the
 float value System.out.println("Enter the value");   OMElement resultfloat = objInterop.getEchoFloat("http://example1.org/example1","exam", "Float",targetEPR);   System.out.println("Display the result");   StringWriter writer1 = new StringWriter(); resultfloat.serializeWithCache((OMOutput) XMLOutputFactory.newInstance().createXMLStreamWriter(writer1)); writer1.flush();   System.out.println();
 bsp;
 System.out.println(resultfloat.getText()); }
		 Yahoo! FareChase - Search multiple travel sites in one click.