Forums Register Login

Axis custom return types

+Pie Number of slices to send: Send
I want to return a custom object from call.invoke(). I am able to define the custom object as an imput parameter, but when I try to return the same object the serializer says it does not know what the object is.

" org.xml.sax.SAXException: Deserializing parameter 'findLoanApplicationReturn': could not find deserializer for type {urn:LoanAppService}Loan"

Am I missing a setup method? Or something in the WSDD?

Custom Object:

import java.io.Serializable;

public class LoanApplicationVO implements Serializable{

private static final long serialVersionUID = 1L;
private int loanID = 10;

public int getLoanID() {
return loanID;
}

public void setLoanID(int loanID) {
this.loanID = loanID;
}

public static long getSerialVersionUID() {
return serialVersionUID;
}


}



Client Code:

package bd.client;

import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;

import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.ServiceException;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.ser.BeanDeserializerFactory;
import org.apache.axis.encoding.ser.BeanSerializerFactory;

import ws.loan.vo.LoanApplicationVO;

public class LoanBD {


public void findLoanApplication(){
try {
LoanApplicationVO lApp = new LoanApplicationVO();

String endPoint;
String operation;

endPoint = "http://localhost:8080/axis/services/LoanProcessor";
operation = "findLoanApplication";

QName qOperation = new QName(endPoint, operation);
QName qLoanApp = new QName( "urn:LoanAppService", "LoanApplicationVO" );

URL urlPoint = new URL(endPoint);

Object objArgs[] = new Object[] {lApp};
Service service = new Service();
Call call = (Call) service.createCall();

call.setTargetEndpointAddress(urlPoint);
call.setOperationName(qOperation);

call.registerTypeMapping(LoanApplicationVO.class, qLoanApp,
new BeanSerializerFactory(LoanApplicationVO.class, qLoanApp),
new BeanDeserializerFactory(LoanApplicationVO.class, qLoanApp));

call.addParameter( "arg1", qLoanApp, ParameterMode.IN );
call.setReturnQName(qLoanApp);

LoanApplicationVO retL = (LoanApplicationVO) call.invoke(objArgs);
System.out.println(retL.getLoanID());

} catch (MalformedURLException e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
} catch (ServiceException e) {
e.printStackTrace();
}




}


}

WSDD entry:

<service name="LoanProcessor" provider="java:RPC">
<parameter name="className" value="ws.loan.LoanProcessor"/>
<parameter name="allowedMethods" value="findLoanApplication"/>
<beanMapping qname="myNS:Loan" xmlns:myNS="urn:LoanAppService" languageSpecificType="java:ws.loan.vo.LoanApplicationVO"/>
</service>
[ March 31, 2006: Message edited by: M Burke ]
+Pie Number of slices to send: Send
I found the answer. I called call.setReturnQName(qLoanApp) rather than call.setReturnType(qLoanApp)
I am going to test your electrical conductivity with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 2090 times.
Similar Threads
Axis No Serializer Found error...
How to return back an object ?
Accessing .NET web service from java
To Pass a ArrayList using WebServices
question about stateful webservice
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 09:54:48.