0

我发现这非常令人沮丧。我正在尝试使用 InventoryFacadeClient 调用 Change 或 Sync Web 服务来更新产品可用性。我面临的问题是我似乎无法实例化所有必需的 DataTypes 来填充请求。

这很令人困惑,我想调用 ChangeInventory 但无法编写请求,并启动了 SyncProductAvailability 但再次无法编写请求。

下面的问题是ProductIdentifierType为null,并且工厂上没有对应的“createProductIdentifierType”....我不确定我在这里缺少什么,工厂似乎是半生不熟...

如果有人可以帮助我完成此代码,那会很棒吗?

public void setUp() throws Exception {
        String METHOD_NAME = "setUp";
        logger.info("{} entering", METHOD_NAME);
        super.setUp();

        InventoryFacadeClient iClient = super.initializeInventoryClient(false);

        InventoryFactory f = com.ibm.commerce.inventory.datatypes.InventoryFactory.eINSTANCE;
        com.ibm.commerce.inventory.facade.datatypes.InventoryFactory cf = iClient.getInventoryFactory();
        CommerceFoundationFactory fd = iClient.getCommerceFoundationFactory();



        // we must have customised the SyncProductAvailability web service to 
        // handle ATP inventory model.

        SyncProductAvailabilityDataAreaType dataArea = f.createSyncProductAvailabilityDataAreaType();
        SyncProductAvailabilityType sat = f.createSyncProductAvailabilityType();
        sat.setDataArea(dataArea);
        DocumentRoot root = cf.createDocumentRoot();
        sat.setVersionID(root.getInventoryAvailabilityBODVersion());

        ProductAvailabilityType pat = f.createProductAvailabilityType();
        ProductIdentifierType pid = pat.getProductIdentifier();
4

1 回答 1

0

我在另一个论坛上找到了这个问题的答案。我错过了正确的 CommerceFoundationFactory - ProductIdentifierType 创建的类是:

com.ibm.commerce.foundation.datatypes.CommerceFoundationFactory fd2 = com.ibm.commerce.foundation.datatypes.CommerceFoundationFactory.eINSTANCE;

fd2.createProductIdentifierType

于 2014-02-17T22:54:53.143 回答