This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Grokking Bitcoin and have Kalle Rosenbaum on-line!
See this thread for details.
Win a copy of Grokking Bitcoin this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

InvocationTargetException  RSS feed

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
To avoid criticism do nothing, say nothing, be nothing. -Elbert Hubbard. Please critique this tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!