Legacy application as web services using Axis
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   sender_jones
Posted On:   Wednesday, February 16, 2005 02:23 AM

I followed Paul Tremblett's article "Web Services & Apache Axis" in DDJ Nov. 2004 to try putting my legacy java program as web services. The article use Java2WSDL to generate the wsdl and WSDL2Java to generate the service, locater and stub etc. When I use a simple trial java program with a method just returns a long value, the web service works as expected. But when I use a real program which connects an url and parses a html, the client aborts with java.lang.reflect.InvocationTargetException . Here is the extracts of my legacy program: public class test_html_parser { public static void main(String a[]) throws Exception { ...... System.out.println("fo   More>>

I followed Paul Tremblett's article "Web Services & Apache Axis" in DDJ Nov. 2004 to try putting my legacy java program as web services. The article use Java2WSDL to generate the wsdl and WSDL2Java to generate the service, locater and stub etc.


When I use a simple trial java program with a method just returns a long value, the web service works as expected. But when I use a real program which connects an url and parses a html, the client aborts with java.lang.reflect.InvocationTargetException .


Here is the extracts of my legacy program:

			
public class test_html_parser {
public static void main(String a[]) throws Exception {
......
System.out.println("for " + stk_code); <-- this one showed up in Tomcat
String source = "...............";
URL url = new URL(source);
System.out.println("url ok"); <-- this one didn't
.........
} //end main
public static class HTMLParse extends HTMLEditorKit {
.....
} //end HTMLParse
protected static class ParserCB
extends HTMLEditorKit.ParserCallback {
.......
} //end ParserCB
}//end test_html_parser


Here is the TestParserSoapBindingImpl.java which I've modified to call the service.
			
/**
* TestparserSoapBindingImpl.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
*/

package ws_testparser;

import test.test_html_parser;

public class TestparserSoapBindingImpl implements ws_testparser.Test_html_parser{
public test_html_parser t = null;
public TestparserSoapBindingImpl() {
t = new test_html_parser();
}
public void main(java.lang.String[] in0) throws java.rmi.RemoteException {
try {
t.main(in0);
} catch (java.lang.Exception e) {
throw new java.rmi.RemoteException();
}
}

}

Any idea what's wrong?    <<Less

Re: Legacy application as web services using Axis

Posted By:   Anonymous  
Posted On:   Tuesday, February 22, 2005 09:40 PM

Hey,



Check the end point URL and the method name in the stub.


If this is not the case Check the Data type you are passing in the webservice.


May be the Axis is not supporting the datatype u r using.

Re: Legacy application as web services using Axis

Posted By:   sender_jones  
Posted On:   Wednesday, February 16, 2005 11:46 PM

I've gathered further info about the fault:

AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.lang.reflect.InvocationTargetException
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}hostname:nt245

Where can I know more about faultCode?
About | Sitemap | Contact