Try to replace this line:
String[] params = {"1111-1111-1111-1111", "09/2004", "100.0"};
with this:
Object[] params = {"1111-1111-1111-1111", "09/2004", new
Double(100.0)};
----- Original Message -----
From: "Ramasamy S/O Valliappan" <rama_at_SIMTECH.A-STAR.EDU.SG>
To: <JAXRPC-INTEREST_at_JAVA.SUN.COM>
Sent: Friday, May 02, 2003 11:43 AM
Subject: JAX-RPC Dynamic client DOUBT !!!
Hi guys
I have a web service taking in String, String and Double parameters as
input.
I want to know how to write my jax-rpc dynamic client with double
and string as parameters which is as follows :
package credit_client;
import javax.xml.rpc.Call;
import javax.xml.rpc.Service;
import javax.xml.rpc.JAXRPCException;
import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceFactory;
import javax.xml.rpc.ParameterMode;
public class CreditClient {
private static String endpoint =
"
http://localhost:8080/credit-jaxrpc/credit";
private static String qnameService = "MyCredit";
private static String qnamePort = "CreditIF";
private static String BODY_NAMESPACE_VALUE =
"
http://com.test/wsdl/MyCredit";
private static String ENCODING_STYLE_PROPERTY =
"javax.xml.rpc.encodingstyle.namespace.uri";
private static String NS_XSD = "
http://www.w3.org/2001/XMLSchema";
private static String URI_ENCODING =
"
http://schemas.xmlsoap.org/soap/encoding/";
public static void main(String[] args) {
try {
ServiceFactory factory = ServiceFactory.newInstance();
Service service = factory.createService(new
QName(qnameService));
QName port = new QName(qnamePort);
Call call = service.createCall(port);
call.setTargetEndpointAddress(endpoint);
call.setProperty(Call.SOAPACTION_USE_PROPERTY,new
Boolean(true));
call.setProperty(Call.SOAPACTION_URI_PROPERTY, "");
call.setProperty(ENCODING_STYLE_PROPERTY, URI_ENCODING);
QName QNAME_TYPE_STRING = new QName(NS_XSD, "string");
QName QNAME_TYPE_DOUBLE = new QName(NS_XSD, "double");
QName QNAME_TYPE_BOOLEAN = new QName(NS_XSD, "boolean");
call.setReturnType(QNAME_TYPE_BOOLEAN);
call.setOperationName(new
QName(BODY_NAMESPACE_VALUE,"checkValidLimit"));
call.addParameter("String_1", QNAME_TYPE_STRING,
ParameterMode.IN);
call.addParameter("String_2", QNAME_TYPE_STRING,
ParameterMode.IN);
call.addParameter("Double_3", QNAME_TYPE_DOUBLE,
ParameterMode.IN);
//The third parameter is of Double data type
String[] params = {"1111-1111-1111-1111", "09/2004", "100.0"};
Boolean result = (Boolean) call.invoke(params);
System.out.println(result);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
From
V. RAM
www.jssl.org