Index: /main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_webservices.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_webservices.py	(revision 10041)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_webservices.py	(revision 10042)
@@ -1,9 +1,12 @@
 # Tests for webservices
 import xmlrpclib
+import os
+from cStringIO import StringIO
 from zope.app.testing.xmlrpc import ServerProxy
-from zope.component import createObject
+from zope.component import createObject, getUtility
 from zope.component.hooks import setSite
 from zope.testbrowser.testing import Browser
 from waeup.kofa.app import University
+from waeup.kofa.interfaces import IExtFileStore, IFileStoreNameChooser
 from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase
 from waeup.kofa.students.tests.test_browser import StudentsFullSetup
@@ -35,4 +38,13 @@
         ticket.semester = 2
         study_level[ticket.code] = ticket
+
+    def create_passport_img(self, student):
+        # create some passport file for `student`
+        storage = getUtility(IExtFileStore)
+        image_path = os.path.join(os.path.dirname(__file__), 'test_image.jpg')
+        self.image_contents = open(image_path, 'rb').read()
+        file_id = IFileStoreNameChooser(student).chooseName(
+            attr='passport.jpg')
+        storage.createFile(file_id, StringIO(self.image_contents))
 
     def XMLRPC_post(self, body):
@@ -191,2 +203,67 @@
         self.assertEqual(xmlout, RESPONSE_XML)
         return
+
+    def test_get_student_info(self):
+        server = ServerProxy('http://mgr:mgrpw@localhost/app')
+        self.setup_student(self.student)
+        result = server.get_student_info('123')
+        self.assertEqual(result,
+            ['Anna Tester', 'CERT1', '1234', 'aa@aa.ng'])
+        REQUEST_XML="""\
+<?xml version="1.0"?>
+<methodCall>
+<methodName>get_student_info</methodName>
+<params>
+<param>
+<value><string>K1000000</string></value>
+</param>
+</params>
+</methodCall>"""
+        RESPONSE_XML="""\
+<?xml version='1.0'?>
+<methodResponse>
+<params>
+<param>
+<value><array><data>
+<value><string>Anna Tester</string></value>
+<value><string>CERT1</string></value>
+<value><string>1234</string></value>
+<value><string>aa@aa.ng</string></value>
+</data></array></value>
+</param>
+</params>
+</methodResponse>
+"""
+        xmlout = self.XMLRPC_post(REQUEST_XML)
+        self.assertEqual(xmlout, RESPONSE_XML)
+        return
+
+    def test_get_student_passport(self):
+        server = ServerProxy('http://mgr:mgrpw@localhost/app')
+        self.setup_student(self.student)
+        self.create_passport_img(self.student)
+        result = server.get_student_passport('123')
+        img = getUtility(IExtFileStore).getFileByContext(
+            self.student, attr='passport.jpg')
+        binary = img.read()
+        self.assertEqual(binary, result)
+        REQUEST_XML="""\
+<?xml version="1.0"?>
+<methodCall>
+<methodName>get_student_passport</methodName>
+<params>
+<param>
+<value><string>K1000000</string></value>
+</param>
+</params>
+</methodCall>"""
+        RESPONSE_XML="""\
+<?xml version='1.0'?>
+<methodResponse>
+<params>
+<param>
+<value><base64>
+/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAAPAAA/+4ADkFkb2JlAGTAAAAAAf/b
+"""
+        xmlout = self.XMLRPC_post(REQUEST_XML)
+        self.assertTrue(xmlout.startswith(RESPONSE_XML))
Index: /main/waeup.kofa/trunk/src/waeup/kofa/students/webservices.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/students/webservices.py	(revision 10041)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/students/webservices.py	(revision 10042)
@@ -18,7 +18,9 @@
 
 import grok
+import xmlrpclib
 from zope.component import getUtility, queryUtility
 from zope.catalog.interfaces import ICatalog
-from waeup.kofa.interfaces import IUniversity
+from waeup.kofa.interfaces import IUniversity, IExtFileStore
+    
 
 def get_student(students, identifier):
@@ -136,2 +138,28 @@
                 ticket.__parent__.validated_by))
         return list(set(hitlist))
+
+    @grok.require('waeup.xmlrpc')
+    def get_student_info(self, identifier=None):
+        """Who is the student with matriculation number / student id?
+
+        """
+        students = self.context['students']
+        student = get_student(students, identifier)
+        if student is None:
+            return None
+        return [student.display_fullname, student.certcode,
+            student.phone, student.email]
+
+    @grok.require('waeup.xmlrpc')
+    def get_student_passport(self, identifier=None):
+        """Get passport picture of student with
+        matriculation number / student id?
+
+        """
+        students = self.context['students']
+        student = get_student(students, identifier)
+        if student is None:
+            return None
+        img = getUtility(IExtFileStore).getFileByContext(
+            student, attr='passport.jpg')
+        return xmlrpclib.Binary(img.read())
