Android SOAP Web Client

I am trying to create a web service client for Android, but I am very stuck. My code and WSDL file are attached. Please, help

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package org.me.androidapplication1;

import android.app.Activity;

import android.os.Bundle;

import android.widget.TextView;

import java.io.IOException;

import java.util.logging.Level;

import java.util.logging.Logger;

import org.ksoap2.SoapEnvelope;

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;


/**
*
* @author bansal
*/
public class MainActivity extends Activity {



private String SOAP_ACTION = "http://src/getNews";

private String METHOD_NAME = "getNews";

private String NAMESPACE = "http://src/";

private static final String URL ="http://128.205.201.202:8080/RssService
/RssServiceService?WSDL";

/** Called when the activity is first created. */
@Override

public void onCreate(Bundle icicle) {

super.onCreate(icicle);


TextView tv = new TextView(this);

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

request.addProperty("ticker","NASDAQ:INFY");

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

envelope.setOutputSoapObject(request);

AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(URL);

try {

androidHttpTransport.call(SOAP_ACTION, envelope);

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

tv.setText("Response " + p);


} catch (Exception ex) {


ex.printStackTrace();

}


setContentView(tv);


// ToDo add your GUI initialization code here

}

}

thank

+3
source share
2 answers

Move the web service call from onCreate and do it in another thread. You do not want something intense in onCreate, or it will depend on the creation and display of activity.

0
source

Bansal

this Your web service: http://128.205.201.202:8080/RssService / RssServiceService? Wsdl

I'm trying to see a web service using the SOAP interface tool, but getting the error message: Error importing WSDL file

U , . SOAP UI. . . .

Running WSDL: http://ws.oag.com/OAGFlightStatusInformation.asmx?WSDL . , .

0

Source: https://habr.com/ru/post/1740398/


All Articles