• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

InvocationTargetException

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm using a demo example to return a object(Company class) via web services.

CompanyWS.jws
-------------
public class CompanyWS{

/**
* @return company object
*/
public Company getCompanyData(int optionalInt){
Company company = new Company();
String [] employeeNames = new String[] { "Hari", "Vijay" , "Nischal" };
company.companyID = 8929;
company.companyName = "ABC";
company.employeeNames = employeeNames;
return company;
}
}

class Company {
public int companyID;
public String companyName;
public String[ ] employeeNames;
}


CompanyClient.java
------------------
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;


public class CompanyClient {

public static void main(String [] args) throws Exception {


Service service = new Service();
Call call = (Call)service.createCall();
String endpoint = "http://localhost:8080/axis/CompanyWS.jws";
call.setTargetEndpointAddress(new URL(endpoint));
call.setOperationName(new QName("getCompanyData"));

call.addParameter("param1", new QName("XSD_INTEGER"),ParameterMode.IN);
call.setReturnType(new QName("XSD_ANYTYPE"));
Integer[] inputParams = new Integer[]{new Integer(2)};

Object responseObject = new Object();
responseObject = (Object)call.invoke(inputParams);

System.out.println("Got responseObject: " + responseObject);

}
}

The problem is when line:
responseObject = (Object)call.invoke(inputParams);

is executed...it gives following error:

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:raminder-singh

java.lang.reflect.InvocationTargetException
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at CompanyClient.main(CompanyClient.java:25)
Exception in thread "main"

I have checked few help via google....but still unable to resolve it.
Please help me to solve that.

thanks.
 
Raminder Singh
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just to add more:
-----------------
Company.class is in axis\WEB-INF\classes.(Is it right?)

and CompanyWS.jws is in axis folder.
(It generates CompanyWS.class + Company.class in axis\WEB-INF\jwsClasses.
 
reply
    Bookmark Topic Watch Topic
  • New Topic