flex에서 웹 서비스를 호출 할 때 어떤 문제가 있습니다. 하나의 메소드 문자열 인 GetData (int i)를 사용하여 UserService라는 이름으로 서비스했습니다. 이 메서드를 flex에서 호출하여 데이터를 가져 오려고합니다. 내 코드는 여기에 있습니다 :flex에서 웹 서비스를 호출하는 방법
protected function application1_creationCompleteHandler(event:FlexEvent):void
{
uService = new UserService();
uService.addEventListener("hello", echoResultHandler);
uService.GetData(1);
}
public function echoResultHandler(event:ResultEvent):void {
var retStr:String = event.result as String;
var retInt:int = event.result.echoInt;
Alert.show('want to play', retStr);
}
내 질문은 어렵지 않지만이 작품을 does't 왜 이해할 수 없다 .. 아무도 나를 도와 드릴 수 있습니다?
서비스 코드는 servee에 대한 참조를 추가 할 때 flex에 의해 생성됩니다.
internal class _Super_UserService extends com.adobe.fiber.services.wrapper.WebServiceWrapper
{
public function _Super_UserService()
{
_serviceControl = new mx.rpc.soap.mxml.WebService();
var operations:Object = new Object();
var operation:mx.rpc.soap.mxml.Operation;
operation = new mx.rpc.soap.mxml.Operation(null, "GetData");
operation.resultType = String;
operations["GetData"] = operation;
_serviceControl.operations = operations;
try
{
_serviceControl.convertResultHandler = com.adobe.serializers.utility.TypeUtility.convertResultHandler;
}
catch (e: Error)
{ }
preInitializeService();
model_internal::initialize();
}
protected function preInitializeService():void
{
_serviceControl.service = "UserService";
_serviceControl.port = "BasicHttpBinding_IUserService";
wsdl = "http://localhost:3905/UserService.svc?wsdl";
model_internal::loadWSDLIfNecessary();
}
public function GetData(value:int) : mx.rpc.AsyncToken
{
model_internal::loadWSDLIfNecessary();
var _internal_operation:mx.rpc.AbstractOperation = _serviceControl.getOperation("GetData");
var _internal_token:mx.rpc.AsyncToken = _internal_operation.send(value) ;
return _internal_token;
}
}
상속 클래스 :
public class UserService extends _Super_UserService
{
protected override function preInitializeService():void
{
super.preInitializeService();
// Initialization customization goes here
}
}
AsyncToken에
대한 추가 정보를 원하시면, 무슨 일이 일어나고 있는지 알고 어려운 것입니다. UserService 코드를 보여주세요! – JeffryHouser
나는 내가 이해하고 있는지 확신하지 못한다. .net 코드 또는 플렉스에 의해 생성 된 코드? – Radislav
내 질문을 업데이트했습니다. – Radislav