Android上的WCF .svc服务获取错误

时间:2012-08-16 11:44:58

标签: android wcf web-services

我正在使用网络服务.svc WCF .net webservice在android中获取登录详细信息。

private static final String SOAP_ACTION = "http://tempuri.org/IJobSeekerService/Authenticate";
private static final String METHOD_NAME = "Authenticate";
private static final String URL ="http://dev.spotjobs.com.au/api/SpotJobs.WebServices.JobSeekerService.svc" ;
private static final String  NAMESPACE = "http://tempuri.org/"; 
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

    request.addProperty("apiSecret", "bksnd");
    request.addProperty("apiKey","{abcdhhyyrt}");
    request.addProperty("userID", "payal jain");
    request.addProperty("userPassword","11111111");
    request.addProperty("deviceType","Android");
    request.addProperty("deviceToken","abcd");
    request.addProperty("registrationID","12345a");
    Log.e("", "u urlenvelop-enevlop----" + request);
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
   // envelope.dotNet = true;
    envelope.setOutputSoapObject(request);
    Log.e("", "u urlenvelop-enevlop-...............................---" + envelope);
    HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

    try {


        Log.e("", "u urlenvelop-enevlop-................rrreeeeeeeeeeeeeee...............---" + envelope);
        androidHttpTransport.call(SOAP_ACTION, envelope);  
        if (envelope.bodyIn instanceof SoapFault) {
            String str= ((SoapFault) envelope.bodyIn).faultstring;
            Log.i("", str);

            // Another way to travers through the SoapFault object
        /*  Node detailsString =str= ((SoapFault) envelope.bodyIn).detail; 
            Element detailElem = (Element) details.getElement(0) 
                         .getChild(0); 
            Element e = (Element) detailElem.getChild(2);faultstring; 
            Log.i("", e.getName() + " " + e.getText(0)str); */
        } else {
            SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;
            Log.d("WS", String.valueOf(resultsRequestSOAP));
        }
        /*SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;
        Log.i("myApp", resultsRequestSOAP.toString());*/

    } catch (Exception e) {
        e.printStackTrace();
    }
}

但是我收到了一个错误:

DEBUG/dalvikvm(1809): DexOpt: not verifying 'Lorg/xmlpull/v1/XmlSerializer;':
multiple definitions
08-16 15:51:35.196: WARN/System.err(1848): org.xmlpull.v1.XmlPullParserException: unterminated entity ref (position:TEXT �������������`I�...@1:18 in java.io.InputStreamReader@44e9baa0) 
08-16 15:51:35.258: WARN/System.err(1848):     at org.kxml2.io.KXmlParser.exception(KXmlParser.java:273)
08-16 15:51:35.258: WARN/System.err(1848):     at org.kxml2.io.KXmlParser.error(KXmlParser.java:269)
08-16 15:51:35.258: WARN/System.err(1848):     at org.kxml2.io.KXmlParser.pushEntity(KXmlParser.java:787)
08-16 15:51:35.258: WARN/System.err(1848):     at org.kxml2.io.KXmlParser.pushText(KXmlParser.java:855)
08-16 15:51:35.258: WARN/System.err(1848):     at org.kxml2.io.KXmlParser.nextImpl(KXmlParser.java:354)
08-16 15:51:35.266: WARN/System.err(1848):     at org.kxml2.io.KXmlParser.next(KXmlParser.java:1385)
08-16 15:51:35.266: WARN/System.err(1848):     at org.kxml2.io.KXmlParser.nextTag(KXmlParser.java:1415)
08-16 15:51:35.266: WARN/System.err(1848):     at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:127)
08-16 15:51:35.266: WARN/System.err(1848):     at org.ksoap2.transport.Transport.parseResponse(Transport.java:100)
08-16 15:51:35.266: WARN/System.err(1848):     at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:214)
08-16 15:51:35.276: WARN/System.err(1848):     at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:96)
08-16 15:51:35.276: WARN/System.err(1848):     at com.example.sample.MainActivity.onCreate(MainActivity.java:44)

请有人告诉我解决方案 感谢

0 个答案:

没有答案