Problem on getting SOAP response

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

Problem on getting SOAP response

Postby prasanjitdeka » Fri Mar 19, 2010 10:56 am

Here this my XML which generate while calling webservice method:
<DataSet>

<xs:schema id="NewDataSet">

<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">

<xs:complexType>

<xs:choice minOccurs="0" maxOccurs="unbounded">

<xs:element name="Table">

<xs:complexType>

<xs:sequence>
<xs:element name="predictionMessage" type="xs:string" minOccurs="0"/>
<xs:element name="predictionPostDate" type="xs:string" minOccurs="0"/>
<xs:element name="RecoPrice" type="xs:string" minOccurs="0"/>
<xs:element name="TargetPrice" type="xs:string" minOccurs="0"/>
<xs:element name="CurrentPrice" type="xs:string" minOccurs="0"/>
<xs:element name="feedId" type="xs:int" minOccurs="0"/>
<xs:element name="feedType" type="xs:string" minOccurs="0"/>
<xs:element name="userId" type="xs:int" minOccurs="0"/>
<xs:element name="loginName" type="xs:string" minOccurs="0"/>
<xs:element name="feedName" type="xs:string" minOccurs="0"/>
<xs:element name="feedTypeName" type="xs:string" minOccurs="0"/>
<xs:element name="predictionExpDate" type="xs:string" minOccurs="0"/>
<xs:element name="Row" type="xs:long" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="Table1">

<xs:complexType>

<xs:sequence>
<xs:element name="Column1" type="xs:long" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>

<diffgr:diffgram>

<NewDataSet>

<Table diffgr:id="Table1" msdata:rowOrder="0">
<predictionMessage>ADRX</predictionMessage>
<predictionPostDate>Mar 8 2010 </predictionPostDate>
<RecoPrice>Rs. 0.00</RecoPrice>
<TargetPrice>Rs. 55.95</TargetPrice>
<CurrentPrice>Rs. 0.00</CurrentPrice>
<feedId>134</feedId>
<feedType>2</feedType>
<userId>46</userId>
<loginName>username</loginName>
<feedName>username BEST IDEAS</feedName>
<feedTypeName>Short Term(Weekly)</feedTypeName>
<predictionExpDate>Mar 14 2010 </predictionExpDate>
<Row>1</Row>
</Table>

<Table diffgr:id="Table2" msdata:rowOrder="1">
<predictionMessage>TWX</predictionMessage>
<predictionPostDate>Mar 8 2010 </predictionPostDate>
<RecoPrice>Rs. 0.00</RecoPrice>
<TargetPrice>Rs. 434</TargetPrice>
<CurrentPrice>Rs. 0.00</CurrentPrice>
<feedId>134</feedId>
<feedType>2</feedType>
<userId>46</userId>
<loginName>username</loginName>
<feedName>username BEST IDEAS</feedName>
<feedTypeName>Short Term(Weekly)</feedTypeName>
<predictionExpDate>Mar 14 2010 </predictionExpDate>
<Row>2</Row>
</Table>

<Table diffgr:id="Table3" msdata:rowOrder="2">
<predictionMessage>HRB</predictionMessage>
<predictionPostDate>Mar 8 2010 </predictionPostDate>
<RecoPrice>Rs. 0.00</RecoPrice>
<TargetPrice>Rs. 434</TargetPrice>
<CurrentPrice>Rs. 0.00</CurrentPrice>
<feedId>134</feedId>
<feedType>2</feedType>
<userId>46</userId>
<loginName>username</loginName>
<feedName>username BEST IDEAS</feedName>
<feedTypeName>Short Term(Weekly)</feedTypeName>
<predictionExpDate>Mar 14 2010 </predictionExpDate>
<Row>3</Row>
</Table>

<Table diffgr:id="Table4" msdata:rowOrder="3">
<predictionMessage>HRB</predictionMessage>
<predictionPostDate>Mar 8 2010 </predictionPostDate>
<RecoPrice>Rs. 0.00</RecoPrice>
<TargetPrice>Rs. 434</TargetPrice>
<CurrentPrice>Rs. 0.00</CurrentPrice>
<feedId>134</feedId>
<feedType>2</feedType>
<userId>46</userId>
<loginName>username</loginName>
<feedName>username BEST IDEAS</feedName>
<feedTypeName>Short Term(Weekly)</feedTypeName>
<predictionExpDate>Mar 14 2010 </predictionExpDate>
<Row>4</Row>
</Table>

<Table diffgr:id="Table5" msdata:rowOrder="4">
<predictionMessage>ADRX</predictionMessage>
<predictionPostDate>Mar 8 2010 </predictionPostDate>
<RecoPrice>Rs. 0.00</RecoPrice>
<TargetPrice>Rs. 434</TargetPrice>
<CurrentPrice>Rs. 0.00</CurrentPrice>
<feedId>134</feedId>
<feedType>2</feedType>
<userId>46</userId>
<loginName>username</loginName>
<feedName>username BEST IDEAS</feedName>
<feedTypeName>Short Term(Weekly)</feedTypeName>
<predictionExpDate>Mar 14 2010 </predictionExpDate>
<Row>5</Row>
</Table>

<Table1 diffgr:id="Table11" msdata:rowOrder="0">
<Column1>10</Column1>
</Table1>
</NewDataSet>
</diffgr:diffgram>
</DataSet>
/////////////////////////////////////////////////
Now Here the code


public class Main extends Activity {
private static final String SOAP_ACTION = "http://115.108.40.174/hionstockws/service1.asmx/GetHomePageRecos";
private static final String METHOD_NAME = "GetHomePageRecos";
private static final String NAMESPACE = "http://115.108.40.174/hionstockws";
private static final String URL = "http://115.108.40.174/hionstockws/service1.asmx";
private Object resultRequestSOAP = null;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
setContentView(tv);

Log.i("Comies","im the lay");
try{
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
Log.i("Comies88888888",request.getName());
// Add Property
request.addProperty("vcountry", "1");
request.addProperty("vrecorPerPage", "5");
request.addProperty("vrpageNo", "1");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
// .Net
envelope.dotNet = true;

envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call(SOAP_ACTION, envelope);

resultRequestSOAP = envelope.getResponse();
String[] results = (String[]) resultRequestSOAP;
Log.i("Result",results.toString());


tv.setText( results[0]);
// Display Results in log (adb.exe logcat)
}
catch(Exception e){
e.printStackTrace();
}
}
}

This code shows me Fault String "SOAP Exception" Server not getting response
prasanjitdeka
Freshman
Freshman
 
Posts: 2
Joined: Fri Mar 19, 2010 10:32 am

Top

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 7 guests