cancel
Showing results for 
Search instead for 
Did you mean: 

Can't connect to SAP Document Service

0 Kudos
613

Hello colleagues.

I'm having trouble with creating and using a Proxy Bridge .

I use this instruction: https://help.sap.com/viewer/b0cc1109d03c4dc299c215871eed8c42/Cloud/en-US/ed1c6732d4214c68846ab9813b9...

After deploying app in SCP I try open this link, but have error.

What could be the problem and what I am doing wrong?

Thanks in advance for the answers)

Project tree:

Servlet code:

package proxy;
import com.sap.ecm.api.AbstractCmisProxyServlet;
public class CMISProxyServlet extends AbstractCmisProxyServlet {
	private static final long serialVersionUID = 1L;

	@Override
	protected boolean supportAtomPubBinding() {
		return false;
	}

	@Override
	protected boolean supportBrowserBinding() {
		return true;
	}

    public CMISProxyServlet() {
        super();
    }

    @Override
    protected String getRepositoryUniqueName() {
        return "DocRep";
    }

    @Override
    // For applications in production, use a secure location to store the secret key.
    protected String getRepositoryKey() {
        return "1234567890abc";
    }


}

web.xml code:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"; id="WebApp_ID" version="3.0">
  <display-name>cmisproxy</display-name>

<servlet>
  <servlet-name>cmisproxy</servlet-name>
  <servlet-class>proxy.CMISProxyServlet</servlet-class> 
</servlet> 

<servlet-mapping>
  <servlet-name>cmisproxy</servlet-name>
  <url-pattern>/cmis/*</url-pattern> 
</servlet-mapping>

<security-constraint>
  <web-resource-collection>
    <web-resource-name>Proxy</web-resource-name>
    <url-pattern>/cmis/*</url-pattern>
  </web-resource-collection>
  <auth-constraint>
    <role-name>EcmDeveloper</role-name>
  </auth-constraint>

</security-constraint>

</web-app>

Accepted Solutions (1)

Accepted Solutions (1)

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Kirill,

Did you add the role EcmDeveloper to your user?

Best regards,

Ivan

Answers (2)

Answers (2)

0 Kudos

Hi Ivan,

Currently, i have created the Proxy Bridge. But now facing error 400-

https://cmisproxy(subaccount).us3.hana.ondemand.com/cmisproxy/cmis/json

Error Message: {"exception":"permissionDenied","message":"Config entry with unique name XXXXXXXX(Document RepositoryName) is not allowed to be accessed"}

Can you please guide us on the same.

Thanks,

Chakravarti.

0 Kudos

Hi ivan.mirisola , thanks for the answer. Added a role, now everything works.

But now I have another problem. I want use my ProxyBridge in XSJS app. I create .xshttpdest, but when I make a request, I have this problem, what could be wrong?

My .xshttpdest:

description = "Connection to Proxy Bridge App";
host = "https://cmisproxy******.hana.ondemand.com";
port = 443;
pathPrefix = "/cmisproxy/cmis/json";
proxyType = http;
proxyHost = "proxy";
proxyPort = 8080;
authType = basic;
useSSL = true;
timeout = 0;
sslAuth = anonymous;  

My xsjs code:

function getData() 
{
    try
    {
        var Dest = $.net.http.readDestination('********.******.xsjs.v01', 'documentservice');
        var Request = new $.web.WebRequest($.net.http.GET, '/cmisproxy/cmis/json');
        Request.headers.set("Authorization",'Basic ****************');
        var client = new $.net.http.Client();
    	client.request(Request, Dest); 
    	var response = client.getResponse();
    	var data = response.body.asString();
    	var parse_data = JSON.parse(data);
        return parse_data;
    }
    catch (e)
    {
        return e;
    }
}
getData();
Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert

Hi Kirill,

Perhaps you should thing of posting this doubt on a new question as it is a different issue now.

Regardless, I see here the error 400 - which could be something related to SSL handshake (missing certificate in the HANA trust store) or even that you have pathPrefix in both your destination and the request object itself.

Best regards,
Ivan