Discussion:
Calling a function in Pasive mode.
(too old to reply)
Antonio Astorga
2019-10-09 08:17:57 UTC
Permalink
Hello,

Im doing some implementations in TDI using several blocks presented in TDI. Im using LDAP Connectors, Webservices and more.
But i have problems in calling a Webservice function in Pasive mode.

To call a function in pasive mode Im doing this:

if (resultCod == "0"){
task.logmsg("Esto llega a CloseTotal ISIM")
ISIMCloseTotalAdd.getFunction().initialize(null);
ISIMCloseTotalAdd.getFunction().perform(work);
}
else
{
task.logmsg("Esto llega a Update ticket ISIM")
ISIMUpdateSM.getFunction().initialize(null);
ISIMUpdateSM.getFunction().perform(work);

We choose one or another depending the resultCod presente in our ejecution.

When i run the whole Assemblyline i get this error:

10:13:45,725 ERROR - [ISIMCloseSM] CTGDIS181E Error while evaluating Hook 'Function Successful' in the Component 'ISIMCloseSM' (ISIMCloseSM.functioncall_ok).
10:13:45,725 ERROR - [ISIMCloseSM] CTGDIS810E handleException - cannot handle exception , functioncall
10:13:45,725 ERROR - CTGDIS266E Error in NextConnectorOperation. Exception occurred: java.lang.Exception: CTGDIA208E The input operation message parameter was not found in the provided input entry. The required input parameter is: UpdateChangeISIMRequest
10:13:45,725 INFO - CTGDIS315I AssemblyLine worker thread: AssemblyLines/WebServiceServerRecuperado.AxisEasyWebServiceServerConnector.0 is stopped.


Does anyone knows whats happening?
Thank you very much!!
j***@gmail.com
2019-10-10 06:09:32 UTC
Permalink
To call the function, including the hooks and attribute mapping,
you should use callreply() instead.

E.g.
ISIMUpdateSM.callreply(work)

This will cause the input attribute mapping to used, and I guess
that is where you have defined how to create the input parameter
UpdateChangeISIMRequest. After the call, work will also
have the attributes as mapped out by the output attribute mapping.

It is probably not necessary to initialize for every call, but if you really
want to do that, change the Initialize option, which you find
when you press the "More..." button in the configuration panel,
to "Initialize and terminate every time it is used".
Antonio Astorga
2019-10-10 09:57:07 UTC
Permalink
Hello!!!
Thank you very much for your answer.
I tried and to use the callReply(work) but still Im having problems.

I dont understand why this Webservice Works when is Enabled, and why is not working when is in Passive Mode.

I did like like this:

if (resultCod == "0"){
task.logmsg("Esto llega a CloseTotal ISIM")
ISIMCloseTotalAdd.getFunction().initialize(null);
ISIMCloseTotalAdd.callreply(work);

}
else
{
task.logmsg("Esto llega a Update ticket ISIM")
ISIMUpdateSM.getFunction().initialize(null);
ISIMUpdateSM.callreply(work);

}

I did the changues to initialize and terminate every time I used the Function.

And i get the next error:

11:50:32,878 ERROR - CTGDIS183E Error while mapping attribute 'UpdateChangueISIM' in the Output Attribute Map of Component 'ISIMUpdateSM' (ISIMUpdateSM.Output.UpdateChangueISIM).
java.lang.Exception: 'wsUpdateTotal' not found
at com.ibm.di.script.ScriptEngine.unWrap(ScriptEngine.java:977)
at com.ibm.di.script.ScriptEngine.interpret(ScriptEngine.java:942)
at com.ibm.di.script.ScriptEngine.interpret(ScriptEngine.java:925)
at com.ibm.di.server.AttributeMapping$SingleAttributeMap.eval(AttributeMapping.java:723)
at com.ibm.di.server.AttributeMapping.mapAttribute(AttributeMapping.java:279)
at com.ibm.di.server.AttributeMapping.mapEntry(AttributeMapping.java:504)
at com.ibm.di.server.AttributeMapping.mapEntry(AttributeMapping.java:355)
at com.ibm.di.server.FunctionComponent.callreply(FunctionComponent.java:297)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60

Do you know whats happening?
Thank you for your help!!
j***@gmail.com
2019-10-10 10:48:16 UTC
Permalink
Post by Antonio Astorga
11:50:32,878 ERROR - CTGDIS183E Error while mapping attribute 'UpdateChangueISIM' in the Output Attribute Map of Component 'ISIMUpdateSM' (ISIMUpdateSM.Output.UpdateChangueISIM).
java.lang.Exception: 'wsUpdateTotal' not found
This means that in 'ISIMUpdateSM', in the Output attribute map,
you try to map the attribute 'UpdateChangueISIM'.
The Javascript code you have written to do so, refers to a variable
'wsUpdateTotal'. This variable can not be found.

Maybe your code looks like this
return wsUpdateTotal
but you actually meant to do this
return work.wsUpdateTotal

I am only guessing, maybe your code looks completely different,
and you may also have meant to do something different from my guess.
Antonio Astorga
2019-10-10 11:27:05 UTC
Permalink
I applied the new change so

For the ISIMUpdateSM I have:

Input Attributes:
responseUpdateSM conn["UpdateChangeISIMResponse"]

Output Attributes:
return work.wsUpdateTotal UpdateChangueISIM


I have the next code in ISIMUpdateSM Function to create de request in "Hook" before running:

var wsUpdateTotal = system.newEntry()
var pwsNS = "http://servicecenter.peregrine.com/PWS"
var AssigmentGroup = new java.lang.String("HERRAMIENTAS SOPORTE")

var UpdateChangeISIMRequest = wsUpdateTotal.createElementNS(pwsNS,"UpdateChangeISIMRequest")
var model = wsUpdateTotal.createElementNS(pwsNS,"model")
var keys = wsUpdateTotal.createElementNS(pwsNS,"keys")
var intance = wsUpdateTotal.createElementNS(pwsNS,"instance")
var header = wsUpdateTotal.createElementNS(pwsNS,"header")
var RequestID = wsUpdateTotal.createElementNS(pwsNS,"RequestID")
var AssignmentGroup = wsUpdateTotal.createElementNS(pwsNS,"AssignmentGroup")

//var requestId=attName.getValuesVector().get(0)[3];

RequestID.appendChild(work.createTextNode(requestId))
AssignmentGroup.appendChild(work.createTextNode(work.getString("AssigmentGroup")))

header.appendChild(RequestID)
keys.appendChild(RequestID)
header.appendChild(AssignmentGroup)

instance.appendChild(header)
model.appendChild(keys)
model.appendChild(instance)
UpdateChangeISIMRequest.appendChild(model)
wsUpdateTotal.appendChild(UpdateChangeISIMRequest)
task.dump(wsUpdateTotal)

In Hook "function Succesfull" i have this:

var wsresponseUpdate = work.getAttribute("responseUpdateSM")
task.logmsg("responseUPdate:"+wsresponseUpdate.toString())


And now it is complaning again about missing the Input parameter, i have this:
13:16:44,974 ERROR - [ISIMCloseSMAdd] CTGDIS181E Error while evaluating Hook 'Function Successful' in the Component 'ISIMCloseSMAdd' (ISIMCloseSMAdd.functioncall_ok).
java.lang.Exception: CTGDIA208E The input operation message parameter was not found in the provided input entry. The required input parameter is: UpdateChangeISIMRequest
at com.ibm.di.fc.axis2.Axis2WSClientFC.perform(Axis2WSClientFC.java:276)
at com.ibm.di.server.AssemblyLineComponent.executeOperation(AssemblyLineComponent.java:3336)
at com.ibm.di.server.FunctionComponent.callreply(FunctionComponent.java:303)
at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at com.ibm.jscript.types.JavaAccessObject.call(JavaAccessObject.java:321)
at com.ibm.jscript.types.FBSObject.call(FBSObject.java:161)
at com.ibm.jscript.ASTTree.ASTCall.interpret(ASTCall.java:175)
at com.ibm.jscript.ASTTree.ASTBlock.interpret(ASTBlock.java:100)
at com.ibm.jscript.ASTTree.ASTIf.interpret(ASTIf.java:90)
at com.ibm.jscript.ASTTree.ASTProgram.interpret(ASTProgram.java:119)
at com.ibm.jscript.ASTTree.ASTProgram.interpretEx(ASTProgram.java:139)
at com.ibm.jscript.JSExpression._interpretExpression(JSExpression.java:435)
at com.ibm.jscript.JSExpression.interpretExpression(JSExpression.java:421)
at com.ibm.jscript.JSExpression.evaluateValue(JSExpression.java:251)
at com.ibm.jscript.JSExpression.evaluateValue(JSExpression.java:238)
at com.ibm.jscript.JSExpression.evaluateValue(JSExpression.java:241)
at com.ibm.jscript.JSInterpreter.interpret(JSInterpreter.java:57)
at com.ibm.di.script.ScriptEngine.interpret(ScriptEngine.java:940)
at com.ibm.di.script.ScriptEngine.interpret(ScriptEngine.java:925)
at com.ibm.di.server.AttributeMapping$SingleAttributeMap.eval(AttributeMapping.java:723)
at com.ibm.di.server.AttributeMapping.eval(AttributeMapping.java:238)
at com.ibm.di.server.AssemblyLineComponent.triggerImpl(AssemblyLineComponent.java:2740)
at com.ibm.di.server.AssemblyLineComponent.trigger(AssemblyLineComponent.java:2690)
at com.ibm.di.server.AssemblyLineComponent.handleSuccess(AssemblyLineComponent.java:2642)
at com.ibm.di.server.AssemblyLine.msExecuteNextConnector(AssemblyLine.java:3775)
at com.ibm.di.server.AssemblyLine.executeMainStep(AssemblyLine.java:3351)
at com.ibm.di.server.AssemblyLine.executeMainLoop(AssemblyLine.java:2960)
at com.ibm.di.server.AssemblyLinePool$ALWorker.run(AssemblyLinePool.java:779)
13:16:44,974 ERROR - [ISIMCloseSMAdd] CTGDIS810E handleException - cannot handle exception , functioncall


Hope you can help me again with this..it´s driving me crazy!! :D
j***@gmail.com
2019-10-10 12:06:40 UTC
Permalink
It seems to me that you map out an attribute named UpdateChangueISIM ,
but the function expects an attribute named UpdateChangeISIMRequest.

Maybe change the name of the attribute in the output map?

I am also unsure what you mean by
... "Hook" before running:
If the code is in the 'Before Execute' hook, that will actually not
get called when you do
ISIMUpdateSM.callreply(work);
The reason is that this particular hook is called before the execution
of the callreply() code in the component, as the name of the hook
kind of implies.

If you have your code in the 'Before Execute' hook, could you copy it to
the "Before Call" hook, and add
conn.setAttribute("UpdateChangeISIMRequest", wsUpdateTotal)
at the end of the code.
Maybe that works?
Antonio Astorga
2019-10-10 13:41:34 UTC
Permalink
In the mapping, I thought i need to put the name of the WS operation.

I did all the changues that you told me and finally i can do the request.

INFO - CTGDIS003I *** Start dumping Entry
INFO - {
INFO - "UpdateChangeISIMRequest": {
INFO - "model": {
INFO - "keys": {
INFO - "RequestID": "RQ150307"
INFO - },
INFO - "instance": {
INFO - "header": {
INFO - "RequestID": "RQ150307"
INFO - },
INFO - "header": {
INFO - "RequestID": "RQ150307",
INFO - "AssignmentGroup": "HERRAMIENTAS SOPORTE"
INFO - }
INFO - }
INFO - }
INFO - }
INFO - }

So the function of this is different whne is Enabled vs Passive mode, right?

Now it seems that the problem faced to call a functon in passive mode is done but now i get this error once the request is done :s


[ISIMCloseSMAdd] CTGDIS181E Error while evaluating Hook 'Function Successful' in the Component 'ISIMCloseSMAdd' (ISIMCloseSMAdd.functioncall_ok).
15:22:13,826 ERROR - [ISIMCloseSMAdd] CTGDIS810E handleException - cannot handle exception , functioncall
java.lang.Exception: CTGDIA207E An Exception occured while tring to invoke the Web Service. Exception message: A CXmlApiException was raised in native code : error 4 : scxmlapi(4) - Documento XML faltante o no válido
at com.ibm.di.fc.axis2.Axis2WSClientFC.perform(Axis2WSClientFC.java:347)
at com.ibm.di.server.AssemblyLineComponent.executeOperation(AssemblyLineComponent.java:3336)
at com.ibm.di.server.FunctionComponent.callreply(FunctionComponent.java:303)
at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at com.ibm.jscript.types.JavaAccessObject.call(JavaAccessObject.java:321)
at com.ibm.jscript.types.FBSObject.call(FBSObject.java:161)
at com.ibm.jscript.ASTTree.ASTCall.interpret(ASTCall.java:175)
at com.ibm.jscript.ASTTree.ASTBlock.interpret(ASTBlock.java:100)
at com.ibm.jscript.ASTTree.ASTIf.interpret(ASTIf.java:85)
at com.ibm.jscript.ASTTree.ASTProgram.interpret(ASTProgram.java:119)
at com.ibm.jscript.ASTTree.ASTProgram.interpretEx(ASTProgram.java:139)
at com.ibm.jscript.JSExpression._interpretExpression(JSExpression.java:435)
at com.ibm.jscript.JSExpression.interpretExpression(JSExpression.java:421)
at com.ibm.jscript.JSExpression.evaluateValue(JSExpression.java:251)
at com.ibm.jscript.JSExpression.evaluateValue(JSExpression.java:238)
at com.ibm.jscript.JSExpression.evaluateValue(JSExpression.java:241)
at com.ibm.jscript.JSInterpreter.interpret(JSInterpreter.java:57)
at com.ibm.di.script.ScriptEngine.interpret(ScriptEngine.java:940)
at com.ibm.di.script.ScriptEngine.interpret(ScriptEngine.java:925)
at com.ibm.di.server.AttributeMapping$SingleAttributeMap.eval(AttributeMapping.java:723)
at com.ibm.di.server.AttributeMapping.eval(AttributeMapping.java:238)
at com.ibm.di.server.AssemblyLineComponent.triggerImpl(AssemblyLineComponent.java:2740)
at com.ibm.di.server.AssemblyLineComponent.trigger(AssemblyLineComponent.java:2690)
at com.ibm.di.server.AssemblyLineComponent.handleSuccess(AssemblyLineComponent.java:2642)
at com.ibm.di.server.AssemblyLine.msExecuteNextConnector(AssemblyLine.java:3775)
at com.ibm.di.server.AssemblyLine.executeMainStep(AssemblyLine.java:3351)
at com.ibm.di.server.AssemblyLine.executeMainLoop(AssemblyLine.java:2960)
at com.ibm.di.server.AssemblyLinePool$ALWorker.run(AssemblyLinePool.java:779)
15:22:13,826 ERROR - CTGDIS266E Error in NextConnectorOperation. Exception occurred: java.lang.Exception: CTGDIA207E An Exception occured while tring to invoke the Web Service. Exception message: A CXmlApiException was raised in native code : error 4 : scxmlapi(4) - Documento XML faltante o no válido

Thank you very much for all of this!!
j***@gmail.com
2019-10-11 02:32:43 UTC
Permalink
The error message says that the XML document is invalid, or maybe missing.

So, maybe, I am guessing here, since I do not know what kind of input
your web service wants, you need to provide an XML string.

You could try to replace my suggestion

conn.setAttribute("UpdateChangeISIMRequest", wsUpdateTotal)

with
conn.setAttribute("UpdateChangeISIMRequest", wsUpdateTotal.toXML())
task.logmsg("UpdateChangeISIMRequest is " + wsUpdateTotal.toXML())

Compare this to what the documentation for your webservice says
should be provided.
Antonio Astorga
2019-10-11 07:19:45 UTC
Permalink
Thank you again for this, but Still the same problem.
Do you know why this WS is working when Enabled? :S
The documentatio from the webservices says this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pws="http://servicecenter.peregrine.com/PWS" xmlns:com="http://servicecenter.peregrine.com/PWS/Common">
<soapenv:Header/>
<soapenv:Body>
<pws:UpdateChangeISIMRequest ignoreEmptyElements="true" updateconstraint="-1">
<pws:model>
<pws:keys>
<pws:RequestID type="String">RQ089255</pws:RequestID>
</pws:keys>
<pws:instance>
<pws:header type="Structure">
<pws:RequestID type="String">RQ089255</pws:RequestID>
<pws:AssignmentGroup type="String">HERRAMIENTAS SOPORTE</pws:AssignmentGroup>
</pws:header>
</pws:instance>
</pws:model>
</pws:UpdateChangeISIMRequest>
</soapenv:Body>
</soapenv:Envelope>


And applying the changes that you told me i get this:

09:06:13,906 INFO - UpdateChangeISIMRequest is : <UpdateChangeISIMRequest xmlns="http://servicecenter.peregrine.com/PWS">
<model>
<keys>
<RequestID>RQ150307</RequestID>
</keys>
<instance>
<header>
<RequestID>RQ150307</RequestID>
</header>
<header>
<RequestID>RQ150307</RequestID>
<AssignmentGroup>HERRAMIENTAS SOPORTE</AssignmentGroup>
</header>
</instance>
</model>
</UpdateChangeISIMRequest>



And i get this error:

09:06:15,684 ERROR - [ISIMCloseSMAdd] CTGDIS181E Error while evaluating Hook 'Function Successful' in the Component 'ISIMCloseSMAdd' (ISIMCloseSMAdd.functioncall_ok).
java.lang.Exception: CTGDIA207E An Exception occured while tring to invoke the Web Service. Exception message: A CXmlApiException was raised in native code : error 4 : scxmlapi(4) - Documento XML faltante o no válido.

Hope you can help me with this.
Thanks again!!
j***@gmail.com
2019-10-14 04:41:34 UTC
Permalink
Please try adding your request to the conn Entry with this code instead
of my previous suggestion.

conn.appendChild(UpdateChangeISIMRequest)
task.logmsg("conn is now: " + conn.toXML())

Also, the documentation indicates that some attributes should be added
to some of the elements, e.g the header could have type=Structure, like this:

var header = wsUpdateTotal.createElementNS(pwsNS,"header")
header.setAttribute("type", "Structure")

You could also add some other attributes to the request itself,
they are there in the example:

var UpdateChangeISIMRequest = wsUpdateTotal.createElementNS(pwsNS,"UpdateChangeISIMRequest")
UpdateChangeISIMRequest.setAttribute("ignoreEmptyElements", "true")
UpdateChangeISIMRequest.setAttribute("updateconstraint", "-1")

When I look at the output you get when you dump your request,
I see a duplicate header element in the instance element.
You should probably not have that.
Antonio Astorga
2019-10-15 13:08:02 UTC
Permalink
I did and finally is working.
Thank you very much for your help!!

I still dont understand why everything was working when I was using the Funtion in enabled mode.
Loading...