1

我已经在 Web 服务器上安装了 OpenX-2.8.10。

我正在使用其中的示例连接到 OpenX Server。我想从服务器获取 Advertiser,但我遇到了问题。我正在尝试使用 AdvertiserService,但没有成功。

代码在这里:

public class Prototype {
    private final static String serverURL = "http://demo.pwi.ru";
    private final static String openadsDir = "/openx";
    private final static String logonService = "/www/api/v1/xmlrpc/LogonXmlRpcService.php";
    private final static String agencyService = "/www/api/v1/xmlrpc/AgencyXmlRpcService.php";
    private final static String username = "admin";
    private final static String password = "875698";
    private static Integer id = 1;

    public static void main(String[] args) {
        final XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();

        try {
            config.setServerURL(new URL(serverURL + openadsDir + logonService)); 
            XmlRpcClient client = new XmlRpcClient();
            client.setConfig(config);

            String sessionId = (String) client.execute("logon", new Object[]{username, password});
            System.out.println("User logged on with session Id: " + sessionId);

            AdvertiserService service = new AdvertiserService(client, sessionId);
            service.setSessionId(sessionId);

            System.out.println("AdvertiserService: " + service.getAdvertiser(id ));
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (XmlRpcException e) {
            e.printStackTrace();
        }
    }
}

控制台说:

用户使用会话 ID 登录:phpads50addd559301e5.24695272 org.apache.xmlrpc.XmlRpcException:无法创建输入流:demo.pwi.ru//ppads50addd559301e5.24695272//AdvertiserXmlRpcService.php at org.apache.xmlrpc.client.XmlRpcSunHttpTransport。 getInputStream(XmlRpcSunHttpTransport.java:65) at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:141) at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:94) at org.apache .xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:44) 在 org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:53) 在 org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java :166) 在 org.apache.xmlrpc 的 org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:136)。client.XmlRpcClient.execute(XmlRpcClient.java:125) 在 org.openads.proxy.AbstractService.execute(AbstractService.java:111) 在 org.openads.proxy.AdvertiserService.execute(AdvertiserService.java:1) 在 org.openads org.openads.proxy.prototype.Prototype.main(Prototype.java:36) 处的 .proxy.AdvertiserService.getAdvertiser(AdvertiserService.java:118) 原因:java.io.FileNotFoundException: demo.pwi.ru//ppads50addd559301e5。 24695272//AdvertiserXmlRpcService.php at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.getInputStream(XmlRpcSunHttpTransport.java:63) ... 11 更多:java.io.FileNotFoundException:demo.pwi.ru//phpads50addd559301e5.24695272//Sun.net.www.protocol.http.HttpURLConnection 上的 AdvertiserXmlRpcService.php。在 org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:141) 在 org.apache.xmlrpc 的 org.apache.xmlrpc.client.XmlRpcSunHttpTransport.getInputStream(XmlRpcSunHttpTransport.java:63) 的 getInputStream(Unknown Source)。 client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:94) at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:44) at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:53)在 org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:166) 在 org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:136) 在 org.apache.xmlrpc.client.XmlRpcClient.execute (XmlRpcClient.java:125) 在 org.openads.proxy.AbstractService.execute(AbstractService.java:111) 在 org.openads.proxy.AdvertiserService。在 org.openads.proxy.AdvertiserService.getAdvertiser(AdvertiserService.java:118) 处执行(AdvertiserService.java:1) 在 org.openads.proxy.prototype.Prototype.main(Prototype.java:36)

4

0 回答 0