2017-06-18 8 views
0

を投げ、私は基本的に私のあるhttps://code.tutsplus.com/tutorials/consuming-web-services-with-ksoap--mobile-21242KSOAP2 Android上で私のSOAP要求が動作しない理由を私は理解できないEOF-例外

のチュートリアルに従っコードは次のよう:

パブリッククラスのSoapClient {

private static final String NAMESPACE = "https://ieslamp.technikum-wien.at/sys_bvu4_17_l/JamDec/ContentManager/soapservice.php"; 

//not used right now 
private static final String TARGET_NAMESPACE = "http://ieslamp.technikum-wien.at/soap/getJamRoutes"; 
private static final String SOAP_ACTION = "https://ieslamp.technikum-wien.at/sys_bvu4_17_l/JamDec/ContentManager/soapservice.php/getJamRoutes"; 
//which is the URL I need? some tutorials say it's the url to the wsdl, but others say it's the location of the webservice 
private static final String POST_URL = "https://ieslamp.technikum-wien.at/sys_bvu4_17_l/JamDec/ContentManager/soapservice.php?wsdl"; 
private static final String LOCATION_URL = "https://ieslamp.technikum-wien.at:443/sys_bvu4_17_l/JamDec/ContentManager/soapservice.php"; 

private Context context; 

public SoapClient(Context context) { 
    this.context = context; 
} 

public String getJamsFromServer() { 


    String methodname = "getJamRoutes"; 
    SoapObject request = new SoapObject(TARGET_NAMESPACE, methodname); 
    String routes = null; 

    SoapSerializationEnvelope envelope = getSoapSerializationEnvelope(request); 

    HttpTransportSE ht = getHttpTransportSE(); 
    try { 
     ArrayList<HeaderProperty> headerPropertyArrayList = new ArrayList<>(); 
     headerPropertyArrayList.add(new HeaderProperty("Connection", "close")); 
     ht.call(SOAP_ACTION, envelope, headerPropertyArrayList); 
     SoapPrimitive result = (SoapPrimitive)envelope.getResponse(); 
     routes = result.toString(); 
    } catch (IOException e) { 
     e.printStackTrace(); 
    } catch (XmlPullParserException e) { 
     e.printStackTrace(); 
    } 
    return routes; 
} 


private final SoapSerializationEnvelope getSoapSerializationEnvelope(SoapObject request) { 
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 
    envelope.dotNet = false; 
    envelope.implicitTypes = true; 
    envelope.setOutputSoapObject(request); 

    return envelope; 
} 

private final HttpTransportSE getHttpTransportSE() { 
    HttpTransportSE ht = new HttpTransportSE(Proxy.NO_PROXY, LOCATION_URL, 1200000); 
    ht.debug = true; 

    ht.setXmlVersionTag("<!--?xml version=\"1.0\" encoding= \"UTF-8\" ?-->"); 
    return ht; 
} 

} 

サービスは、「Hello World」の返す - 文字列を、と私はそれをテストするためにSOAP-UIを使用していますが、このソフトウェアとの要求が実際に私与えますレスポンスが、私が勉強しているとき私のAndroidアプリとの応答を行うためのグラム -

ht.call(); 

は私にEOF-例外をスローし、私が間違っているかを把握することはできません。私は実際に必要

HttpTransportSE ht = new HttpTransportSE(URL); 

-

あなたは多分のためにどの名前空間およびURLを説明できますか?また、targetNamespaceまたはNamespaceを使用しますか?私は研究中に把握することはできません。ここで

は私の生成されたWSDLファイルです:

はあなたの助けをありがとう!

+0

あなたは、私が持つ問題を抱えていたので、私は、私の質問にそれを置くことができませんでしたhttps://ieslamp.technikum-wien.at/sys_bvu4_17_l/JamDec/ContentManager/soapservice.php?wsdl で私の生成されたWSDLファイルを見つけることができますformating :( また、私はksoap2-android-assembly-3.6.2-jar-with-dependencies.jarを使用しています。 をAndroid用のSoapライブラリとして使用しています –

答えて

0

問題はそれ自身解決されました。最新のjarファイルが機能しないようです。 ksoapを使うつもりなら、廃止予定のフラグが付けられている古いバージョンを使うことをお勧めしますが、少なくとも彼らは仕事をします。

関連する問題