Archived

This forum has been archived. Please start a new discussion on GitHub.

IcePHP & IceStorm

Could I write a IceStorm Publisher with IcePHP?

Comments

  • marc
    marc Florida
    Can you please add your signature as described in this post?
  • OK, Thanks!
  • marc
    marc Florida
    The simple answer to your question is "yes". You write the client just as you would do for any other language mapping. If you have any specific questions, please let us know.

    Also, can you please update your signature with the project your are working on?
  • I want to write a forum post informer, when the forum receive a new post, I'll get the information by a desktop application. So I want to write a php publisher to the IceStormService.

    here is part of the php code:
    	$p = $ICE->stringToProxy("DemoIceStorm/TopicManager:default -p 10000");
    
    	$manager = $p->ice_checkedCast("::IceStorm::TopicManager");
    	$topic = $manager->retrieve("newpost");
    	$newpost = ice_uncheckedCast($topic->getPublisher());
    
    

    when I run the php code, I get an error:

    Fatal error: Ice_ObjectPrx::ice_checkedCast() [<a href='function.ice-checkedCast'>function.ice-checkedCast</a>]: no Slice definition found for type ::IceStorm::TopicManager in D:\mywork\test\web\publisher.php on line 35
  • Then I try to write these code into the slice file to tell php the Slice defination:
    module IceStorm {
    	struct LinkInfo {
    
    	interface Topic {
    		nonmutating string getName();
    		nonmutating Object* getPublisher();
    		void subscribe(QoS theQoS, Object* subscriber);
    		idempotent void unsubscribe(Object* subscriber);
    		idempotent void link(Topic* linkTo, int cost)
    			throws LinkExists;
    		idempotent void unlink(Topic* linkTo) throws NoSuchLink;
    		nonmutating LinkInfoSeq getLinkInfoSeq();
    		void destroy();
    	};
    
    	Topic* theTopic;
    	string name;
    	int cost;
    	};
    	sequence<LinkInfo> LinkInfoSeq;
    	dictionary<string, string> QoS;
    	exception LinkExists {
    		string name;
    	};
    	exception NoSuchLink {
    		string name;
    	};
    };
    
    module IceStorm {
    	dictionary<string, Topic*> TopicDict;
    	exception TopicExists {
    		string name;
    		IceStorm
    	};
    	exception NoSuchTopic {
    		string name;
    	};
    	interface TopicManager {
    		Topic* create(string name) throws TopicExists;
    		nonmutating Topic* retrieve(string name) throws NoSuchTopic;
    		nonmutating TopicDict retrieveAll();
    	};
    };
    
    

    After doing that, I could not start the apache again:(
    I think maybe the Ice prefix is reserved, so the namespace name IceStorm is conflict with the ICE run time.
  • matthew
    matthew NL, Canada
    You need to load the IceStorm slice definitions in the ice.slice directive in the PHP configuration.

    ice.slice=/path/to/IceStorm.ice
  • I get an error when set the ice.slice to ice.slice=D:\Ice-3.1.0\slice\IceStorm\IceStorm.ice:

    D:\Ice-3.1.0\slice\IceStorm\IceStorm.ice:13: No include path in which to find Ice/SliceChecksumDict.ice
    13  #include <Ice/SliceChecksumDict.ice>
    
    
  • Oh, get it
    ice.slice=-ID:\Ice-3.1.0\slice D:\Ice-3.1.0\slice\IceStorm\IceStorm.ice
    


    thanks again