Home Ask Login Register

Developers Planet

Your answer is one click away!

Nazmul Hasan February 2016

can not invoke java adapter resource by windows phone 8 Application in MobileFirst platform

I am using mobilefirst 7.1 for my hybrid application development (For iOS, Android and windows phone devices). I tried with WLResourceRequest.POST for java Adapter, but its not working for windows phone 8 .

client:

function testBodyJavaAdapter(){

    alert("HI")
    var baseUrlJavaAdapter="/adapters/JavaAdapterTest/api/postHelloUserBody";



    var req = new WLResourceRequest(baseUrlJavaAdapter, WLResourceRequest.POST);


       var json={ 
               first:"Nazmul",
               middle:"Hasan",
               last:"Prince"

       }
        req.setHeader("Content-Type", "application/json");
        req.send(json).then(function(resp){

             alert("Success");
             $("#showInfoDiv").html(resp.responseText);
         })

    }

java Adapter code:

@Path("/api")
@OAuthSecurity(enabled=false)
public class JavaAdapterTestResource {

    static Logger logger = Logger.getLogger(JavaAdapterTestResource.class.getName());

    //Define the server api to be able to perform server operations
    WLServerAPI api = WLServerAPIProvider.getWLServerAPI();


    @POST
    @Consumes("application/json")
    @Path("/postHelloUserBody")
    public String postHelloUserBody(@HeaderParam("Content-Type") String type,  JSONObject json) throws IOException{
        return "Hello " + json.get("first") + " " + json.get("middle") + " " + json.get("last");
    }
}

MobileFirst: version 7.1.0.00-20151114-1616

visual studio 2013

windows phone 8.1 Microsoft lumia 640

project uploaded here:https://github.com/nazmulkp/MobileFirst-Hybrid-Application-AdapterTest

Thank you

Answers


Idan Adar February 2016

As mentioned by Vivin in the comments - this was identified to be a defect in the product and should be handled as a PMR (support ticket). Once you open the PMR, please mention its number in the question or in comments.

Post Status

Asked in February 2016
Viewed 1,903 times
Voted 10
Answered 1 times

Search




Leave an answer


Quote of the day: live life