2012-03-21 51 views
0

我有權發佈XML輸入http://180.151.60.73/Sales/service.asmx/UpdateOpportunity?xml=它顯示異常,因爲,文件未發現異常使用HTTP連接

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) 

我已經使用這個代碼HTTP連接

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(); 

美語輸入也是這個長度太長...

+0

請上傳你的代碼 – Lucifer 2012-03-21 04:15:54

+0

錯誤很明顯> _> *咳嗽*文件沒有找到*咳嗽* – JoxTraex 2012-03-21 04:23:11

+0

雅它顯示404文件沒有找到異常..如何解決這個問題? – user1235251 2012-03-21 04:27:27

回答

1

使用

connection.getErrorStream();

而不是

connection.getInputStream();