Java Question java.lang.ClassCastException: WEBSRM_ResponseWrapper cannot be cast to class WEBSRM_Response

jahswant

Well-Known Member
Licensed User
Longtime User
I saw that when kept in a map or list the Wrapped object is returned as original type and not the wrapper.

(MyMap) {WEB_SRM_Response=(WEBSRM_Response) ca.logichic.foframework.WEBSRM_Response@2422fc3b, SUCCESS=true, ResponseCertificats=ca.logichic.foframework.ResponseCertificats@26b97e48}

When passed to events they work properly.

I have this class and it's wrapper.

Java:
package ca.logichic.foframework;

import okhttp3.Response;
import anywheresoftware.b4a.BA.Hide;

@Hide
public class WEBSRM_Response {
    /**
     * HTTP response status code
     */
    public int StatusCode = 0;

    /**
     * Description of HTTP status returned
     */
    public String StatusDescription = "";

    /**
     * Contains the JSON document received from the WEB-SRM
     * Contient le document JSON reçu du MEVWEB
     */
    public String ResponseJsonWEBSRM = "";

    /**
     * Exception caused by a communication problem with the WEB-SRM and managed by the SEV
     * Exception provoquée par un problème de communication avec le MEV-WEB et gérée par le SEV
     */
    public Exception ResponseExceptionWEBSRM;

    /**
     * HTTP response from WEB-SRM containing success or error codes
     * Réponse HTTP du MEV-WEB contenant les codes de succès ou d'erreurs
     */
    public Response HttpResponseMessageWEBSRM;

    public WEBSRM_Response() {
    }
}

The wrapper.


Java:
package ca.chicpos.mevweb;

import anywheresoftware.b4a.AbsObjectWrapper;
import anywheresoftware.b4a.BA.ShortName;
import ca.logichic.foframework.WEBSRM_Response;
import okhttp3.Response;

@ShortName("WEBSRM_Response")
public class WEBSRM_ResponseWrapper extends AbsObjectWrapper<WEBSRM_Response> {

    private WEBSRM_Response mWEBSRM_Response;

    public void Initialize() {
        mWEBSRM_Response = new WEBSRM_Response();
        this.setObject(mWEBSRM_Response);
    }

    public int getStatusCode() {
        return this.getObject().StatusCode;
    }

    public String getStatusDescription() {
        return this.getObject().StatusDescription;
    }

    public String getResponseJsonWEBSRM() {
        return this.getObject().ResponseJsonWEBSRM;
    }

    public Exception getResponseExceptionWEBSRM() {
        return this.getObject().ResponseExceptionWEBSRM;
    }

    public Response getHttpResponseMessageWEBSRM() {
        return this.getObject().HttpResponseMessageWEBSRM;
    }

    public void setStatusCode(int statusCode) {
        this.getObject().StatusCode = statusCode;
    }

    public void setStatusDescription(String statusDescription) {
        this.getObject().StatusDescription = statusDescription;
    }

    public void setResponseJsonWEBSRM(String responseJsonWEBSRM) {
        this.getObject().ResponseJsonWEBSRM = responseJsonWEBSRM;
    }

    public void setResponseExceptionWEBSRM(Exception responseExceptionWEBSRM) {
        this.getObject().ResponseExceptionWEBSRM = responseExceptionWEBSRM;
    }

    public void setHttpResponseMessageWEBSRM(Response httpMessageResponseWEBSRM) {
        this.getObject().HttpResponseMessageWEBSRM = httpMessageResponseWEBSRM;
    }
}


I've been using this for a while now. I now have an issue returning the wrapper to B4J in a map or a list. It complains of a classcast wrapper cannot be casted to wrapped class.
this is how I use it.


Java:
        WEBSRM_Response WEB_SRM_Response = UtilesJSON.CertificatesRequest(ValeursPossibles.Modif.REM,
                HTTPHeadersDicti, jSon, _ALIAS_CERTIFICAT.SEV, KEY_PAIRS_DIR, changeItPass,TimeOutSeconds);
     
        WEBSRM_ResponseWrapper mWEBSRM_ResponseWrapper = new WEBSRM_ResponseWrapper();
        mWEBSRM_ResponseWrapper.Initialize();
        mWEBSRM_ResponseWrapper.setObject(WEB_SRM_Response);
        myMap.Put("WEB_SRM_Response", mWEBSRM_ResponseWrapper);

When I try getting it as athe wrapped object in B4Jas this I get.

B4X:
Dim WEB_SRM_Response As WEBSRM_Response = CertificateMap.Get("WEB_SRM_Response")

B4X:
java.lang.RuntimeException: java.lang.ClassCastException: class ca.chicpos.mevweb.WEBSRM_ResponseWrapper cannot be cast to class ca.logichic.foframework.WEBSRM_Response (ca.chicpos.mevweb.WEBSRM_ResponseWrapper and ca.logichic.foframework.WEBSRM_Response are in unnamed module of loader 'app')
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:140)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
    at anywheresoftware.b4j.object.JServlet$Handle.run(JServlet.java:146)
    at anywheresoftware.b4j.object.JServlet.Handle(JServlet.java:126)
    at anywheresoftware.b4j.object.JServlet.doPost(JServlet.java:96)
    at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:520)
    at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:587)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)
    at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1630)
    at org.eclipse.jetty.servlets.DoSFilter.doFilterChain(DoSFilter.java:483)
    at org.eclipse.jetty.servlets.DoSFilter.doFilter(DoSFilter.java:332)
    at org.eclipse.jetty.servlets.DoSFilter.doFilter(DoSFilter.java:297)
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1600)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:506)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1571)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1375)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:463)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1544)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1297)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:141)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
    at org.eclipse.jetty.server.Server.handle(Server.java:562)
    at org.eclipse.jetty.server.HttpChannel.lambda$handle$0(HttpChannel.java:505)
    at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:762)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:497)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:282)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:319)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
    at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:412)
    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:381)
    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:268)
    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.lambda$new$0(AdaptiveExecutionStrategy.java:138)
    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:407)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:894)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1038)
    at java.base/java.lang.Thread.run(Thread.java:1589)
Caused by: java.lang.ClassCastException: class ca.chicpos.mevweb.WEBSRM_ResponseWrapper cannot be cast to class ca.logichic.foframework.WEBSRM_Response (ca.chicpos.mevweb.WEBSRM_ResponseWrapper and ca.logichic.foframework.WEBSRM_Response are in unnamed module of loader 'app')
    at ca.chicpos.server.mevweb_query._replacecertificate(mevweb_query.java:3091)
    at ca.chicpos.server.mevweb_query$ResumableSub_PROCESS_QUERY.resume(mevweb_query.java:2286)
    at ca.chicpos.server.mevweb_query._process_query(mevweb_query.java:2140)
    at ca.chicpos.server.mevweb_query._handle(mevweb_query.java:2019)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
    at java.base/java.lang.reflect.Method.invoke(Method.java:578)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
    ... 42 more

How to solve this issue ?
 
Last edited:

jahswant

Well-Known Member
Licensed User
Longtime User
I actually inherited this code and for now I have to use it as but i will eventually upgrade.
 

jahswant

Well-Known Member
Licensed User
Longtime User
Maybe I misunderstood. Iremoved the instance object and went directly as this. Recompiled and refresed and I still get the same issue. Maybe I didn't get it.
Java:
package ca.chicpos.mevweb;

import anywheresoftware.b4a.AbsObjectWrapper;
import anywheresoftware.b4a.BA.ShortName;
import ca.logichic.foframework.WEBSRM_Response;
import okhttp3.Response;

@ShortName("WEBSRM_Response")
public class WEBSRM_ResponseWrapper extends AbsObjectWrapper<WEBSRM_Response> {

    public void Initialize() {
        setObject(new WEBSRM_Response());
    }

    public int getStatusCode() {
        return getObject().StatusCode;
    }

    public String getStatusDescription() {
        return getObject().StatusDescription;
    }

    public String getResponseJsonWEBSRM() {
        return getObject().ResponseJsonWEBSRM;
    }

    public Exception getResponseExceptionWEBSRM() {
        return getObject().ResponseExceptionWEBSRM;
    }

    public Response getHttpResponseMessageWEBSRM() {
        return getObject().HttpResponseMessageWEBSRM;
    }

    public void setStatusCode(int statusCode) {
        getObject().StatusCode = statusCode;
    }

    public void setStatusDescription(String statusDescription) {
        getObject().StatusDescription = statusDescription;
    }

    public void setResponseJsonWEBSRM(String responseJsonWEBSRM) {
        getObject().ResponseJsonWEBSRM = responseJsonWEBSRM;
    }

    public void setResponseExceptionWEBSRM(Exception responseExceptionWEBSRM) {
        getObject().ResponseExceptionWEBSRM = responseExceptionWEBSRM;
    }

    public void setHttpResponseMessageWEBSRM(Response httpMessageResponseWEBSRM) {
        getObject().HttpResponseMessageWEBSRM = httpMessageResponseWEBSRM;
    }
}
 

jahswant

