• 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

dii client problems..help!

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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");
}
}
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Balaji Loganathan
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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..
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic