请教,如何用ActionScript3.0来调用WebService呢?(补充问题)
如题:
WebService带密码验证的,
要调用远程的WebService
可以提供点参考例子么?
我的代码如下,再往下本人就不会写了~:
WebService的帮助文档是:
WebService的正式定义的服务说明如下:
能否不调用后台,直接用AS来访问WebService来获得值呢?
麻烦达人们给点参考了!谢谢
WebService带密码验证的,
要调用远程的WebService
可以提供点参考例子么?
我的代码如下,再往下本人就不会写了~:
public class getWebXml
{
var mWebSer1:WebService;
public function getWebXml()
{
mWebSer1 = new mx.rpc.soap.WebService();
mWebSer1.wsdl = ""; //这里是WebService的地址
mWebSer1.loadWSDL(ws1.wsdl);
}
}
WebService的帮助文档是:
SOAP 1.1
以下是 SOAP 1.2 请求和响应示例。所显示的“占位符”需替换为实际值。
POST /rt/Service.asmx HTTP/1.1
Host: 116.236.252.205
Content-Type: text/xml; charset=utf-8
Content-Length: “length”
SOAPAction: "http://tempuri.org/GetTrafficData"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetTrafficData xmlns="http://tempuri.org/">
<strCustomID>“string”</strCustomID>
<strPassword>“string”</strPassword>
<strResult>“string”</strResult>
</GetTrafficData>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: “length”
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetTrafficDataResponse xmlns="http://tempuri.org/">
<GetTrafficDataResult>"string"</GetTrafficDataResult>
</GetTrafficDataResponse>
</soap:Body>
</soap:Envelope>
////////////////////////////////////////////////////
SOAP 1.2
以下是 SOAP 1.2 请求和响应示例。所显示的“占位符”需替换为实际值。
POST /rt/Service.asmx HTTP/1.1
Host: 116.236.252.205
Content-Type: application/soap+xml; charset=utf-8
Content-Length: "length"
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<GetTrafficData xmlns="http://tempuri.org/">
<strCustomID> "string" </strCustomID>
<strPassword> "string"</strPassword>
<strResult> “string”</strResult>
</GetTrafficData>
</soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: “length”
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<GetTrafficDataResponse xmlns="http://tempuri.org/">
<GetTrafficDataResult> “string"</GetTrafficDataResponse>
</soap12:Body>
</soap12:Envelope>
////////////////////////////////////////////////////
HTTP GET
以下是 HTTP GET 请求和响应示例。所显示的“占位符”需替换为实际值。
GET /rt/Service.asmx/GetTrafficData?strCustomID=string&strPassword=string&strResult=string HTTP/1.1
Host: 116.236.252.205
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: "length"
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/"> "string”</string>
////////////////////////////////////////////////////
HTTP POST
以下是 HTTP POST 请求和响应示例。所显示的“占位符”需替换为实际值。
POST /rt/Service.asmx/GetTrafficData HTTP/1.1
Host: 116.236.252.205
Content-Type: application/x-www-form-urlencoded
Content-Length: “length”
strCustomID= “string "&strPassword= ”string “&strResult= ”string“HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: ”length“
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/"> “string”</string>
WebService的正式定义的服务说明如下:
<?xml version="1.0" encoding="utf-8" ?>
- <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
- <wsdl:types>
- <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
- <s:element name="GetTrafficData">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="strCustomID" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="strPassword" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="strResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
- <s:element name="GetTrafficDataResponse">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetTrafficDataResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
- <s:element name="GetDataPassWord">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="strCustomID" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="strPassword" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="strResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
- <s:element name="GetDataPassWordResponse">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetDataPassWordResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
- <s:element name="GetTrafficResult">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="strCustomID" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="strPassword" type="s:string" />
</s:sequence>
</s:complexType>
能否不调用后台,直接用AS来访问WebService来获得值呢?
麻烦达人们给点参考了!谢谢
...全文
相关推荐
flex actionscript 调用处理 webservice的过程及方法
flex actionsript 调用webservice。以及flex处理webservice的过程及方法。
精通flex3.0源码基于Actionscript3实现
精通flex3.0基于Actionscript3实现的源码,结合书会更有用,提供了很多很好的例子,是我们flex进阶的有力助手
ActionScript 3.0 錦囊妙計
ActionScript 3.0 錦囊妙計
FELX中文帮助(包括ActionScript 3.0、MXML等内容)
ActionScript 3.0 语言和组件参考概述、MXML入门、FLEX入门帮助。
《Flex入门》及ActionScript 3.0 语言
FLEX入门知识介绍及语法知识的详细教程


