Search code examples
soapibm-mobilefirstmobilefirst-adapters

Mobilefirst 7.0 soapadapter fails calling no argument operatio


I created a soapadapter via the wizard using the webservice wsdl file. Most operation run succesfully bu one. This particular operatio returns an array of objects and consume no arguments. The sample procedure parameters is:

{
  "recuperaVariabili": {
  }
}

Calling the procedure, never invokes onSuccess nor onFailure functions. Looking at MobileFirst server log, I can see the following stacktrace:`

[ERROR   ] FWLSE0099E: An error occurred while invoking procedure  [project FinancialGuardian]SoapAdapter1/RischiServiceService_recuperaVariabiliFWLSE0100E:  parameters: [project FinancialGuardian]
TypeError: Cannot read property "children" from undefined (2015-06-12T15:19:59.479Z/198f6d0c5bd3a9763e35dfa0268338bb84d5cfae/SoapAdapter1-impl.js#1134)
FWLSE0101E: Caused by:  [project FinancialGuardian]nullorg.mozilla.javascript.EcmaError: TypeError: Cannot read property "children" from undefined (2015-06-12T15:19:59.479Z/198f6d0c5bd3a9763e35dfa0268338bb84d5cfae/SoapAdapter1-impl.js#1134)
    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3687)
    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3665)
    at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3693)
    at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3712)
    at org.mozilla.javascript.ScriptRuntime.undefReadError(ScriptRuntime.java:3725)
    at org.mozilla.javascript.ScriptRuntime.getObjectElem(ScriptRuntime.java:1432)
    at org.mozilla.javascript.Interpreter.doGetElem(Interpreter.java:2204)
    at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1260)
    at script.handleMappings(2015-06-12T15:19:59.479Z/198f6d0c5bd3a9763e35dfa0268338bb84d5cfae/SoapAdapter1-impl.js:1134)
    at script.buildBody(2015-06-12T15:19:59.479Z/198f6d0c5bd3a9763e35dfa0268338bb84d5cfae/SoapAdapter1-impl.js:1117)
    at script.RischiServiceService_recuperaVariabili(2015-06-12T15:19:59.479Z/198f6d0c5bd3a9763e35dfa0268338bb84d5cfae/SoapAdapter1-impl.js:960)
    at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:815)
    at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:109)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
    at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:107)
    at com.worklight.integration.js.JavaScriptManager.callFunction(JavaScriptManager.java:267)
    at com.worklight.integration.js.JavaScriptManager.invokeFunction(JavaScriptManager.java:241)
    at com.worklight.integration.js.JavaScriptManager.invokeFunction(JavaScriptManager.java:211)
    at com.worklight.integration.services.impl.AdapterManagerImpl.invokeFunction(AdapterManagerImpl.java:125)
    at com.worklight.integration.js.JavaScriptProcedureInvoker.invoke(JavaScriptProcedureInvoker.java:42)
    at com.worklight.integration.model.ProcedureInvoker.invokeProcedure(ProcedureInvoker.java:54)
    at com.worklight.integration.model.Procedure.invoke(Procedure.java:166)
    at com.worklight.integration.services.impl.DataAccessServiceImpl.callProcedureInternal(DataAccessServiceImpl.java:676)
    at com.worklight.integration.services.impl.DataAccessServiceImpl.callProcedure(DataAccessServiceImpl.java:622)
    at com.worklight.integration.services.impl.DataAccessServiceImpl.access$100(DataAccessServiceImpl.java:69)
    at com.worklight.integration.services.impl.DataAccessServiceImpl$3.execute(DataAccessServiceImpl.java:504)
    at com.worklight.core.auth.impl.AuthenticationServiceBean.accessResource(AuthenticationServiceBean.java:76)
    at com.worklight.integration.services.impl.DataAccessServiceImpl.invokeProcedureInternal(DataAccessServiceImpl.java:501)
    at com.worklight.integration.services.impl.DataAccessServiceImpl.invokeProcedure(DataAccessServiceImpl.java:155)
    at com.worklight.gadgets.serving.handler.BackendQueryHandler.getContent(BackendQueryHandler.java:95)
    at com.worklight.gadgets.serving.handler.BackendQueryHandler.doPost(BackendQueryHandler.java:56)
    at com.worklight.gadgets.serving.GadgetAPIServlet.doGetOrPost(GadgetAPIServlet.java:148)
    at com.worklight.gadgets.serving.GadgetAPIServlet.doPost(GadgetAPIServlet.java:108)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1275)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:766)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:472)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:135)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:89)
    at com.worklight.core.auth.impl.AuthenticationFilter$1.execute(AuthenticationFilter.java:215)
    at com.worklight.core.auth.impl.AuthenticationServiceBean.accessResource(AuthenticationServiceBean.java:76)
    at com.worklight.core.auth.impl.AuthenticationFilter.doFilter(AuthenticationFilter.java:220)
    at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:192)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:86)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:975)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1097)
    at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:81)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:912)
    at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:262)
    at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:938)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)

What am I missing?


Solution

  • I examined the WSDL that you've provided and for the recuperaVariabili service the input parameter is defined as:

    <element name="recuperaVariabili">
      <complexType/>
    </element>
    

    I believe that the empty complexType is what confuses that adapter generator as it might expect some elements/attributes to be defined for that complex type. I must say that this is a valid declaration in XSD/WSDL so the MF should be able to handle such cases.

    I can think of two quick fixes until it will be fixed in MF:

    1) Update the adapter's RischiServiceService_recuperaVariabili function so that the mappings variable should be something like this:

    var mappings = { 
      roots: {
       'recuperaVariabili': { nsPrefix: 'impl', type: 'impl:recuperaVariabili' }                
      },
      types: { 'impl:recuperaVariabili': {
        children: []
        }
      }
    };
    

    2) Update the WSDL so that the declared element will be simpleType.