xmlrpc help in java to implement for reverse proxy server

301 views Asked by At

I have the following code for calling xmlrpc from java code:

        public static String Create(String APIKey, String username,
        String Password, String Url, String Email, String Enablestatus,
        String login, String Name, String FirstName, String language,
        String managerGuid, String[] orgunit, String[] ExternalorgunitID,
        String[] Competency, String[] Positionexemple,
        String[] ExternaluserID, String[] Costcenter) {
    try {
        XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
        config.setServerURL(new URL(Url));
        XmlRpcClient client = new XmlRpcClient();
        config.setBasicUserName(username);
        config.setBasicPassword(Password);

        client.setConfig(config);

        client.setTransportFactory(new XmlRpcCommonsTransportFactory(client));
        Map namevalue = new HashMap();

        namevalue.put("email", Email);
        namevalue.put("enableStatus", Enablestatus);

        namevalue.put("login", login);

        namevalue.put("name", Name);
        namevalue.put("firstName", FirstName);

        namevalue.put("languages", language);
        namevalue.put("managerGUID", managerGuid);

        Map custvalue = new HashMap();
        custvalue.put(orgunit[0], orgunit[1]); // Org unit
        custvalue.put(Competency[0], Competency[1]);
        custvalue.put(Positionexemple[0], Positionexemple[1]);
        custvalue.put(ExternalorgunitID[0], ExternalorgunitID[1]);
        custvalue.put(ExternaluserID[0], ExternaluserID[1]);
        custvalue.put(Costcenter[0], Costcenter[1]);
        namevalue.put("customFields", custvalue);

        namevalue.put("onDuplicateLogin", "Update");

        Object[] params = new Object[] { APIKey, "", namevalue };
        return client.execute("Create.User", params).toString();

    } catch (Exception e) {
        return "Error: " + e.toString();
    }

}

It is working fine on local machine when I directly hitting the server URL. But when I place behind reverse proxy server (i.e This code will call to reverse proxy and reverse proxy will call to the target server URL.) then the target server doesn't accept my request. Reason: the header value is not matched to the target url i.e the header contain the reverse proxy server url not the target url.

Now up to my Understanding, i have to change the hostname in header to the original target url. But I have searched alot on internet but failed.

I think my question is pretty clear :)

0

There are 0 answers