• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Junit Test Case for axis WebService

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have written a test case using junit. I am executing it through the Eclipse 3.2 IDE.

The test case is a client for a webservice. it is as follows:

public class TestCategoryReports extends TestCase {
private String localHostEndPoint;
private String targetNameSpace;
private String serviceName;
private String portName;

public TestCategoryReports() {
localHostEndPoint= "http://127.0.0.1:8181/axis/services/MstrCatReports?wsdl";
targetNameSpace = "urn:com.aah.CategoryReports";
serviceName = "CategoryReports";
portName = "MstrCategoryReports";
}


public void testGetEnterpriseProdGroupReportOneItem() {
BranchAccount[] barray = new BranchAccount[1];
BranchAccount bAccount = new BranchAccount("606R", "00104034J");
barray[0] = bAccount;
Service service = new Service();
try{
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new URL(localHostEndPoint));
call.setOperation(new QName(targetNameSpace),"getEnterpriseProdGroupReport");
EnterpriseProductCategoryReportOutput ret = (EnterpriseProductCategoryReportOutput)call.invoke(barray);
}catch(Exception e){
System.out.println("Exception Caught");
fail("exception caught " + e);
}
}

Whenever I execute this test case it fails with:

org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:145)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:345)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2448)
at org.apache.axis.client.Call.invoke(Call.java:2347)
at org.apache.axis.client.Call.invoke(Call.java:1804)
at com.aah.categoryReports.axis.TestCategoryReports.testGetEnterpriseProdGroupReportNoItems(TestCategoryReports.java:43)
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:585)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:228)
at junit.framework.TestSuite.run(TestSuite.java:223)
at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)


I know my webservice code works since I can call it from a web based diagnostic tool that I have (SoapScope). I have also run org.apache.axis.utils.tcpmon and it shows that the request and response is coming back correct when I run the junit test case.

The problem is that in eclipse, I get the above exception trace.

Any ideas???
 
Come have lunch with me Arthur. Adventure will follow. This tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic