2012-04-23 2 views
1

안드로이드 애플리케이션에서 SAP SOAP 웹 서비스를 연결하고 싶습니다. 다음 코드를 사용하고 있습니다.하지만 예외가 있습니다. 코드를 디버깅 할 때 메소드 ID가 실행되지 않았습니다. 사용하고 있습니다. URL에 사용자 이름과 암호 추가.안드로이드와 SAP SOAP 웹 서비스 사이의 연결 설정

package com.veee.pack; 
import java.io.IOException; 
import android.app.Activity; 
import android.os.Bundle; 
import java.io.IOException; 
import org.ksoap2.SoapEnvelope; 
import org.ksoap2.SoapFault; 
import org.ksoap2.serialization.SoapObject; 
import org.ksoap2.serialization.SoapPrimitive; 
import org.ksoap2.serialization.SoapSerializationEnvelope; 
import org.ksoap2.transport.AndroidHttpTransport; 
import org.xmlpull.v1.XmlPullParserException; 
import android.app.Activity; 
import android.os.Bundle; 

public class WeservicesExampleActivity extends Activity { 
     @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.main); 
      final String METHOD_NAME = "Z_CUSTOMER_LOOKUP1"; 
     final String SOAP_ACTION = "http://********************:8000/sap/bc/srt/rfc/sap/z_customer_lookup1/800/z_customer_lookup1/z_customer_lookup1_bind/Z_CUSTOMER_LOOKUP1"; 
     final String NAMESPACE = "urn:sap-com:document:sap:soap:functions:mc-style"; 
     final String URL = "http://******************:8000/sap/bc/srt/wsdl/srvc_14DAE9C8D79F1EE196F1FC6C6518A345/wsdl11/allinone/ws_policy/document?sap-client=800&sap-user=***************&sap-password=************"; 

//here i made the request 

      SoapObject request =new SoapObject(NAMESPACE, METHOD_NAME); 
     request.addProperty("Input", "1460"); 


     SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 

     envelope.dotNet=true; 
     envelope.setOutputSoapObject(request); 

     AndroidHttpTransport httpTransport=new AndroidHttpTransport(URL); 
     httpTransport.debug = true; 
     try { 
    //here call the services method. 
      httpTransport.call(SOAP_ACTION, envelope); 

//calling the services 

     SoapPrimitive result = (SoapPrimitive) envelope.getResponse(); 


     System.out.println("Result" + result.toString()); 
    } catch (IOException e) { 
     // TODO Auto-generated catch block 
     e.printStackTrace(); 
    } catch (XmlPullParserException e) { 
     // TODO Auto-generated catch block 
     e.printStackTrace(); 
    } 
     } 

     } 
I got the following Exception 

04-23 10:50:04.744: WARN/System.err(442): org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <{http://schemas.xmlsoap.org/wsdl/}wsdl:definitions targetNamespace='urn:sap-com:document:sap:soap:functions:mc-style'>@1:686 in [email protected]) 

이 예외를 극복하도록 도와주세요. 제가 ksop2를 사용하여 몇 가지 예를 시도해 보았습니다.

+0

[I (대명사)] (HTTP ://en.wikipedia.org/wiki/I_(pronoun)) –

답변

1

안녕 Venkatasubbaiah Atluru,

당신이 좋아하는 URL 뭔가에 매개 변수를 전달하는 http://abc.com/xyz/api/sap-client=800&sap-user=* ** * ** & 수액 - 암호 = ** * ** "

요청시 매개 변수를 전달하십시오 (예 : ). request.addProperty ("sap -client ","800 "); request.addProperty ("sap-user", "* "); request.addProperty ("sap-password", " *");

문제가 해결됩니다

....

당신은 어떤 질문이 있으면 알려 ....

프로그래밍을 즐길 ...