Troubleshooting JMS Issues
This chapter explains how to troubleshoot specific properties that you may encounter while developing applications using VoltMX MobileFoundry Integration Service (middleware.properties
). You can access middleware.properties
file from <middleware.home>/middleware/middleware-bootconfig
and edit.
Other Features
-
What is the Standard way in which I can handle HTTP status codes (401, and 404) from VoltMX MobileFoundry Integration Service?
Solution
In PostProcessor, Result object is available. In that, you can use the following code snippet to find the httpStatus code:
Param statusCodeparam = result.findParam("httpStatusCode"); int httpStatusCode = Integer.parseInt(statusCodeparam.getValue());
By default, VoltMX MobileFoundry Integration Service passes the HTTP status code in the resultset json format to device. The following is the sample output string:
resultset = {"httpStatusCode":200,"marketIndex":[{"indName":"Dow Jones Ind.","indVal":"15618.22","symbol":"0DJIA","indValChg":" -20.90"},{"indName":"Nasdaq Comp.","indVal":"3939.86","symbol":"0NDQC","indValChg":"3.27"},{"indName":"NYSE Composite","indVal":" 10011.65","symbol":"0NYC","indValChg":"-52.46"},{"indName":"S & P 500","indVal":"1762.97","symbol":"0S&P5","indValChg":" -4.96"}],"opstatus":0}
You can use the following snippet in
.js
file to get the httpStatusCode from JSON resultset object.int statusCode = resultset["httpStatusCode "];
-
How can I use Basic Authenticate in RESTful service with dynamic userids in request? When working with service definitions in VoltMX Studio, I need to be able to dynamically assign those values in code, that is, do I have to authenticate with Active Directory and then with REST endpoints?
Solution
Dynamically, in basic authentication, in every request, you can pass the username and password in request params with the following specified param names:
- userid
- pwd
If you have any domain and hostname, then use the following specified param names:
- domain
- hname
VoltMX MobileFoundry Integration Service first checks in:
- request parameters
- if not available, it checks in session, that is, session.getAttribute(userid)
- if not available in request and session, then it takes from the service definition file.
In JS code level:
var inputParamTable={};
inputParamTable["appID"] = "ServicesApp";
inputParamTable["serviceID"] = "BasicAuthService"; inputParamTable["userid"] = "steve";
inputParamTable["pwd"] = "apple";
inputParamTable["domain"] = "kits";
inputParamTable["hname"] = "apple";
If you want to store userid and password in HTTP session, write the below code in pre / post processor:
Session session = request.getSession(false); session.setAttribute("userid", "steve"); session.setAttribute("pwd", "**");
-
If end server has proxy enabled authentication, then what should I do?
Solution
You need to configure the below -D parameters:
voltmx.http.proxyHost voltmx.http.proxyPort voltmx.http.proxyUser
voltmx.http.proxyPasswordIf end server is with NTLM enabled authentication, then you need to configure the additional below -D parameter:
voltmx.proxy.ntlm.domainName
-
How can I add Headers?
Solution
-
For example, to add "Content-Type" as a header:
In the Service Definition editor -> Http Headers tab, under Id, declare Content-Type as header type and under Session, select session from the drop-down list as shown:
Write preprocessor for the service and use the following snippet in preprocessor:
Session session = request.getSession(); session.setAttribute("Content-Type"," application/json");
-
If you want to pass header values in "request" parameters,
In the Service Definition editor -> Http Headers tab, under Scope, select request from the drop-down list, then pass the header value with same key that you defined in Header section with request as scope.
For example,
1.Content-Type - request scope in VoltMX Studio Header section
2.Use the below code in JavaScript
var inputParamTable={};
inputParamTable["Content-Type"] = "application/json";
-
-
How can I add Custom Cookies in header?
Solution
-
Create cookie object using HTTP client 4.1 API, org.apache.http.cookie.Cookie
-
In pre or post processor, use the following snippet:
Session session = request.getSession(false); session.setAttribute("KCookie",cookie);
-
-
How can I change the url or user authentication details dynamically?
Solution Implement URLProvider2 class and write your own logic to override the service definition values.
-
If request data is more than 1024 MB, then Linux default values do not allow to forward the request. What do I need to do so that Linux values allow to forward the request?
Solution
Login to Linux shell with root privileges.
Set the following in Linux Operating System:
Below changes apply on QNBDEV server to resolve the BRE service issue.
#vi /etc/sysctl.conf (Add the below values) #increase TCP max buffer size settable using setsockopt()net.core.rmem_max = 16777216 net.core.wmem_max = 16777216 #recommended for hosts with jumbo frames enabled net.ipv4.tcp_mtu_probing=1
-
If a SOAP response has an embedded xml, then what do I need to do?
Solution
Select the Escape embedded xml in response check box in the SOAP service definition editor in VoltMX Studio to enable it.
Sample HTTP Response from end server:
<soapenv:Envelope xmlns:Soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <lmsSOAPResponse xmlns="HYPERLINK "http://lms.sbi.com/"http://lms.sbi.com"> <lmsPReturn><?xml version="1.0" encoding="UTF-8" standalone="no"?><LMS><record id="0"><CO_APP2_GMI>![CDATA[Google check]]</CO_APP2_GMI><NMI_ELG_CAL></record></LMS></lmsReturn> </lmsSOAPResponse> </soapenv:Body> </soapenv:Envelope>
The sample embedded xml in SOAP response is converted into valid SOAP response for parsing as shown:
<soapenv:Envelope xmlns:Soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <lmsSOAPResponse xmlns="HYPERLINK 'http://lms.sbi.com/' http://lms.sbi.com"> <lmsPReturn>><?xml version="1.0" encoding="UTF-8" standalone="no"?><LMS><record id="0"><CO_APP2_GMI>![CDATA[Google check]]</CO_APP2_GMI><NMI_ELG_CAL></record></LMS></lmsReturn> </lmsSOAPResponse> </soapenv:Body> </soapenv:Envelope>