如何在Flex中设置SOAP服务的位置?

时间:2011-04-08 00:10:41

标签: flex web-services soap

我已使用FlexBuilder菜单成功生成了我的Web服务代理。此特定Web服务在其WSDL中指定了内部(或不正确)“位置”。这意味着当我进行实际的方法调用时,它会失败,因为位置字段中指定的DNS名称是错误的。 (它在火虫中显示为“中止”)。

如何在服务对象上设置location属性?我以前用Java和php做过这个,但是无法弄清楚如何在Flex中做到这一点。


更新

下面列出了需要更改的字段。它被称为“WSDL端点”。所以问题是:在给定生成的Web服务对象(扩展WebServiceWrapper的对象)的情况下,如何以编程方式执行此操作?

<annotation name="ServiceConfig">
  <item name="DEFAULT_ENTITY_PACKAGE">valueObjects</item>
  <item name="WSDL-endpoint">http://eoc7/eoc7/api.asmx</item>
  <item name="LINKED_FILE"></item>
</annotation>

3 个答案:

答案 0 :(得分:1)

Flash Builder将web服务地址存储在Flex项目的.model子目录中的.fml文件中。您可以编辑此文件,然后重新打开该项目。但最简单的方法是删除yor Data / Service并使用向导重建它。

答案 1 :(得分:1)

以下是以编程方式在Flex SOAP服务中设置Web服务的“位置”的方法:

转到生成的服务类并在_service控件对象上设置此属性:

_serviceControl.endpointURI = "http://uri-to-real-location"

所以我创建了一个简单的方法来从类外部设置它:

public function setEndpointUri(uri : String) : void 
{
    _serviceControl.endpointURI = uri;
}

答案 2 :(得分:0)

这是我可以在生成的服务存根中使用它的唯一方法:

import com.adobe.fiber.core.model_internal;

此外:

    /**
 * Override super.init() to provide any initialization customization if needed.
 */
protected override function preInitializeService():void
{           
    _needWSDLLoad = false; // to prevent loading the default WSDL
    super.preInitializeService();
    // Initialization customization goes here
    wsdl = "http://localhost/yourservice?wsdl";
    _needWSDLLoad = true;
    model_internal::loadWSDLIfNecessary();  
相关问题