Q: Unable to transform JSON response using Script Mediator on server All,
I'm working on converting a JSON response to my desired format using script mediator This script mediator works fine in the local with dummy data , but when I move the js to the server, its unable to parse the XML output as it did in the local PC. 
Please find the details below. 
XML output from end system : 
<xml version="1.0" encoding="UTF-8"?> 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
   <soapenv:Body> 
      <getMyClsScheduleResponse xmlns="http://<HostName>/schemas/getMyClsScheduleResponse.v1" xsi:schemaLocation="http://mais.he.umich.edu/schemas/getMyClsScheduleResponse.v1 http://<HostName>/PSIGW/PSCOnnection/getMyClsScheduleResponse.v1.xsd"> 
         <RegisteredClass> 
            <ClassNumber>10757</ClassNumber> 
            <SubjectCode>AAS</SubjectCode> 
            <CatalogNumber>510</CatalogNumber> 
..... 
.... 
... 
            <Instructor> 
               <InstructorName>Lyke-Whiting,Lynn</InstructorName> 
               <LastName>Lyke-Whiting</LastName> 
               <FirstName>Lynn</FirstName> 
               <Uniqname>LYNNW</Uniqname> 
               <InstructorRole>Secondary Instructor</InstructorRole> 
            </Instructor> 
         </RegisteredClass> 
      </getMyClsScheduleResponse> 
   </soapenv:Body> 
</soapenv:Envelope>
Json Response : 
   "getMyClsScheduleResponse": { 
      "@schemaLocation": "http://<HostName>/schemas/getMyClsScheduleResponse.v1 http://<HostName>/PSIGW/PSConnection/getMyClsScheduleResponse.v1.xsd", 
      "RegisteredClass": [ 
         { 
            "ClassNumber": "10757", 
            "SubjectCode": "AAS", 
            "CatalogNumber": "510", 
            "SectionNumber": "001", 
            "SectionType": "IND", 
            "SectionTypeDescr": "Independent Study", 
            "SessionDescr": "Regular", 
            "CourseDescr": "Supervised Research", 
            "ClassTopic": "", 
            "CreditHours": "1 - 6", 
            "LMSURL": "", 
            "Meeting": { 
               "MeetingNumber": "1", 
               "Days": "", 
               "Times": "", 
               "StartDate": "09/02/2014", 
               "EndDate": "12/10/2014", 
               "Location": "TBA", 
               "TopicDescr": "" 
            } 
         }, 
         { 
            "ClassNumber": "30573", 
            "SubjectCode": "ASIANLAN", 
            "CatalogNumber": "100", 
            "SectionNumber": "001", 
            "SectionType": "REC", 
            "SectionTypeDescr": "Recitation", 
            "SessionDescr": "Regular", 
            "CourseDescr": "Acc Elem Chinese", 
            "ClassTopic": "", 
            "CreditHours": "3", 
            "LMSURL": "", 
            "Meeting": { 
               "MeetingNumber": "1", 
               "Days": "MoWeFr", 
               "Times": "9:00AM - 10:00AM", 
               "StartDate": "09/02/2014", 
               "EndDate": "12/10/2014", 
               "Location": "706 BMT", 
               "TopicDescr": "" 
            }, 
            "Instructor": [ 
               { 
                  "InstructorName": "Emery,Lisa B", 
                  "LastName": "Emery", 
                  "FirstName": "Lisa", 
                  "Uniqname": "EMERYL", 
                  "InstructorRole": "Secondary Instructor" 
               }, 
               { 
                  "InstructorName": "Ford,Phyllis", 
                  "LastName": "Ford", 
                  "FirstName": "Phyllis", 
                  "Uniqname": "PAFORD", 
                  "InstructorRole": "Secondary Instructor" 
               }, 
               { 
                  "InstructorName": "Zhong,Yan", 
                  "LastName": "Zhong", 
                  "FirstName": "Yan", 
                  "Uniqname": "YANZHO", 
                  "InstructorRole": "Primary Instructor" 
               } 
            ] 
         }, 
      ] 
   } 
}
Error log: 
TID: [0] [ESB] [2014-10-29 11:07:00,664] ERROR {org.apache.synapse.mediators.bsf.ScriptMediator} - The script engine returned an error executing the external js script : Value {name ='null', keyValue ='conf:/repository/esb/js/functions.js'} function transformPayload {org.apache.synapse.mediators.bsf.ScriptMediator} 
com.sun.phobos.script.util.ExtendedScriptException: org.mozilla.javascript.EcmaError: TypeError: Cannot read property "RegisteredClass" from undefined (<Unknown source>#8) in <Unknown source> at line number 8 
        at com.sun.phobos.script.javascript.RhinoScriptEngine.invokeMethod(RhinoScriptEngine.java:259) 
        at com.sun.phobos.script.javascript.RhinoScriptEngine.invokeFunction(RhinoScriptEngine.java:216) 
        at org.apache.synapse.mediators.bsf.ScriptMediator.mediateWithExternalScript(ScriptMediator.java:271) 

Script mediator code : 
function transformPayload(output) { 
payload = output.getPayloadJSON(); 
results = payload.getMyClsScheduleResponse.RegisteredClass; // Failing at this line.

The same issue doesn't occur in the local when I try the same data. Is there something that i'm missing? 
Please let me know. 
Thanks 
Kranthi 