Well-Known Member
Licensed User
Longtime User
Java:
    public anywheresoftware.b4a.objects.collections.Map ReplaceCertificate(String CertificateSerialNumberSRS) {
        
        anywheresoftware.b4a.objects.collections.Map myMap = new anywheresoftware.b4a.objects.collections.Map();
        myMap.Initialize();
        
        WEBSRM_ResponseWrapper mWEBSRM_ResponseWrapper = new WEBSRM_ResponseWrapper();

        try {

            String CSR = CertificateCreation();

            String jSon = UtilesJSON.getJsonCertificate(ValeursPossibles.Modif.REM, CSR, CertificateSerialNumberSRS);

            List<Entry<String, String>> HTTPHeadersDicti = getHTTPHeaders();

            WEBSRM_Response WEB_SRM_Response = UtilesJSON.CertificatesRequest(ValeursPossibles.Modif.REM,
                    HTTPHeadersDicti, jSon, _ALIAS_CERTIFICAT.SEV, KEY_PAIRS_DIR, changeItPass,TimeOutSeconds);
            
            mWEBSRM_ResponseWrapper.setObject(WEB_SRM_Response);
            
            myMap.Put("WEB_SRM_Response", mWEBSRM_ResponseWrapper);

            if (WEB_SRM_Response.ResponseExceptionWEBSRM == null) {

                if (WEB_SRM_Response.ResponseJsonWEBSRM.contains("listErr")) {

                    myMap.Put("SUCCESS", false);
                    myMap.Put("listErr", true);
                    
                } else {
                    if (WEB_SRM_Response.ResponseJsonWEBSRM != null && !WEB_SRM_Response.ResponseJsonWEBSRM.isEmpty()) {

                        ResponseCertificats responseCertificates = UtilesJSON
                                .parseResponseCertificates(WEB_SRM_Response.ResponseJsonWEBSRM);

                        ResponseCertificatsWrapper mResponseCertificats = new ResponseCertificatsWrapper();
                        mResponseCertificats.setObject(responseCertificates);
                        
                        myMap.Put("SUCCESS", true);
                        myMap.Put("ResponseCertificats", mResponseCertificats);

                        Path KeystorePath = Paths.get(KEY_PAIRS_DIR, "CHICPOS_KEYSTORE.p12");

                        if (KeystorePath.toFile().exists()) {
                            KeystorePath.toFile().delete();
                        }

                        _IDAPPRL = responseCertificates.IdApprl;

                        CertificateFactory cf = CertificateFactory.getInstance("X.509");
                        X509Certificate certPSI = (X509Certificate) cf.generateCertificate(
                                new ByteArrayInputStream(responseCertificates.CertificatMEVWEB.getBytes()));

                        Certificate certSEV = cf.generateCertificate(
                                new ByteArrayInputStream(responseCertificates.Certificat.getBytes()));

                        KeyStore ks = KeyStore.getInstance("PKCS12");
                        char[] password = changeItPass.toCharArray();
                        ks.load(null, password);

                        ks.deleteEntry(_ALIAS_CERTIFICAT.PSI);
                        ks.deleteEntry(_ALIAS_CERTIFICAT.SEV);

                        ks.setCertificateEntry(_ALIAS_CERTIFICAT.PSI, certPSI);

                        KeyPair keyPair = UtilesECDSA.loadKeyPairFromFile(_KeyPairName, KEY_PAIRS_DIR,changeItPass);

                        PrivateKey privateKey = keyPair.getPrivate();

                        ks.setKeyEntry(_ALIAS_CERTIFICAT.SEV, privateKey, changeItPass.toCharArray(),
                                new Certificate[] { certSEV });

                        X509Certificate cert = (X509Certificate) certSEV;
                        BigInteger serialNumber = cert.getSerialNumber();
                        String serialNumberHex = serialNumber.toString(16).toUpperCase();

                        if (serialNumberHex.length() % 2 != 0) {
                            serialNumberHex = "0" + serialNumberHex;
                        }

                        _CertificateSerialNumberSRS = serialNumberHex;

                        FileOutputStream fos = new FileOutputStream(KeystorePath.toFile());
                        ks.store(fos, password);
                        fos.close();
                                                
        
                    }

                }

            } else if (WEB_SRM_Response.ResponseExceptionWEBSRM != null) {
                ba.setLastException(WEB_SRM_Response.ResponseExceptionWEBSRM);   
                myMap.Put("SUCCESS", false);
                myMap.Put("listErr", false);
            }
            

        } catch (Exception e) {
            ba.setLastException(e);                       
            mWEBSRM_ResponseWrapper.setResponseExceptionWEBSRM (e);           
            myMap.Put("SUCCESS", false);
            myMap.Put("listErr", false);

        }
        
        myMap.Put("WEB_SRM_Response", mWEBSRM_ResponseWrapper);
        
      return myMap;
    }

B4J CODE

B4X:
Public Sub ReplaceCertificate(CertificateSerialNumberSRS As String) As Map
    Dim CertificateMap As Map
    CertificateMap.Initialize
    CertificateMap = MEV.ReplaceCertificate(CertificateSerialNumberSRS)   
    Return CertificateMap
