Question

Hello i am creating a J2ME application in which i need to call a web service for processing i am encrypting data and then calling web service

my code is working perfect on my Linux(Fedora) but not working on my windows and actual mobile Server is using JBoss and EJB

Code :-

CryptoEngine.setEncryptionKey("ROFTALPTNEMYAP1A");                      

String IMEI = "IMEI="+txtIMEI.getString();
String phoneno = "phoneNumber="+txtPhoneNo.getString();

System.out.println(IMEI);
System.out.println(phoneno);

String en = CryptoEngine.encryptString(phoneno + ";" + IMEI);
System.out.println(en);
byte[] ben = en.getBytes();
System.out.println("En = " + en);
String BaseEn = new String (Base64.encode(ben));


System.out.println("Base64 En = " + BaseEn);
form.append(en);

/*
 * Code For webservice
 */
A1Stubs.A1MobileService_Stub stub = new A1Stubs.A1MobileService_Stub();
stub._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY, "http://41.86.150.26:9090/A1Payment-A1Payment-ejb/A1MobileService");
String response = stub.getKey(BaseEn);
form.append("Reached After Web-service Called");
System.out.println(response);

/*
 * End  of Web Serivce
 */

byte[] baseDecode = Base64.decode(response);
String Decrypt = CryptoEngine.decryptString(new String(baseDecode));
System.out.println(Decrypt);
item.setText("Encrypted Text: \n"+en+"\n\n BASE64 Encryption: \n"+new String(Base64.encode(ben))+"\n\n Response of Web-Service : \n"+response+"\n\n BASE64 Decryption : \n"+new String(baseDecode)+"\n\n Decrypted Text : \n"+Decrypt);
display.setCurrent(form);

on windows machine i am getting following error after calling web service

java.rmi.ServerException: 
[Code:   env:Server] 
[String: String index out of range: -1] 
        at com.sun.j2mews.xml.rpc.OperationImpl.setupResStream(OperationImpl.java:380)
        at com.sun.j2mews.xml.rpc.OperationImpl.invoke(OperationImpl.java:236)

why i am facing this problem????

Was it helpful?

Solution

Seems like there is a problem server-side. This type of error indicates that there is nothing to read in the stream you received. You should check the server logs to see what happened.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top