J2me Web服务调用和错误java.rmi.ServerException:

时间:2010-12-13 08:58:52

标签: java java-me jboss webservice-client midlet

您好我正在创建一个J2ME应用程序,我需要在其中调用Web服务进行处理 我正在加密数据,然后调用Web服务

我的代码在我的Linux(Fedora)上工作得很好,但是我的窗口和实际的移动设备上没有工作 服务器正在使用JBoss和EJB

代码: -

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);
在Windows机器上

我在调用Web服务后出现以下错误

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)

为什么我要面对这个问题????

1 个答案:

答案 0 :(得分:0)

似乎服务器端存在问题。此类错误表示您收到的流中没有任何内容可读。您应该检查服务器日志以查看发生的情况。