1. Download our Official Android App: Forums for Android!

Apps Web Service call

Discussion in 'Android Development' started by the phantom, Oct 19, 2011.

  1. the phantom

    the phantom Newbie
    Thread Starter
    Rank:
    None
    Points:
    35
    Posts:
    22
    Joined:
    Oct 6, 2011

    Oct 6, 2011
    22
    0
    35
    Hi everyone,

    I'm trying to send a call to a web service which takes in two values - one which is a simple integer but the other one is a date value, which is the format of 'dd MMM yyyy'. Apparently the date is fine as a string so I've use the simpledateformat to set it up in the correct fashion.

    However when I give the webservice the values it gives me an error message of;

    Server was unable to read request. --->There is an error in XML document(1,357). ---> The string '19 Oct 2011' is not a valid ALLXsc value.

    The webservice is called by clicking a button. Here is the button code snippet (the rightNow value is a date variable declared earlier that simply gets the current date);


    public


    void onClick(View arg0) {

    SimpleDateFormat dateformatDDMMMYYYY =
    new SimpleDateFormat("dd MMM yyyy");

    StringBuilder nowddMMMYYYY =
    new StringBuilder( dateformatDDMMMYYYY.format( rightNow ) );


    TodayDate = nowddMMMYYYY.toString();

    getJobs();

    }


    The getJobs function code is below (the ResId value is an integer setup earlier);

    public


    void getJobs() {

    SoapObject Request =
    new SoapObject(NAMESPACE, METHOD_NAME);

    Request.addProperty(
    "DateToGet",TodayDate);

    Request.addProperty(
    "Resource_Id",ResId);

    SoapSerializationEnvelope envelope =
    new SoapSerializationEnvelope(SoapEnvelope.VER11);

    envelope.
    dotNet = true;

    envelope.setOutputSoapObject(Request);

    AndroidHttpTransport aht =
    new AndroidHttpTransport(URL);




    try

    {

    aht.call(
    SOAP_ACTION, envelope);

    SoapObject response = (SoapObject)envelope.getResponse();


    Desc = response.getProperty("Description").toString();

    }




    catch(Exception e)

    {

    e.printStackTrace();


    listJ.setText(e.getMessage());

    }

    When it is run it always goes to the catch part and displays the error message in the listJ textbox, all of the webservice details are fine as I called another webservice form the same location before in the app.

    Has anyone go any ideas or could try to elaborate on the error message?

    Thanks
     

    Advertisement

  2. the phantom

    the phantom Newbie
    Thread Starter
    Rank:
    None
    Points:
    35
    Posts:
    22
    Joined:
    Oct 6, 2011

    Oct 6, 2011
    22
    0
    35
    As a follow up to this I've discovered the java.sql date variable which produces the date in a format that the web service will accept however when I try to give this value to the web service I receive an error message that says 'Cannot Serialize'

    Anyone got any ideas about what this means?
     

Share This Page

Loading...