End Sub

Dim MEV_WEB_CLASS_2 As MEV_WEB_CLASS
MEV_WEB_CLASS_2.Initialize(Me,"MEVCLASS",SET_ID)
Dim CertificateSerialNumberSRS As String = APICOMMANDO.Parameters(1)
Dim CertificateMap As Map = MEV_WEB_CLASS_2.ReplaceCertificate(CertificateSerialNumberSRS)
Log(CertificateMap)
Dim WEB_SRM_Response As WEBSRM_Response = CertificateMap.Get("WEB_SRM_Response")


B4X:
Dec 18, 2024 2:07:09 A.M. okhttp3.internal.platform.Platform log
INFO: --> POST https://cnfr.api.rq-fo.ca/certificats (721-byte body)
Dec 18, 2024 2:07:10 A.M. okhttp3.internal.platform.Platform log
INFO: <-- 201 Created https://cnfr.api.rq-fo.ca/certificats (1730ms, 3017-byte body)
(MyMap) {WEB_SRM_Response=(WEBSRM_Response) ca.logichic.foframework.WEBSRM_Response@750effa8, SUCCESS=true, ResponseCertificats=(ResponseCertificats) ca.logichic.foframework.ResponseCertificats@44b0b290}
java.lang.RuntimeException: java.lang.ClassCastException: class ca.chicpos.mevweb.WEBSRM_ResponseWrapper cannot be cast to class ca.logichic.foframework.WEBSRM_Response (ca.chicpos.mevweb.WEBSRM_ResponseWrapper and ca.logichic.foframework.WEBSRM_Response are in unnamed module of loader 'app')
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:140)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
    at anywheresoftware.b4j.object.JServlet$Handle.run(JServlet.java:146)
    at anywheresoftware.b4j.object.JServlet.Handle(JServlet.java:126)
    at anywheresoftware.b4j.object.JServlet.doPost(JServlet.java:96)
    at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:520)
    at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:587)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)
    at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1630)
    at org.eclipse.jetty.servlets.DoSFilter.doFilterChain(DoSFilter.java:483)
    at org.eclipse.jetty.servlets.DoSFilter.doFilter(DoSFilter.java:332)
    at org.eclipse.jetty.servlets.DoSFilter.doFilter(DoSFilter.java:297)
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1600)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:506)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1571)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1375)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:463)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1544)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1297)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:141)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
    at org.eclipse.jetty.server.Server.handle(Server.java:562)
    at org.eclipse.jetty.server.HttpChannel.lambda$handle$0(HttpChannel.java:505)
    at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:762)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:497)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:282)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:319)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
    at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:412)
    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:381)
    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:268)
    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.lambda$new$0(AdaptiveExecutionStrategy.java:138)
    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:407)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:894)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1038)
    at java.base/java.lang.Thread.run(Thread.java:1589)
Caused by: java.lang.ClassCastException: class ca.chicpos.mevweb.WEBSRM_ResponseWrapper cannot be cast to class ca.logichic.foframework.WEBSRM_Response (ca.chicpos.mevweb.WEBSRM_ResponseWrapper and ca.logichic.foframework.WEBSRM_Response are in unnamed module of loader 'app')
    at ca.chicpos.server.mevweb_query._replacecertificate(mevweb_query.java:3093)
    at ca.chicpos.server.mevweb_query$ResumableSub_PROCESS_QUERY.resume(mevweb_query.java:2286)
    at ca.chicpos.server.mevweb_query._process_query(mevweb_query.java:2140)
    at ca.chicpos.server.mevweb_query._handle(mevweb_query.java:2019)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
    at java.base/java.lang.reflect.Method.invoke(Method.java:578)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
    ... 42 more
 

jahswant

Well-Known Member
Licensed User
Longtime User
I even tried converting the onbect to the the wrapper with no success.

Java:
 AbsObjectWrapper.ConvertToWrapper(mWEBSRM_ResponseWrapper, WEB_SRM_Response)

I found out that passing wrappers to list or maps unwrap them to the original object. How to solve this ?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Tip:

Not good:
B4X:
Dim CertificateMap As Map
    CertificateMap.Initialize
    CertificateMap = MEV.ReplaceCertificate(CertificateSerialNumberSRS)

Good:
B4X:
Dim CertificateMap As Map = MEV.ReplaceCertificate(CertificateSerialNumberSRS)


This line:
B4X:
myMap.Put("WEB_SRM_Response", mWEBSRM_ResponseWrapper);

Should be:
B4X:
myMap.Put("WEB_SRM_Response", mWEBSRM_ResponseWrapper.getObject());

Whenever a wrapper object type is lost (cast to Object), the wrapper should be unwrapped. This happens automatically in B4X code.
 
Top