0

I have to post xml input http://180.151.60.73/Sales/service.asmx/UpdateOpportunity?xml= it shows exception as,

 03-21 09:51:07.483: WARN/System.err(2531): java.io.FileNotFoundException: http://180.151.60.73/Sales/service.asmx/UpdateOpportunity?xml=
    03-21 09:51:07.493: WARN/System.err(2531):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:1162)
    03-21 09:51:07.493: WARN/System.err(2531):     at com.jems.common.ParentActivity.getXmlData(ParentActivity.java:218)
    03-21 09:51:07.493: WARN/System.err(2531):     at com.jems.salesforce.SalesEditActivity.onClick(SalesEditActivity.java:2989)
    03-21 09:51:07.493: WARN/System.err(2531):     at android.view.View.performClick(View.java:2408)
    03-21 09:51:07.493: WARN/System.err(2531):     at android.view.View$PerformClick.run(View.java:8816)
    03-21 09:51:07.493: WARN/System.err(2531):     at android.os.Handler.handleCallback(Handler.java:587)
    03-21 09:51:07.493: WARN/System.err(2531):     at android.os.Handler.dispatchMessage(Handler.java:92)
    03-21 09:51:07.493: WARN/System.err(2531):     at android.os.Looper.loop(Looper.java:123)
    03-21 09:51:07.493: WARN/System.err(2531):     at android.app.ActivityThread.main(ActivityThread.java:4627)
    03-21 09:51:07.503: WARN/System.err(2531):     at java.lang.reflect.Method.invokeNative(Native Method)
    03-21 09:51:07.503: WARN/System.err(2531):     at java.lang.reflect.Method.invoke(Method.java:521)
    03-21 09:51:07.503: WARN/System.err(2531):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
    03-21 09:51:07.503: WARN/System.err(2531):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
    03-21 09:51:07.503: WARN/System.err(2531):     at dalvik.system.NativeStart.main(Native Method)

i have used this code for http connection

byte[] xm=(xmlUrl).getBytes();
                    StringBuffer b1=new StringBuffer();
                    b1.append(xmlUrl);
                       Log.i("xmlurl",""+ xm);
                       SalesActivity sa =new SalesActivity();
                URL url = new URL("http://180.151.60.73/Sales/service.asmx/UpdateOpportunity?xml=");
                HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
                httpURLConnection.setRequestMethod("POST");
                httpURLConnection.setRequestProperty("Connection", "keep-alive");
                httpURLConnection.setRequestProperty("Content-Type", "text/xml");
                httpURLConnection.setRequestProperty("SendChunked", "True");
                httpURLConnection.setDoOutput(true);
                httpURLConnection.setDoInput(true);

                httpURLConnection.connect();

                OutputStream out = httpURLConnection.getOutputStream();
                out.write(xm);    // send request
                InputStream response = httpURLConnection.getInputStream();
                doc = db.parse(response);
                //receive response
                httpURLConnection.disconnect();

xmlurl as input also this length is too long...

8
  • the error is obvious >_> cough file not found cough Commented Mar 21, 2012 at 4:23
  • ya its shows 404 file not found exception..how to resolve this? Commented Mar 21, 2012 at 4:27
  • value pass in parameter not contain any space or encode with developer.android.com/reference/java/net/URLEncoder.html i had also face same problem and i got solution with encode value and then pass to query Commented Mar 21, 2012 at 4:29
  • i have used URLEncoder.encode(xmlurl) for input...the input is too long... Commented Mar 21, 2012 at 4:34
  • @user1235251 so have you tried it?? Commented Mar 21, 2012 at 4:40

1 Answer 1

1

Use

connection.getErrorStream();

Instead of

connection.getInputStream();

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.