Sunteți pe pagina 1din 3

/**

* This is a generated class and is not intended for modfication. To customize


behavior
* of this service wrapper you may modify the generated sub-class of this class
- BillService.as.
*/
package services.billservice
{
import com.adobe.fiber.core.model_internal;
import com.adobe.fiber.services.wrapper.WebServiceWrapper;
import com.adobe.serializers.utility.TypeUtility;
import flash.filesystem.File;
import flash.filesystem.FileMode;
import flash.filesystem.FileStream;
import flash.utils.ByteArray;
import mx.rpc.AbstractOperation;
import mx.rpc.AsyncToken;
import mx.rpc.soap.SOAPHeader;
import mx.rpc.soap.mxml.Operation;
import mx.rpc.soap.mxml.WebService;
[ExcludeClass]
internal class _Super_BillService extends com.adobe.fiber.services.wrapper.WebSe
rviceWrapper
{
public var wsse:Namespace=new Namespace("http://docs.oasis-open.org/wss/
2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
// Constructor
public function _Super_BillService()
{
// initialize service control
_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, "sendBill");
operation.resultType = ByteArray;
operations["sendBill"] = operation;
//agregar cabecera
var secHeader:WSSecurityHeader = new WSSecurityHeader("201000666
03MODDATOS","moddatos");
_serviceControl.addHeader(secHeader.getSoapHeader());//add the W
SSecurity header to the outgoing message
// _serviceControl.addHeader(agregarCabecera2("20100066603MODDATOS"
,"moddatos"));
_serviceControl.operations = operations;
try
{
_serviceControl.convertResultHandler = com.adobe.serializers.utility
.TypeUtility.convertResultHandler;
}
catch (e: Error)
{ /* Flex 3.4 and eralier does not support the convertResultHandler func
tionality. */ }
//Leer de archivo de Texto
//var f:File=File.userDirectory.resolvePath("Comprobantes\\Confi
guracion\\ServicioWeb.txt");
var f:File=File.documentsDirectory.resolvePath("Comprobantes\\Co
nfiguracion\\ServicioWeb.txt");
var fileStream:FileStream= new FileStream();
fileStream.open(f,FileMode.READ);
var cadena:String=fileStream.readUTFBytes(fileStream.bytesAvaila
ble);
fileStream.close();
//Fin Leer ARchivo
_serviceControl.service = "billService";
_serviceControl.port = "BillServiceImplPort";
// wsdl = "http://64.76.79.139/ol-ti-itcpgem/billService?wsdl";
wsdl=cadena;
model_internal::loadWSDLIfNecessary();

model_internal::initialize();
}
public function agregarCabecera(username:String,password:String):XML{
var x:XML=
<wsse:Security xmlns:wsse={wsse}>
<wsse:UsernameToken xmlns:wsse={wsse}>
<wsse:Username xmlns:wss
e={wsse}>{username}</wsse:Username>
<wsse:Password xmlns:wss
e={wsse}>{password}</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
return x;
}
public function agregarCabecera2(username:String,password:String):XML{
var x:XML=
<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.or
g/soap/envelope/" xmlns:ser="http://service.sunat.gob.pe" xmlns:wsse="http://doc
s.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:Security xmlns:wsse={wsse}>
<wsse:UsernameToken xmlns:wsse={wsse}>
<wsse:Username x
mlns:wsse={wsse}>{username}</wsse:Username>
<wsse:Password x
mlns:wsse={wsse}>{password}</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
return x;
}
/**
* This method is a generated wrapper used to call the 'sendBill' opera
tion. It returns an mx.rpc.AsyncToken whose
* result property will be populated with the result of the operation w
hen the server response is received.
* To use this result from MXML code, define a CallResponder component
and assign its token property to this method's return value.
* You can then bind to CallResponder.lastResult or listen for the Call
Responder.result or fault events.
*
* @see mx.rpc.AsyncToken
* @see mx.rpc.CallResponder
*
* @return an mx.rpc.AsyncToken whose result property will be populated wit
h the result of the operation when the server response is received.
*/
public function sendBill(fileName:String, contentFile:ByteArray) : mx.rp
c.AsyncToken
{
model_internal::loadWSDLIfNecessary();
var _internal_operation:mx.rpc.AbstractOperation = _serviceContr
ol.getOperation("sendBill");
var _internal_token:mx.rpc.AsyncToken = _internal_operation.send
(fileName,contentFile) ;
return _internal_token;
}
}
}

S-ar putea să vă placă și