build bridging scanner and Active Directory with scanner API (xml)

71 views
Skip to first unread message

黄祥

unread,
Dec 6, 2016, 3:32:31 PM12/6/16
to web2py-users
is it possible to build bridging scanner and Active Directory with scanner API (xml) using web2py?
e.g. xml for Menu to choosing system
<?xml version="1.0" encoding="UTF-8" ?>
<SerioCommands version="1.0">
<DisplayForm>
<Script>
<![CDATA[
<UiScreen>
<Title>Select Job</Title>
<LinkScreen>
<LinkControl>
<LinkItem href="./scan2ftp.xml">
<Label>Scan</Label>
</LinkItem>
<LinkItem href="./copy.xml">
<Label>Copy</Label>
</LinkItem>
</LinkControl>
</LinkScreen>
</UiScreen>
]]>
</Script>
</DisplayForm>
</SerioCommands>

e.g. xml for copy
<?xml version="1.0" encoding="utf-8"?>
<SerioCommands version="1.0">
<IoCopy>
<ColorMode>Auto</ColorMode>
<Density>Normal</Density>
<Ratio>100</Ratio>
<Layout>Normal</Layout>
<LayoutOrientation>Landscape</LayoutOrientation>
<Sorting>true</Sorting>
<NumCopies>1</NumCopies>
<JobFinAckUrl>./selesai.xml</JobFinAckUrl>
</IoCopy>
<DisplayInfo>
<Script>
<![CDATA[
<UiScreen infoLevel="Normal">
<IoScreen>
<IoObject>
<Title>Copy</Title>
<Message>executing copy</Message>
</IoObject>
</IoScreen>
</UiScreen>
]]>
</Script>
</DisplayInfo>
</SerioCommands>

e.g. xml for FTP command
<?xml version="1.0" encoding="utf-8"?>
<SerioCommands version="1.0">
<IoScanAndSend>
<TxProfiles>
<Ftp>
<FtpParams>
<FileName>test</FileName>
<Host>example.com</Host>
<User>usertest</User>
<Password>123456789</Password>
<StoreDir>/</StoreDir>
<PassiveMode>true</PassiveMode>
<PortNum>21</PortNum>
</FtpParams>
</Ftp>
</TxProfiles>
<!-- <ScanTray>FB</ScanTray> -->
<ColorMode>Gray</ColorMode>
<Resolution>Low</Resolution>
<!-- <FileType>JPEG</FileType> -->
<FileType>PDF</FileType>
<JobFinAckUrl>./done.xml</JobFinAckUrl>
</IoScanAndSend>
<DisplayInfo>
<Script>
<![CDATA[
<UiScreen>
<IoScreen>
<IoObject>
<Title>Scan2Ftp</Title>
<Message>executing scan2ftp</Message>
</IoObject>
</IoScreen>
</UiScreen>
]]>
</Script>
</DisplayInfo>
</SerioCommands>

thanks and best regards,
stifan

Niphlod

unread,
Dec 6, 2016, 5:07:44 PM12/6/16
to web2py-users
why not ? what's your problem ?

黄祥

unread,
Dec 6, 2016, 7:02:15 PM12/6/16
to web2py-users
i don't know how to do it, so perhaps someone can give a pointer, i take a look at the book it seems i need to use ldap login 
from gluon.contrib.login_methods.ldap_auth import ldap_auth
auth.settings.login_methods.append(ldap_auth(mode='ad',
   server='my.domain.controller',
   base_dn='ou=Users,dc=domain,dc=com'))

n for xml part, i don't know how to handle it, just start to learn from the simple thing 
e.g.
controllers/default.py
def test():
    test_date = request.now
    test_string = 'test string'
    test_integer = 1
    test_float = 0.2
    test_list = [1, 2, 3]
    test_tuple = (7, 8, 9)
    test_dict = {'k0' : 'v', 'k1':3}
    return dict(test_date = test_date, 
    test_string = test_string, 
    test_integer = test_integer, 
    test_float = test_float, 
    test_list = test_list, 
    test_tuple = test_tuple, 
    test_dict = test_dict)

<document>
<test_list>
<item>1</item>
<item>2</item>
<item>3</item>
</test_list>
<test_date>2016-12-07 06:45:04.252299</test_date>
<test_integer>1</test_integer>
<test_float>0.2</test_float>
<test_tuple>(7, 8, 9)</test_tuple>
<test_dict>
<k1>3</k1>
<k0>v</k0>
</test_dict>
<test_string>test string</test_string>
</document>

question 1:
so i assume, i need a dict {} to generate the xml, the question is why there is <document> in the xml result? is it possible to have different at the top?
e.g.
<?xml version="1.0" encoding="UTF-8" ?>
<SerioCommands version="1.0">
...
</SerioCommands>

question 2:
how to generate the CDATA in xml ?
e.g.
<![CDATA[
...
]]>

question 3:
why i can't create dict in dict to produce xml result like
<UiScreen>
<Title>Select Job</Title>
<LinkScreen>
<LinkControl>
<LinkItem href="./scan2ftp.xml">
<Label>Scan</Label>
</LinkItem>
<LinkItem href="./copy.xml">
<Label>Copy</Label>
</LinkItem>
</LinkControl>
</LinkScreen>
</UiScreen>

Niphlod

unread,
Dec 7, 2016, 4:07:05 PM12/7/16
to web2py-users
it's still absolutely NOT clear what you need to do. "bridge a scanner with LDAP" is quite vague....
Reply all
Reply to author
Forward
0 new messages