Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOAP returned from the java web service

AbhinavDhasmana
Level 1
Level 1
Hi



I am using a simple java web service to return the object
containing a string and an integer using e4x format. The result I
get in the result event is



"<ns:return type="read.Profile" xmlns:ax21="
http://read/xsd" xmlns:ns="
http://read" xmlns:soapenv="
http://schemas.xmlsoap.org/soap/envelope/"/>".




What i am unable to understand is where is the object that
the service would have returned???



Another question is can we return arraylist from the
webservice?? If i try to add the objects into the array list and
pass it into the flex application, i get an " HTTP request error".
Please advise.



<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute">



<mx:WebService id = "ReadData" wsdl="{'
http://localhost:8080/ReadData/services/ReadQuickbase?wsdl'}"
fault="Alert.show(event.fault.faultString)" showBusyCursor="true"
useProxy="false">

<mx:operation name ="returnData" resultFormat="e4x"
result= "showItemResult(event)">

<mx:request xmlns="">

<shared>





</shared>

</mx:request>



</mx:operation>



</mx:WebService>



<mx:Script>

<![CDATA[



import mx.collections.ArrayCollection;

import mx.rpc.events.ResultEvent;



import mx.controls.Alert;



[Bindable]

private var resultdata:ArrayCollection;



private namespace read = "
http://read/";

use namespace read;



public function sendRequest():void {



ReadData.returnData.send();

}





private function showItemResult(res:ResultEvent):void {





var _xml:XML;

_xml = XML(res.result);





}

]]>

</mx:Script>

<mx:Button x="273" y="64" label="getIT" click=
"sendRequest()"/>

<mx:Label x="190" y="81" id="myLabel"/>

</mx:Application>





******************************************************************************

Java web service

******************************************************************************



package read;







import java.util.ArrayList;

import java.util.Set;

import java.util.Vector;

import java.util.HashMap;





class Profile {

String name;

int age;



void setvalues(String name, int age) {

this.name = name;

this.age = age;



}





}





public class ReadQuickbase {



public Profile returnData() {



Profile p = new Profile();

try {

p.setvalues("abc", 10);

}

catch (Exception e){

e.printStackTrace();

}



return p;



}

}
0 Replies