Вы находитесь на странице: 1из 3

MvxLib

Introduction
MvxLibisafreelibrarythatenablesyoutoc ommunic atewithIntentiaMovex(now
LawsonM3)soc alledMIprogramsviaanFPWservic e.Itisa.NETimplementation/c lone
ofMvxSoc kXthatonlyusesmanagedc odewritteninC#andc anbec ompiledwith
Mic rosoft.NetFramework1.1,2.0aswellasMono.TheabilitytorunitinMonomeans
thatitis(theoretic ally)usableinUnixenvironments(Linux,Mac etc etera).Development
issponsoredbyInsytec .

About
MvxLib'smainpurposewastoreplac etheproprietary(c losedsourc e)COM+c omponent
(MVXSOCKX_SVRLib.dllorMvxSoc kX).It'smainadvantagesisthereforethatyoudon'tneedto
interopCOM+c omponentsinpure.NETenvironments,whic hisknowntobehaveunexpec tedly
(c rashingwithoutthrowingexc eptionsforexample).
Ithasbeenproventorunc leanlywiththousandsofrequestsperminute,thec ommunic ation
c odebasehasnotbeenc hangedinseveralmonths,provingit'sstability.
MvxLibislic ensedundertheLGPL(GNULesserGeneralPublic Lic ense).Ifyouareunfamiliar
withtheterm,pleasereadmoreaboutLGPLoropensourc eingeneral.

Moreinformation
MvxLib'sSourc eForgeprojec tpage
Downloadbinariesandsourc ec ode
BrowseSubversionrepository(SVNrepositoryavailableat
https://mvxlib.svn.sourc eforge.net/svnroot/mvxlib)

Contribute
Ifyouhaveanytypeofsuggestionsorfeedbac kIwillhappilyrec eiveit!SeemySourc eForge
userpageforc ontac tinformation.Ialsoprovidedevelopmentandprogrammingservic es.

Documentation
Thelibraryc ontainsthefollowingc lasses(allinthenamespac eMvxLib):
MvxSc kandTrac eLog
provideslogin,logout,c ommandsendingandtrac ing
MvxSc kCommand
methodsinthisc lassdefinesc ommonMIprograminterfac es,usetheesetoeasilybuild
c ommandstringstosendthroughthesoc ket
MvxSc kCommandBuilder
thisc lassprovidesfunc tionstobuildc ommandstringsinac ontrolledmanor,itismainly
usedbyMvxSc kCommand
MvxSc kResponse
methodsinthisc lassareusedtoparsec ommonMIprogramresponsestrings
MvxSc kResponseBuilder
thisc lassprovidesfunc tionstoparseresponsestringsandismainlyusedby
MvxSc kResponse

Examplecode
Examplec odeinC#usingMvxLib.Thisshowshowyouc oulduseMvxLibtoc onnec t,senda

c ommandandretreivetheresponsemessage.
strings_host="MVXHST";
ints_ip=6012;
strings_user="USRNME";
strings_pass="THEPWD";
strings_libr="MVXTST";
strings_prgm="OIS320MI";
MvxSckconn=null;
try
{
//OpenconnectiontoMovex
conn=newMvxSck(s_host,s_ip);
conn.Connect();
conn.Login(
s_user,
s_pass,
s_libr,
s_prgm);
//Preparecommandtosend,noticetheuseofdatatypes(notjuststrings)
stringcmd=MvxSckCommand.GetPriceLine(
1,//Company
"AS1",//Facility
"654",//Customer
"AS12",//Item
"SP1",//Warehouse
DateTime.Now,//Orderdate
1,//Orderqty
"PKG",//Unit
"SEK",//Currency
string.Empty,//Ordertype
string.Empty);//Pricelist
//Runcommand;getresponse
stringret=conn.Execute(cmd);
MvxSckResponse.PriceLineItemret_obj=MvxSckResponse.GetPriceLineItem(ret);
//ret_objcontainsallthereturnedinformationparsedandpackaged
}
catch(MvxSckExceptionex)
{
//HandleexceptionsthrownbyMvxSck
}
catch(Exceptionex)
{
//Handleexceptions
}
finally
{
if(conn!=null)
conn.Close();
conn=null;
}

Examplec odeinVisualBasic doingthesamethingusingtheoriginalMVXSOCKX_SVRLib.dll.


Dims_hostAsString
Dims_portAsString
Dims_applAsString
Dims_cryptAsLong
Dims_crpykeyAsString
s_host="MVXHST"
s_port=6012
s_appl=""
s_crypt=0
s_crpykey=""
Dims_compAsString
Dims_usrnamAsString
Dims_passwdAsString
Dims_libraryAsString
Dims_programAsString
s_comp="LOCALA"
s_usrnam="USRNME"
s_passwd="THEPWD"
s_library="MVXTST"
s_program="OIS320MI"
DimsocketAsMvxSockX
DimretvalAsLong

DimcmdAsString
Dimres_valAsString
Setsocket=NewMvxSockX
retval=socket.MvxSockSetup(s_host,s_port,s_appl,s_crypt,s_crpykey)
IfNotretval=0Then
'Raiseerror!(errorcode=retval)
Else
retval=socket.MvxSockInit(s_comp,s_usrnam,s_passwd,s_library&"/"&s_program)
IfNotretval=0Then
'Raiseerror!(errorcode=retval)
Else
cmd="GetPriceLine"
cmd=cmd&"1"'Company
cmd=cmd&"AS1"'Facility
cmd=cmd&"654"'Customer
cmd=cmd&"AS12"'Item
cmd=cmd&"SP1"'Warehouse
cmd=cmd&"20060405"'Orderdate
cmd=cmd&"2"'Orderqty
cmd=cmd&"PKG"'Unit
cmd=cmd&"SEK"'Currency
cmd=cmd&"INP"'Ordertype
cmd=cmd&""'Pricelist
retval=socket.MvxSockTrans(cmd,res_val)
'res_valcontainsthereturnedstring
EndIf
socket.MvxSockClose
EndIf
Setsocket=Nothing

Validate XHTML1.1 CSS

20052007MattiasBengtsson