File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes dii client problems..help! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "dii client problems..help!" Watch "dii client problems..help!" New topic
Author

dii client problems..help!

Catalin Barcau
Greenhorn

Joined: May 14, 2004
Posts: 6
i have written a dii client. when running i get the following error:

java.rmi.RemoteException: JAXRPC.TIE.01: caught exception while handling request
: deserialization error: deserialization error: java.lang.NumberFormatException:
For input string: ""
at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:462)
at websrv.TestClient.main(TestClient.java:68)


the code for the client is given below.sorry for the way it looks, i treied everything with it in the last hours

package websrv;
import java.util.*;
//import ejb.*;
//import javax.naming.*;
import javax.rmi.PortableRemoteObject;
//import javax.ejb.EJBHome;
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;
import java.rmi.RemoteException;
import javax.xml.rpc.Stub;
//import websrv.*;

public class TestClient {
static Integer a = new Integer(12);
static Integer b = new Integer(24);

private static String qnameService = "CartWebService";
private static String qnamePort = "CartWebFace";

private static String BODY_NAMESPACE_VALUE =
"urn:Foo";
private static String ENCODING_STYLE_PROPERTY =
"javax.xml.rpc.encodingstyle.namespace.uri";
private static String NS_XSD = "http://www.w3.org/2001/XMLSchema";
//"http://java.sun.com/xml/ns/jax-rpc/ri/config";
//"http://www.w3.org/2001/XMLSchema";
private static String URI_ENCODING =
"http://schemas.xmlsoap.org/soap/encoding/";
public static void main(String[] args) throws RemoteException
{
//String str = "";
// Get an initial context
System.out.println("Endpoint address = http://192.168.0.1:8080/cart-web/cart");
String result = "";
Integer params[] = new Integer[2];
try
{
ServiceFactory factory = ServiceFactory.newInstance();
Service service = factory.createService(new QName(qnameService));
System.out.println("sunt la 1");
QName port = new QName(qnamePort);

Call call = service.createCall(port);
call.setTargetEndpointAddress("http://192.168.0.1:8080/cart-web/cart");
System.out.println("sunt la 2");
call.setProperty(Call.SOAPACTION_USE_PROPERTY, new Boolean(true));
System.out.println("sunt la 3");
call.setProperty(Call.SOAPACTION_URI_PROPERTY, "");
System.out.println("sunt la 4");
call.setProperty(ENCODING_STYLE_PROPERTY, URI_ENCODING);

QName QNAME_TYPE_INTEGER = new QName(NS_XSD, "integer");
QName QNAME_TYPE_STRING = new QName(NS_XSD, "string");

call.setReturnType(QNAME_TYPE_STRING);

call.setOperationName(new QName(BODY_NAMESPACE_VALUE,"add"));
call.addParameter("Integer_1", QNAME_TYPE_INTEGER, ParameterMode.IN);
call.addParameter("Integer_2", QNAME_TYPE_INTEGER, ParameterMode.IN);
System.out.println("sunt la 5");
params[0] = a;
params[1] = b;
System.out.println("sunt la 6");
result = (String)call.invoke(params);
System.out.println(result);
System.out.println("sunt la 7");
//System.out.println("sunt la 8");

}
catch (Exception ex)
{
ex.printStackTrace();
System.exit(1);
}

//System.out.println("ejb calling web service");
}
}
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Try using int instead of integer
static Int a = 12;
static Int b = 24;
this link Int Vs Integer may also help you to know the difference.
LEt me know if its works.


Spritle Software Blogs
Arun Prasath
Ranch Hand

Joined: Sep 17, 2003
Posts: 192
hi Balaji,
I am also getting the same error.
The call.invoke() requires array of objects as a parameter.
When we use int, without Integer we wont be able to pass values isnt it?
so how to resolve this error?


SCJP 1.4, SCDJWS , SCJA<br />I can do ALL things through CHRIST who strengthens me.
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Originally posted by Arun Prasath:
hi Balaji,
I am also getting the same error.
The call.invoke() requires array of objects as a parameter.
When we use int, without Integer we wont be able to pass values isnt it?
so how to resolve this error?


Its possible..
like..
int a = 20;
int b = 3;
call.invoke(new java.lang.Object[] {new java.lang.Integer(a), new java.lang.Integer(b)});
Catalin Barcau
Greenhorn

Joined: May 14, 2004
Posts: 6
solved the problem...
the following lines:
QName QNAME_TYPE_INTEGER = new QName(NS_XSD, "integer");
QName QNAME_TYPE_STRING = new QName(NS_XSD, "string");


should read
QName QNAME_TYPE_INTEGER = new QName(URI_ENCODING, "int");
QName QNAME_TYPE_STRING = new QName(NS_XSD, "string");

this solved the problem...however i have a new question...
can someone give me some help as to what i am supposed to do to be able to send and receive custom data types(class with 3 strings, one integer and one float, for exemple)?

Yhanks all for your help...I look forward to your suggestions!
vijay rajendran
Greenhorn

Joined: Mar 02, 2006
Posts: 3
Hi i'm also genrating a DII client by while executing the client it gives me the following error

Caught Exception in DII :JAXRPCTIE01: caught exception while handling request: deserialization error: java.lang.NumberFormatException: For input string: ""

if u need i'll sned my code too
need some ideas to proceed further..
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39551
    
  27
to send and receive custom data types(class with 3 strings, one integer and one float, for exemple)

Axis has the Bean Serializer for this, which makes transferring objects that are Java Beans quite easy.
[ March 03, 2006: Message edited by: Ulf Dittmer ]

Ping & DNS - updated with new look and Ping home screen widget
 
jQuery in Action, 2nd edition
 
subject: dii client problems..help!
 
Similar Threads
Encoding style not supported
Eliminate Namespace preceding WS Call with JAX-RPC
Error while Calling createService in DII Client
How do I return simple object via web services
Running a DII client through JSP