2013-05-07 2 views
1

WSDL URL에 SVC WCF 서비스를 소비하는 방법 : 나는 Ksoap 서비스를 공격하는 데 사용 http://xxx.xxx.xxx/UserService.svc안드로이드

... 이것은 내 코드

입니다 :

try { 
       request = new SoapObject("http://tempuri.org/", "GetUserDetailsByUserName"); 

       request.addProperty("username", "Prasad"); 
       envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 
       envelope.dotNet = true; 
       envelope.setOutputSoapObject(request); 
       Log.i("Wsdl Response", "Wsdl Response:"); 
       // request.setHeader("Content-type", "application/xml"); 
       // Proxy px = new Proxy(); 

       // ?singleWsdl 
       httpreq = new HttpTransportSE("http://xxx.xxx.xxx/UserService.svc"); 
       httpreq.debug = true; 
       httpreq.call("http://tempuri.org/xxxe/GetUserDetailsByUserName", envelope); 
       Log.i("Wsdl Response", ":Wsdl Response:123"); 
       String xml = (String) envelope.getResponse().toString(); 
       SoapPrimitive results = (SoapPrimitive) envelope.getResponse(); 
       /* 
       * if (envelope.bodyIn instanceof SoapFault) { String errormessage = ((SoapFault) envelope.bodyIn).faultstring; throw new Exception(errormessage); } IncomeLeadXMLPharsing parse = new IncomeLeadXMLPharsing(); parse.parse(xml); ResultVecotor = parse.getVector(); mHandler.post(setValuesToUi); 
       */ 
       Log.i("Wsdl Response", ":Wsdl Response:" + xml); 
       if (progress != null) { 
        if (progress.isShowing()) { 
         progress.dismiss(); 
        } 
       } 


      } 
      catch (UnknownHostException e) { 
       if (progress != null) { 
        if (progress.isShowing()) { 
         progress.dismiss(); 
        } 
       } 
       e.printStackTrace(); 
      } 
      catch (ConnectException e) { 
       if (progress != null) { 
        if (progress.isShowing()) { 
         progress.dismiss(); 
        } 
       } 
       e.printStackTrace(); 
      } 
      catch (SocketException e) { 
       if (progress != null) { 
        if (progress.isShowing()) { 
         progress.dismiss(); 
        } 
       } 
       e.printStackTrace(); 
      } 
      catch (Exception e) { 
       if (progress != null) { 
        if (progress.isShowing()) { 
         progress.dismiss(); 
        } 
       } 
       e.printStackTrace(); 
       System.out.print("EXCEPTION" + e); 
      } 

을하지만 난이 예외를 얻을 고양이 로그 : 나는

05-07 10:29:22.861: WARN/System.err(635): org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <html>@3:44 in [email protected]) 
05-07 10:29:22.861: WARN/System.err(635):  at org.kxml2.io.KXmlParser.require(KXmlParser.java:2046) 
05-07 10:29:22.861: WARN/System.err(635):  at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:127) 
05-07 10:29:22.861: WARN/System.err(635):  at org.ksoap2.transport.Transport.parseResponse(Transport.java:100) 
05-07 10:29:22.871: WARN/System.err(635):  at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:195) 
05-07 10:29:22.871: WARN/System.err(635):  at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:95) 
05-07 10:29:22.871: WARN/System.err(635):  at com.myApp.JsonService$SampleWsdlServiceAsync.doInBackground(JsonService.java:291) 
05-07 10:29:22.871: WARN/System.err(635):  at com.myApp.JsonService$SampleWsdlServiceAsync.doInBackground(JsonService.java:1) 
05-07 10:29:22.871: WARN/System.err(635):  at android.os.AsyncTask$2.call(AsyncTask.java:264) 
05-07 10:29:22.881: WARN/System.err(635):  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) 
05-07 10:29:22.881: WARN/System.err(635):  at java.util.concurrent.FutureTask.run(FutureTask.java:137) 
05-07 10:29:22.881: WARN/System.err(635):  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208) 
05-07 10:29:22.894: WARN/System.err(635):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) 
05-07 10:29:22.894: WARN/System.err(635):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) 
05-07 10:29:22.902: WARN/System.err(635):  at java.lang.Thread.run(Thread.java:856) 

그것은 경우 greatful 될 것입니다 노력도 큰 후 해결책을 찾을 수 coudnt 일부는 나를 돕는다. 사전에

감사합니다. 이 라인을 변경

답변

0

봅니다 :

나는 통화 URL이 정확하지 생각 :

try {     

androidHttpTransport.call("http://tempuri.org/GetUserDetailsByUserName", Envelope); 
} catch (IOException e) { 
Log.d("ErrorApp", e.getMessage().toString()); 
} catch (XmlPullParserException e) { 
Log.d("ErrorApp", e.getMessage().toString()); 

} 

SoapPrimitive response= (SoapPrimitive) Envelope.getResponse(); 
+0

안녕 카를로스 Landeras을 : Thankz을 회신. 나는 그것을 시도했다. 그러나 여전히 나는 문제에 직면 해있다 .Plz는 이것으로 나를 도와 준다 .// –

+0

비누 봉투를 버전 12로 바꾸고 나에게 결과를 알려줘. 봉투 = 새 SoapSerializationEnvelope (SoapEnvelope.VER12); –

+0

Carlos Landeras : 시작 태그가있는 동일한 exception.XmlPullParser 예외가 발생하여 죄송합니다. –