Response XML from soap message returning undefined for both error_message and status

DINESH CHINNAD1
Giga Expert

I have this response fields written in Transform Map Script in the Web Service

response.number = target.u_external_ticket_id;

response.u_external_ticket_id = target.number;

response.data_flow_direction =   true;

response.status = response.status;

response.error_message = response.error_message;

<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Body><insertResponse xmlns="http://www.service-now.com/u_saveincident"><sys_id>30639cdf0f12420078bbdb0be1050e9a</sys_id><table>incident</table><display_name>number</display_name><display_value>IN15000447610</display_value><status>updated</status><u_external_ticket_id>IN15000447610</u_external_ticket_id><number>101210</number><error_message>org.mozilla.javascript.Undefined@49fec1</error_message><status>org.mozilla.javascript.Undefined@49fec1</status><data_flow_direction>true</data_flow_direction></insertResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

<error_message>org.mozilla.javascript.Undefined@49fec1</error_message>

<status>org.mozilla.javascript.Undefined@49fec1</status>


But not sure why i am getting undefined in both error_message and status?


Please advise.







6 REPLIES 6

srinivasthelu
Tera Guru

Hi Dinesh,



The last 2 statements in your code(below), are doing that.



What you want to pass the values here?



response.status = response.status;


response.error_message = response.error_message;




You can make them as


response.status = "Success";


response.error_message = "";


Hi Srinivas Thelu




Based on the operation done by client i need to populate this two fields.



Let's take an example, suppose client created or inserted a incident that time



response.status = 'inserted';



Let's take an example, suppose client upadted a incident that was created earlier




response.status = 'updated';




Let's take an example, suppose client not upadted a incident that was created earlier




response.status = 'ignored';






based on the operation done by client i need to populate this field dynamically. Any helps would be much appreciated.


Hi Dinesh,



Then you can copy the action object to the response status.



if(action=='insert' || action=='update')


response.status = action.toString();


else


response.status='ignored'.






Hope this helps.



Thanks


Srinivas


Hi Srinivas Thelu



In action only supports insert and update like action == 'insert' and action == 'update' but still we have ignored, skipped and error  



I have tried that before. We have two more options like Skipped and Error as well.



So the problem is based on the operation done by client we need send the response. Any ideas on this


Capture.PNG



Any ideas on how to tackle this?