Access ATG REST webservices from javascript..?
Hi All,
Can we access ATG REST web services from Javascript/jQuery..? If yes, then how..?
Thanks,
Vishnu
Hi Nitin, I'm able to access /atg/dynamo/Configuration component's properties using REST services from following code -
*/atg/rest/security/restSecurityConfiguration.xml*
<resource component="/rest/bean/atg/dynamo/Configuration">
<default-acl value="[email protected]:read,write,execute"/>
<property name="httpPort" secure="false"/>
</resource>
client Java code :
public class RestClientRequest {
public static void main(String[] args) {
RestSession mSession = RestSession.createSession("localhost", 8180, "[email protected]", "chinna");
mSession.setUseHttpsForLogin(false);
try{
String loginStatus = mSession.login();
if(loginStatus == null || "null".equals(loginStatus)){
mSession=null;
System.out.println("Login failed");
else{
RestResult result = RestComponentHelper.getPropertyValue("/atg/dynamo/Configuration", "httpPort", null, mSession);
String test = result.readInputStream();
System.out.println("\n\n"+result.readInputStream());
but getting exception when i try to get repository item using the below code
<rest-security>
<resource component="/rest/repository/atg/commerce/catalog/ProductCatalog">
<default-acl>[email protected]:read,write,execute"</default-acl>
</resource>
</rest-security>
Client Java code:
public class RestClientRequest {
public static void main(String[] args) {
RestSession mSession = RestSession.createSession("localhost", 8180, "[email protected]", "chinna");
mSession.setUseHttpsForLogin(false);
try{
String loginStatus = mSession.login();
if(loginStatus == null || "null".equals(loginStatus)){
mSession=null;
System.out.println("Login failed");
else{
RestResult result = RestResult result = RestRepositoryHelper.getItems("/atg/commerce/catalog/ProductCatalog", "product", null, mSession);
String test = result.readInputStream();
System.out.println("\n\n"+result.readInputStream());
Exception :
Login successful
Login Status : ATG3990000
atg.rest.client.RestClientException: java.io.IOException: Unauthorized Server returned HTTP response code: 401 for URL: http://localhost:8180/rest/repository/atg/commerce/catalog/ProductCatalog/product
at atg.rest.client.RestSession.createHttpRequest(RestSession.java:755)
at atg.rest.client.RestSession.createHttpRequest(RestSession.java:722)
at atg.rest.client.RestRepositoryHelper.getItems(RestRepositoryHelper.java:188)
at in.vcarve.RestClientRequest.main(RestClientRequest.java:26)
Caused by: java.io.IOException: Unauthorized Server returned HTTP response code: 401 for URL: http://localhost:8180/rest/repository/atg/commerce/catalog/ProductCatalog/product
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at atg.rest.client.RestSession.createHttpRequest(RestSession.java:745)
... 3 more
Thanks,
Vishnu
Similar Messages
-
REST Webservice from Workbench
Hello,
I have a simple requirement, I need to invoke a REST webservice from a workbench process, and store the output in a variable (content is XML data to render in a form).
I tried using the Invoke WebService component, but it is only allowing SOAP-based webservices.
How can I achieve this? Is my approach wrong? The idea would be to get a user input throught a human-centric process (a document id), then pass that to a WS that will marshall the XML data and the render the form based on the XML data...
Thanks for your help!I found one link
http://help.adobe.com/en_US/livecycle/10.0/WorkbenchHelp/WS59b3382744928dd516b8381a131573f 6b54-8000.html
but it is not working out...i didn't get what it saying? Please help me out
Srujan -
Error while bringing up ATG REST Webservice
Hi,
I am trying to bring a REST Webservice using ATG 9.3 version.I am getting the below errors in the startup of the instance.I have added "REST" module in the Manifest file and am able to see the entry " C:\ATG\ATG9.3\REST\config\config.jar" in CONFIGPATH(Please let me know if there are other ways to find if the service has come up properly).I am trying to connect to the server using JAVA based REST Client as given below.Also,i have placed the jar files in the CLASSPATH of the module.I am hoping that the webservice have not come up properly because of these startup errors.Please help me out to resolve this issue.
STARTUP EXCEPTION SEEN IN SERVER
========================
2012-06-25 06:20:36,815 INFO [STDOUT] Unable to create class atg.rest.servlet.HeadRestServlet for configuration /atg/dynamo/servlet/dafpipeline/HeadRestServlet java.lang.ClassNotFoundException: No ClassLoaders found for: atg.rest.servlet.HeadRestServlet
2012-06-25 06:21:56,325 INFO [nucleusNamespace.atg.userprofiling.sso.PassportAuthorityService] Starting passport authority service
2012-06-25 06:21:56,460 INFO [STDOUT] **** Error
2012-06-25 06:21:56,460 INFO [STDOUT]
2012-06-25 06:21:56,460 INFO [STDOUT] Mon Jun 25 06:21:56 EDT 2012
2012-06-25 06:21:56,460 INFO [STDOUT]
2012-06-25 06:21:56,460 INFO [STDOUT] 1340619716460
2012-06-25 06:21:56,460 INFO [STDOUT]
2012-06-25 06:21:56,460 INFO [STDOUT] /
2012-06-25 06:21:56,460 INFO [STDOUT]
2012-06-25 06:21:56,460 INFO [STDOUT] Unable to set configured property "/atg/dynamo/servlet/Initial.initialServices" atg.nucleus.ConfigurationException: Unable to resolve component /atg/dynamo/servlet/dafpipeline/HeadRestServlet
2012-06-25 06:22:06,528 INFO [STDOUT] Unable to create class atg.rest.RestConfiguration for configuration /atg/rest/Configuration java.lang.ClassNotFoundException: No ClassLoaders found for: atg.rest.RestConfiguration
2012-06-25 06:22:06,528 INFO [STDOUT] **** Error
2012-06-25 06:22:06,528 INFO [STDOUT]
2012-06-25 06:22:06,528 INFO [STDOUT] Mon Jun 25 06:22:06 EDT 2012
2012-06-25 06:22:06,528 INFO [STDOUT]
2012-06-25 06:22:06,528 INFO [STDOUT] 1340619726528
2012-06-25 06:22:06,528 INFO [STDOUT]
2012-06-25 06:22:06,528 INFO [STDOUT] /
2012-06-25 06:22:06,528 INFO [STDOUT]
2012-06-25 06:22:06,528 INFO [STDOUT] Unable to set configured property "/atg/rest/Initial.initialServices" atg.nucleus.ConfigurationException: Unable to resolve component /atg/rest/Configuration
CLASSPATH ENTRY
============
<classpathentry exported="true" kind="var" path="C:/ATG/ATG9.3/REST/lib/atg-rest-1.0.jar"/>
<classpathentry exported="true" kind="var" path="C:/ATG/ATG9.3/REST/lib/commons-fileupload-1.2.1.jar"/>
<classpathentry exported="true" kind="var" path="C:/ATG/ATG9.3/REST/lib/commons-io-1.4.jar"/>
<classpathentry exported="true" kind="var" path="C:/ATG/ATG9.3/REST/lib/dom4j-1.6.1.jar"/>
<classpathentry exported="true" kind="var" path="C:/ATG/ATG9.3/REST/lib/log4j-1.2.15.jar"/>
<classpathentry exported="true" kind="var" path="C:/ATG/ATG9.3/REST/client-lib/java/atg-rest-client-1.0.jar"/>
REST CLIENT:
========
import java.util.HashMap;
import java.util.Map;
import atg.rest.client.RestClientException;
import atg.rest.client.RestComponentHelper;
import atg.rest.client.RestResult;
import atg.rest.client.RestSession;
public class RestClient {
RestSession mSession;
protected void execute() throws RestClientException {
System.out.println("inside execute");
mSession = RestSession.createSession("localhost", 8080, "<USERNAME>", "<PASSWORD>");
mSession.setUseHttpsForLogin(false);
try {
mSession.login();
System.out.println("Login Successful");
catch (Throwable t) {
System.out.println(t);
finally {
try {
mSession.logout();
System.out.println("Logout Successful");
catch (RestClientException e) {
System.out.println(e);
* @param args
public static void main(String[] args) {
System.out.println("inside main");
// TODO Auto-generated method stub
RestClient testATGRest = new RestClient();
try {
testATGRest.execute();
catch (Throwable t) {
System.out.println(t);
REST CLIENT ERROR SEEN:
=================
atg.rest.client.RestClientException: java.io.IOException: Not Found http://localhost:8080/rest/bean/atg/userprofiling/ProfileServices/loginUser
atg.rest.client.RestClientException: This session is not logged in and cannot be logged outI am trying to expose a method using REST Webservice and access the method using the browser.I have followed the steps specified in the thread:
http://ecomwriter.com/2012/03/19/building-restful-web-services-using-atg/ .Have added a component called ProfileRESTWebservice and have defined a method “getLoginInfo” in the class file. The following entry is placed in the restSecurityConfiguration.xml
<resource component="/atg/userprofiling/ProfileRESTWebservice" secure="true">
<method name="getLoginInfo" secure="false"></method>
</resource>
But, I am receiving the following exception when trying to access the method using http://localhost:8080/rest/bean/atg/userprofiling/ProfileRESTWebservice/getLoginInfo
10:07:33,147 ERROR [BeanServlet] Error code: 400
atg.beans.PropertyNotFoundException: Can't find property named: getLoginInfo in class: com.vs.commerce.profile.ProfileRESTWebservice
Can't find property named: getLoginInfo in class: com.vs.commerce.profile.ProfileRESTWebservice
atg.rest.RestException: atg.beans.PropertyNotFoundException: Can't find property named: getLoginInfo in class: com.vs.commerce.profile.ProfileRESTWebservice
at atg.rest.output.RestOutputCustomizerImpl.outputBeanProperty(RestOutputCustomizerImpl.java:616)
at atg.rest.processor.BeanProcessor.doRESTGet(BeanProcessor.java:157)
at atg.rest.servlet.RestPipelineServlet.serviceRESTRequest(RestPipelineServlet.java:394)
at atg.rest.servlet.RestPipelineServlet.service(RestPipelineServlet.java:237)
at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)
at atg.servlet.pipeline.PipelineableServletImpl.service(PipelineableServletImpl.java:298)
at atg.rest.servlet.RestPipelineServlet.service(RestPipelineServlet.java:241)
Can you pl help me out on this? -
ATG REST Webservices - XML response
Hi,
I need to build an ATG REST component which returns the response in XML format and it is done.
The question that I have here is that, in the XML response, the response XML that I exactly want is embedded inside <atgResponse>..</atgresponse> tag.
For ex:
The actual response that I need in the client side.
<address>
<address1>123 Main st</address1>
<address2>Apt 12</address2>
<city>Attleboro</city>
<state>MA</state>
<zip>02073</zip>
</address>
The response that I am getting back from my REST component:
<atgResponse>
<address>
<address1>123 Main st</address1>
<address2>Apt 12</address2>
<city>Attleboro</city>
<state>MA</state>
<zip>02073</zip>
</address>
</atgResponse>
Do I need to handle the logic of taking the xml that I needed from the XML response that is coming from my REST component, in the client side only?
The other concern that I have is, I do not want my client application to know that I am using ATG REST services.
Appreciate any help in this.
Thanks in advance,
Gopinath RamasamyI have not tried it but I would probably try to extend XMLOutputCustomizer and override sendToOutputStream(Object pDocument, DynamoHttpServletResponse pResponse) method as per the requirement. Here pDocument would actually be an instance of org.dom4j.Document so you can access and update its root element. You can also process other output elements as well by iterating through the elements and when done write the Document object through org.dom4j.Document to XMLWriter. Something like below:
Document doc = (Document)pDocument;
//process Document object
org.dom4j.io.XMLWriter writer = new org.dom4j.io.XMLWriter(pResponse.getWriter(), createDefaultOutputFormat());
writer.write(doc)Override the default /atg/rest/output/XMLOutputCustomizer configuration to refer your class and see if it serves your purpose.
API reference for XMLOutputCustomizer:
http://docs.oracle.com/cd/E24152_01/Platform.10-1/apidoc/atg/rest/output/XMLOutputCustomizer.html -
Access af:table values from JavaScript array (for google maps task)
Hi!
I have JSP page with af:table where latitude and longitude for google maps are stored. I am using these tutorial [https://blogs.oracle.com/middleware/entry/integrating_google_maps_with_adf] and I know how to access latitude and longitude from output text (for one point). Now i need to do something similar with loop for all table rows. How can I achieve this?
I have JavaScript code which uses Google Maps API and can display many points on one map. Also I have longitude and latitude data in af:table (bindings), each table row has one point. My task is to take data from af:table and pass it to JavaScript.
May be it is better to use managed bean as you said. Firstly I will access binding data from managed bean. Then I have to pass this data to JavaScript method? Can you suggest some example? I have "Using JavaScript in ADF Faces Rich Client Applications"My table is there :
<af:table value="#{bindings.LocView1.collectionModel}" var="row"
rows="#{bindings.LocView1.rangeSize}"
emptyText="#{bindings.LocView1.viewable ? 'No data to display.' : 'Access Denied.'}"
fetchSize="#{bindings.LocView1.rangeSize}" rowBandingInterval="0"
filterModel="#{bindings.LocView1Query.queryDescriptor}"
queryListener="#{bindings.LocView1Query.processQuery}" filterVisible="true" varStatus="vs"
selectedRowKeys="#{bindings.LocView1.collectionModel.selectedRow}"
selectionListener="#{bindings.LocView1.collectionModel.makeCurrent}" rowSelection="single"
id="t1">
<af:column sortProperty="#{bindings.LocView1.hints.SoffOffCode.name}" filterable="true"
sortable="true" headerText="#{bindings.LocView1.hints.SoffOffCode.label}" id="c1">
<af:outputText value="#{row.SoffOffCode}" clientComponent="true" id="ot1"/>
</af:column>
<af:column sortProperty="#{bindings.LocView1.hints.SoffCode.name}" filterable="true"
sortable="true" headerText="#{bindings.LocView1.hints.SoffCode.label}" id="c2">
<af:outputText value="#{row.SoffCode}" id="ot2"/>
</af:column>
<af:column sortProperty="#{bindings.LocView1.hints.SoffLat.name}" filterable="true"
sortable="true" headerText="#{bindings.LocView1.hints.SoffLat.label}" id="c3">
<af:outputText value="#{row.SoffLat}" clientComponent="true" id="ot3"/>
</af:column>
<af:column clientComponent="true" sortProperty="#{bindings.LocView1.hints.SoffLng.name}" filterable="true"
sortable="true" headerText="#{bindings.LocView1.hints.SoffLng.label}" id="c4">
<af:outputText value="#{row.SoffLng}" clientComponent="true" id="ot4"/>
</af:column>
<af:column sortProperty="#{bindings.LocView1.hints.SoffZoom.name}" filterable="true"
sortable="true" headerText="#{bindings.LocView1.hints.SoffZoom.label}" id="c5">
<af:outputText value="#{row.SoffZoom}" id="ot5"/>
</af:column>
</af:table>
Javascript code:
alert(document.getElementById("t1"));
Result:
[object HTMLDivElement];
And
alert(document.getElementById("t1").innerHTML);
Result:
<div id="t1::ch" style="overflow: hidden; position: relative; width: 366px;" _afrcolcount="5" class="xzg"><table class="xzi" summary="This table contains column headers corresponding to the data body table below" id="t1::ch::t" style="position:relative;table-layout:fixed;width:525px" cellspacing="0"><tbody><tr><th style="padding:0px;padding-left:5px;width:100px;"></th><th style="padding:0px;padding-left:5px;width:100px;"></th><th style="padding:0px;padding-left:5px;width:100px;"></th><th style="padding:0px;padding-left:5px;width:100px;"></th><th style="padding:0px;padding-left:5px;width:100px;"></th></tr><tr><th _d_index="0" _afrfiltercol="true" class="xzr" align="left" nowrap="nowrap"><span id="t1:_afrFltrc1" class="x1u"><input id="t1:_afrFltrc1::content" name="t1:_afrFltrc1" class="x25" type="text"></span></th><th _d_index="1" _afrfiltercol="true" class="xzr" align="left" nowrap="nowrap"><span id="t1:_afrFltrc2" class="x1u"><input id="t1:_afrFltrc2::content" name="t1:_afrFltrc2" class="x25" type="text"></span></th><th _d_index="2" _afrfiltercol="true" class="xzr" align="left" nowrap="nowrap"><span id="t1:_afrFltrc3" class="x1u"><input id="t1:_afrFltrc3::content" name="t1:_afrFltrc3" class="x25" type="text"></span></th><th _d_index="3" _afrfiltercol="true" class="xzr" align="left" nowrap="nowrap"><span id="t1:_afrFltrc4" class="x1u"><input id="t1:_afrFltrc4::content" name="t1:_afrFltrc4" class="x25" type="text"></span></th><th _d_index="4" _afrfiltercol="true" class="xzr" align="left" nowrap="nowrap"><span id="t1:_afrFltrc5" class="x1u"><input id="t1:_afrFltrc5::content" name="t1:_afrFltrc5" class="x25" type="text"></span></th></tr><tr><th id="t1:c1" _d_index="0" _afrleaf="true" _afrroot="true" class="xzj" align="left"><div style="position:relative; float:right"><table id="t1:c1::afrSI" _afrhoverable="true" style="display:none" class="x104" cellpadding="0" cellspacing="0"><tbody><tr><td _afrsortasc="1"><a tabindex="-1" class="xzm" title="Sort Ascending"></a></td><td _afrsortdesc="1"><a tabindex="-1" class="xzn" title="Sort Descending"></a></td></tr></tbody></table></div><div class="x19p">SoffOffCode</div></th><th id="t1:c2" _d_index="1" _afrleaf="true" _afrroot="true" class="xzj" align="left"><div style="position:relative; float:right"><table id="t1:c2::afrSI" _afrhoverable="true" style="display:none" class="x104" cellpadding="0" cellspacing="0"><tbody><tr><td _afrsortasc="1"><a tabindex="-1" class="xzm" title="Sort Ascending"></a></td><td _afrsortdesc="1"><a tabindex="-1" class="xzn" title="Sort Descending"></a></td></tr></tbody></table></div><div class="x19p">SoffCode</div></th><th id="t1:c3" _d_index="2" _afrleaf="true" _afrroot="true" class="xzj" align="left"><div style="position:relative; float:right"><table id="t1:c3::afrSI" _afrhoverable="true" style="display:none" class="x104" cellpadding="0" cellspacing="0"><tbody><tr><td _afrsortasc="1"><a tabindex="-1" class="xzm" title="Sort Ascending"></a></td><td _afrsortdesc="1"><a tabindex="-1" class="xzn" title="Sort Descending"></a></td></tr></tbody></table></div><div class="x19p">SoffLat</div></th><th id="t1:c4" _d_index="3" _afrleaf="true" _afrroot="true" class="xzj" align="left"><div style="position:relative; float:right"><table id="t1:c4::afrSI" _afrhoverable="true" style="display:none" class="x104" cellpadding="0" cellspacing="0"><tbody><tr><td _afrsortasc="1"><a tabindex="-1" class="xzm" title="Sort Ascending"></a></td><td _afrsortdesc="1"><a tabindex="-1" class="xzn" title="Sort Descending"></a></td></tr></tbody></table></div><div class="x19p">SoffLng</div></th><th id="t1:c5" _d_index="4" _afrleaf="true" _afrroot="true" class="xzj" align="left"><div style="position:relative; float:right"><table id="t1:c5::afrSI" _afrhoverable="true" style="display:none" class="x104" cellpadding="0" cellspacing="0"><tbody><tr><td _afrsortasc="1"><a tabindex="-1" class="xzm" title="Sort Ascending"></a></td><td _afrsortdesc="1"><a tabindex="-1" class="xzn" title="Sort Descending"></a></td></tr></tbody></table></div><div class="x19p">SoffZoom</div></th></tr></tbody></table></div><div id="t1::db" class="xz9" style="position: relative; width: 366px; overflow: hidden; height: 521px; z-index: 1;" _afrcolcount="5"><table class="xza x102" style="table-layout:fixed;position:relative;width:525px;" _totalwidth="525" _selstate="{'0':true}" _rowcount="179" _startrow="0" cellspacing="0"><tbody><tr _afrrk="0" class="xzy p_AFSelected"><td style="width:100px;" class="xzv" nowrap="nowrap"><span id="t1:0:ot1">26</span></td><td style="width:100px;" class="xzv" nowrap="nowrap">01</td><td style="width:100px;" class="xzv" nowrap="nowrap"><span id="t1:0:ot3">47.90782714384932</span></td><td style="width:100px;" class="xzv" nowrap="nowrap"><span id="t1:0:ot4">106.88643654861448</span></td><td style="width:100px;" class="xzv" nowrap="nowrap">15</td></tr><tr _afrrk="1" class="xzy"><td class="xzv" nowrap="nowrap"><span id="t1:1:ot1">26</span></td><td class="xzv" nowrap="nowrap">02</td><td class="xzv" nowrap="nowrap"><span id="t1:1:ot3">47.91542113773543</span></td><td class="xzv" nowrap="nowrap"><span id="t1:1:ot4">106.88540658035276</span></td><td class="xzv" nowrap="nowrap">15</td></tr><tr _afrrk="2" class="xzy"><td class="xzv" nowrap="nowrap"><span id="t1:2:ot1">26</span></td><td class="xzv" nowrap="nowrap">03</td><td class="xzv" nowrap="nowrap"><span id="t1:2:ot3">47.90768330745696</span></td><td class="xzv" nowrap="nowrap"><span id="t1:2:ot4">106.89544877090452</span></td><td class="xzv" nowrap="nowrap">15</td></tr><tr _afrrk="3" class="xzy"><td class="xzv" nowrap="nowrap"><span id="t1:3:ot1">26</span></td><td class="xzv" nowrap="nowrap">04</td><td class="xzv" nowrap="nowrap"><span id="t1:3:ot3">47.90716549312801</span></td><td class="xzv" nowrap="nowrap"><span id="t1:3:ot4">106.86879834213255</span></td><td class="xzv" nowrap="nowrap">14</td></tr><tr _afrrk="4" class="xzy"><td class="xzv" nowrap="nowrap"><span id="t1:4:ot1">26</span></td><td class="xzv" nowrap="nowrap">05</td><td class="xzv" nowrap="nowrap"><span id="t1:4:ot3">47.89841940184846</span></td><td class="xzv" nowrap="nowrap"><span id="t1:4:ot4">106.82674130477903</span></td><td class="xzv" nowrap="nowrap">13</td></tr><tr _afrrk="5" class="xzy"><td class="xzv" nowrap="nowrap"><span id="t1:5:ot1">26</span></td><td class="xzv" nowrap="nowrap">06</td><td class="xzv
.etc
Javascript: alert(document.getElementById("t1:121:ot3").innerHTML); this retrieve in value
But only 50 rows in this result. I have many rows. How I can get all??? -
Not able to print anything on ATG Rest webservices
Hi..I am new to ATG Rest.. Just for the heads up, i followed following steps :-
1 ) Added rest module to MANIFEST.MF
2) Created a custom class which looks like this -
package com.sgs.utils;
import atg.nucleus.GenericService;
public class SGSdummy extends GenericService {
public void dummy() throws Exception {
logDebug("sdbfhj");
3) Mapped it to the property file -
$class=com.sgs.utils.SGSdummy
$scope=global
loggingInfo=true
4) Configured the security for above component in restSecurityConfiguration.xml
<rest-security>
<resource component="/atg/commerce/order/dummy" secure="false">
<!-- <default-acl value="Profile$role$admin:read,write,execute"/> -->
<method name="dummy" secure="false"/>
</resource>
</rest-security>
I commented acl as i really didn't need it for a POC plus it was throwing 401 unauthorized.
5) Now I am calling it from chrome's Advanced Rest Client. However, status is 200 OK but I am not able to print a logDebug or sysout in my SGSdummy class.
When i check console, it says "Depth 0 is greater than maximum depth 0"
I tried to change maxDepthAllowed in configuration.properties but in vain..I need help to proceed.Now I am trying to create a REST request using custom client. I believe it should be a POST request as I am trying to call a method. My custom client looks like this :-
package atg.rest.client;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import atg.rest.client.RestClientException;
import atg.rest.client.RestComponentHelper;
import atg.rest.client.RestResult;
import atg.rest.client.RestSession;
public class RestDemoClient {
/** The m username. */
private String mUsername;
/** The m password. */
private String mPassword;
/** The m host. */
private String mHost;
/** The m port. */
private int mPort;
/** The m session. */
private RestSession mSession = null;
* Instantiates a new method call by rest.
public RestDemoClient() {
* Execute.
* @throws RestClientException the rest client exception
private void execute() {
mSession = RestSession
.createSession(mHost, mPort, mUsername, mPassword);
mSession.setUseHttpsForLogin(false);
Map<String,Object> params = new HashMap<String,Object>();
params.put("atg-rest-input", "json");
RestResult result = null;
try {
result = RestComponentHelper.executeMethod("/atg/rest/SGSdummy", "addOrder", new
Object[] {}, params, mSession);
} catch (RestClientException e1) {
System.out.println(e1);
try {
if (result != null && result.getResponseCode() == 200) {
System.out.println("Executed Successfully.");
} else {
System.out
.println("Error while execution : Error Code ["
+ result.getResponseCode()
+ "] and Message ["
+ result.getResponseMessage() + "]");
} catch (IOException e) {
System.out.println("Error while execution Successfully.");
* @param args
public static void main(String[] args) {
RestDemoClient stepUtils = new RestDemoClient();
stepUtils.mUsername = "admin";
stepUtils.mPassword = "admin";
stepUtils.mHost = "localhost";
stepUtils.mPort = 8080;
stepUtils.execute();
But everytime i execute this, I get following exception :-
atg.rest.client.RestClientException: java.io.IOException: Unauthorized Server returned HTTP response code: 401 for URL: http://localhost:8080/rest/bean/atg/rest/SGSdummy/addOrder
Exception in thread "main" java.lang.NullPointerException
at atg.rest.client.RestDemoClient.execute(RestDemoClient.java:64)
at atg.rest.client.RestDemoClient.main(RestDemoClient.java:82)
I tried different set of credentials but nothing seems to work out for me.
However it always works fine for GET requests. I am able to see status as 200 OK but it never hits my addOrder() method in SGSdummy class, hence I am not able to print sysout in that method. For status 200 OK GET requests, my logs say "[JSONOutputCustomizer] Depth 0 is greater than maximum depth 0. Outputting object of class java.lang.String as string rather than continuing to nest."
Can you give me some pointers how to run it without any errors plus it should print a random sysout in my custom class. Thanks -
Access netui pageflow data from javascript in a response.jsp
How do I access a pageflow variable from a javascript in a response.jsp page? I understand that the follow line can be used in a response.jsp:
<netui:label value="{pageFlow.m_applicant.createdDate}"/>, but it can not be used in a javascript of that rensponse.jsp.Jack,
You can't directly bind to a pageFlow variable but you can store the
variable in the page using the getData tag and access it via javascript as I
have done in this example.
<netui-data:getData resultId="myId" value="{pageFlow.theString}" />
<script language="javascript">
function showAlert()
var myJpfProperty = "<%=pageContext.getAttribute(
"myId" )%>";
alert( "Here is the Jpf property value: " + myJpfProperty );
</script>
Here is some related documentation, though it doesn't show a javascript
example
http://edocs.bea.com/workshop/docs81/doc/en/workshop/guide/netui/howdoi/howAccessDataBindingContextsScriptletJavaScript.html
- john
"jackz" <[email protected]> wrote in message
news:4074251a$[email protected]..
How do I access a pageflow variable from a javascript in a response.jsppage? I understand that the follow line can be used in a response.jsp:
<netui:label value="{pageFlow.m_applicant.createdDate}"/>, but it can notbe used in a javascript of that rensponse.jsp. -
Access report row data from javascript
-- I have a report. Something like this.
Select id, name, htmldb_item.checkbox(1, '#ROWNUM#')
from test;
-- I can get the rownum via javascript.
var ml = document.wwv_flow;
var i;
for(i = 0; i < ml.elements.length; i++){
alert("name = " + ml.elements.name);
alert("value = " + ml.elements[i].value);
-- I would like to access the other items I selected in the report from javascript. ie. id and name.
-- So knowing the rownum how do i get those values for a given row?
Thanks
Jonhi jfortney,
i have one problem in oa framework, ie i need to get the row number by javascript but could not do . my way is
document.getElementById('tableid').rows.length.. but there is no id for that table when i c the view source. so please suggest me some idea as to how to get the row number of a table in oa framework page.
thanks in advance...
prabhakaran.p -
Access PL/SQL Objects from JavaScript
I have following Problem:
I want to have access to a pl/sql object from javascript.
for example:
i have a procedure with a parameter called test from Type Test.
PROCEDURE toTest (
test Test)
IS
BEGIN
htp.script('here i want the value of test', 'javascript');
would be really great if somebody can help me fast.
thanks a lot
holgerI think it might have something to do with htmldb_Get
Hope that clue gets you somewhere. I would love to see a working example of this for 4.02 if anyone actually has one.
Regarding dynamic actions there's a severe limit on the number of them I believe.29? Which is one reason I avoid them and
just do things in javascript. Personally I think javascript is actually easier to understand because one does not have to
divide an actiivity up into several pieces. But that might just be specific to my brain, I don't know. -
How to access the controller method from javascript onclick event?
Hi All,
I am totally new to development. And I got struck in calling a controller method from javascript function.
I have no idea about ajax and all those things. Please can anyone help me to solve this issue!
Thanks in advance.Hi,
As I know, you can use jQuery to do this, here is an example.
Example of your Controller Method.
[HttpPost] // can be HttpGet
public ActionResult Test(string id)
bool isValid = yourcheckmethod(); //.. check
var obj = new {
valid = isValid
return Json(obj);
and this would be your javascript function.
function checkValidId(checkId)
$.ajax({
url: 'controllerName/Test',
type: 'POST',
contentType: 'application/json;',
data: JSON.stringify({ id: checkId }),
success: function (valid)
if(valid) { //show that id is valid }
else { //show that id is not valid }
If you have further issues, I would suggest you move to MVC forum, it is appropriate and more experts will assist you.
Best Regards,
Jambor
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Accessing an XI webservice from EP
Hi,
I am trying to access a webservice running on XI from EP6 SP9. It is giving the exception
com.sap.engine.services.webservice.jaxm.soap.accessor.NetstedSOAPException: Problem in server response: [Not found].. "
any help would be appreciated.hi,
see whether you are able to access the webservice
through a browser... before testing the same with
the ep.
Probably the web service is down or its returning an
malformed response..
HTH,
Anand -
Accessing a japplet method from javascript using plugin
Hi,
I am currently trying to invoke a public method coded in a swing applet from my javascript.
As per the documentation and discussion at this site,tried to workaround by using document.AppletName.MethodName.
I am using Javaplugin 1.2.2 and an Object tag (not an applet tag)
I am getting "object not found' error on running it.
Any possible suggestions as to why its happening?part of my javascript code is pasted below.
I tried using applet tag instaed just in case but keep gettin the same message.'Not an object"
</HEAD>
<BODY onload ="setUserName()">
<SCRIPT LANGUAGE="javascript">
function setUserName(){
var str = document.location.search;
document.write(str)
var query = str.charAt(0) == '?' ? str.substring(1) : str;
document.write(query)
-----> document.BApplet.setUser(query);
</script>
BApplet will appear below in a Java enabled browser.<BR>
<OBJECT id="BApplet" classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
WIDTH = 100
HEIGHT = 100
ALIGN = middle
VSPACE = 0
HSPACE = 0
codebase="http://java.sun.com/products/plugin/1.2.2/jinstall-1_2_2-win.cab#Version=1,2,2,0">
<PARAM NAME = CODE VALUE = "com.common.BApplet.class" >
<PARAM NAME = CODEBASE VALUE = "./lib" >
<comment>
<embed>
</embed>
</comment>
</object>
</body>
</html> -
Accessing public JApplet method from javascript
Hi,
I am currently trying to invoke a public method coded in a swing applet from my javascript.
As per the documentation and discussion at this site,tried to workaround by using document.AppletName.MethodName.
I am using Javaplugin 1.2.2 and an Object tag (not an applet tag)
I am getting "object not found' error on running it.
Any possible suggestions as to why its happening?Hi,
You have to set the scriptable property to true in the object tag. I have included a sample object tag here below. Just change the applet name and applet class name. It has surely worked for me.For more details mail me : [email protected]
<OBJECT classid="clsid:E19F9330-3110-11d4-991C-005004D3B3DB" name="AppletName");
WIDTH ="200" HEIGHT ="250" codebase="http://java.sun.com/products/plugin/1.3.0_01/jinstall-130_01-win32.cab#Version=1,3,0,1"
<PARAM NAME = CODE VALUE = AppletName.class ><PARAM NAME="type" VALUE="application/x-java-applet;jpi-version=1.3.0_01">
<PARAM NAME="scriptable" VALUE="true">
<EMBED type="application/x-java-applet;jpi-version=1.3.0_01" name="AppletName" CODE = AppletName.class WIDTH ="200" HEIGHT ="250" scriptable=true pluginspage="http://java.sun.com/products/plugin/1.3.0_01/plugin-install.html">
<NOEMBED></EMBED></OBJECT> -
Calling REStful webservices from Designer
Hello,
I know we can connect to a webservice via wsdl type data connection, but has anyone tried calling Restful web service by any chance?
If so please let me know how can we do that.
Thanks
ManojHi Paul,
Are RESTful services supported in the newest version of LiveCycle? If so can you provide a short example? Thank you,
james -
Accessing a public method from javascript in an applet!!!
Hi!!
I'm have an applet (named say applet.class) in an html page that has a public method like this....
public void doShowFrame()
Frame frame = new frame();
frame.setVisible (true);
What I want to do is to call that method with javascript, I've tried to do it like this...
function show(){
applet.doShowFrame();
But when i press the button that launch the java scipt the browser says
'applet' is unidentified...
What's wrong, what can I do??http://www.google.com/search?q=applet+javascript+communication&sourceid=opera&num=0&ie=utf-8&oe=utf-8
how hard was that? seriously.
Maybe you are looking for
-
Upload of BW Roles from BW (2004s)
Hi I am in the process of uploading my roles from BW into the portal. I was wondering if we can pre configure the properties that the reports (iviews) inherit as part of the upload. For example after the role has been uploaded the property "Launch in
-
Null pointer exception in DCIteratorBinding
When i am running me project the following error is shown in the log file: Caused by: java.lang.NullPointerException at oracle.adf.model.binding.DCIteratorBinding.executeQueryIfNeeded(DCIteratorBinding.java:2160) at oracle.adf.model.binding
-
Spool files and Adobe Files in SAP
Hi, Is there away to be able to see spool files and adobe pdf files , using the same screen, Ie go through and view some normal sap spools and then view adobe files from a url? Many thanks
-
On a mac with snow leopard, how do you paste a clickable url?
When I cut and paste a url, it is not clickable. I have been unable to figure out how to make it clickable, which I believe is called a hyperlink. Thank you for any info.
-
Hey, wondering if there is a solution to this, or if its just how it is... See this pic: http://www.expansiondesign.com/Picture%203.png The left half is how the jpeg looks on the stage, the right is how it looks when I "test movie" (The "test movie"