如何使用websphere商业库存外观客户端进行编码

时间:2014-02-17 03:05:16

标签: websphere-commerce

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

这很令人困惑,我想调用ChangeInventory但无法编写请求,并开始关闭SyncProductAvailability但是再次无法撰写请求。

下面的问题是ProductIdentifierType为null,并且Factory上没有相应的“createProductIdentifierType”....我不确定我在这里缺少什么,工厂似乎已经半生了... < / p>

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

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();

1 个答案:

答案 0 :(得分:0)

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

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

fd2.createProductIdentifierType