Service的继承自SoapHeader的自定义类名称相同
var qname:QName = new QName("http://davidfan.cnblogs.com","ValidateSoapHeader");
var header:SOAPHeader = new SOAPHeader(qname,content);
ws.clearHeaders();
ws.addHeader(header);
ws.HelloWorld();
}
private function OnResult(event:ResultEvent):void{
Result.text= event.result.toString();
}
private function OnFault(event:FaultEvent):void{
Result.text= event.message.toString();
}
]]>
</mx:Script>
<mx:WebService id="ws" wsdl="http://localhost:9200/WebSite2/Service.asmx?WSDL"
result="OnResult(event)" fault="OnFault(event)"/>
<mx:TextInput id="UserName" x="98" y="94"/>
<mx:TextInput id="PassWord" x="98" y="124"/>
<mx:Label x="29" y="98" text="用户名:"/>
<mx:Label x="29" y="128" text="密 码:"/>
<mx:Button x="98" y="184" label="调用" click="SendRequest()"/>
<mx:Label x="29" y="156" text="结 果:"/>
<mx:TextInput id="Result" x="98" y="154"/>
</mx:Application>
as
以下是引用片段:
package WebServiceUtility
{
public class Info{
//该类名称可以和.Net中的ValidateSoapHeader不同
//但字段要对应拼写相同
public var Name:String;
public var Password:String;
public var ExDate:Date;
}
}