Topic
3 replies Latest Post - ‏2013-01-30T17:55:55Z by Keshav1980
Keshav1980
Keshav1980
116 Posts
ACCEPTED ANSWER

Pinned topic SendMsgCmd - sendReceiveImmediate - XML message mapper

‏2013-01-29T22:07:19Z |
Hi,

I want to convert a sync response XML that I get in MQ queue after executing sendReceiveImmediate on SendMsgCmd.
Flow is jsp - controller command. command uses SendMsgCmd-sendReceiveImmediate to send XML to MQ and a sync response message is obtained in response MQ.
As of now, sendMsgCmd.getResult() gives byte[]. I want to use message mapper to convert XML into TypedProperty to be accessed in my command. Please provide pointers/inputs if you have done it.

Thanks.
Updated on 2013-01-30T17:55:55Z at 2013-01-30T17:55:55Z by Keshav1980
  • Keshav1980
    Keshav1980
    116 Posts
    ACCEPTED ANSWER

    Re: SendMsgCmd - sendReceiveImmediate - XML message mapper

    ‏2013-01-30T00:18:49Z  in response to Keshav1980
    I followed this link: https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14164179&#14164179 and I also have the below code
    byte[] SAPResponseData = sendMsgCmd.getResult();
    String xmlResponse = new String(SAPResponseData);
    CommandProperty cmdProperty = MessageMapperGroup.getObjectForMessage(xmlResponse,"WCS.INTEGRATION");
    I am getting xmlResponse string but cmdProperty object is coming as null.
    I have the dtd and user_template.xml in C:\IBM\WCDE_ENT70\workspace\WC\xml\messaging folder. wc-server.xml has the dtd created and also WCS.INTEGRATION enabled.
    But I am getting cmdProperty as null.
    Any inputs on this will be really helpful. Thanks a lot.
    • subK
      subK
      13 Posts
      ACCEPTED ANSWER

      Re: SendMsgCmd - sendReceiveImmediate - XML message mapper

      ‏2013-01-30T05:55:56Z  in response to Keshav1980
      Hi Keshav,

      The below link can help you to set up the request properties, which you are expecting
      "http://pic.dhe.ibm.com/infocenter/wchelp/v7r0m0/topic/com.ibm.commerce.integration.doc/refs/rcvomin6.htm"
      Here it says....
      "... byte[] result = sendMsgCmd.getResult(); String xmlResponse = new
      String(result); CommandProperty cmd =
      MessageMapperGroup.getObjectForMessage(xmlResponse,"WCS.INTEGRATION");

      where WCS.INTEGRATION is the name of the message mapper.

      To_ do the preceding step requires defining the message content in the user_template.xml file and the corresponding DTD, just like adding a new inbound XML message to the Messaging system. The command name can be a dummy command name.

      if (cmd != null) { TypedProperty tp = cmd.getRequestProperties();
      where tp contains all the mapped parameters "

      ,So concluding these, we should have proper DTD(with DataArea) and user_template.xml(corresponding DataArea match) entry, Then we can get the cmd as well as the request prperties.

      To configure inbound xml message mapper, you can check this as well
      "http://pic.dhe.ibm.com/infocenter/wchelp/v7r0m0/topic/com.ibm.commerce.integration.doc/tasks/tcvadxml.htm"
      • Keshav1980
        Keshav1980
        116 Posts
        ACCEPTED ANSWER

        Re: SendMsgCmd - sendReceiveImmediate - XML message mapper

        ‏2013-01-30T17:55:55Z  in response to subK
        Thanks for the reply.
        I have completed all the steps required. I am also pasting the XML that gets into the queue, dtd created, user_template.xml.
        Controller command is getting the response XML which I can see in debug mode. Only CommandProperty is null.
        Please check whether any issues could be found in dtd or user_template.xml.
        I have only mapped one repetition of <SapStatusinfo> from response to typedproperties. I beleive that should be fine. And the command name given is the actual command URL for the controller command.
        **************************
        XML response to queue:
        *************************
        <NS1:SapBapiSalesorderGetstatus xmlns:NS1="http://www.ibm.com/xmlns/prod/websphere/j2ca/sap/sapbapisalesordergetstatus">
        <SapReturn>
        <ApplicationLogInternalMessageSerialNumber>000000</ApplicationLogInternalMessageSerialNumber>
        </SapReturn>
        <SapStatusinfo>
        <SalesDocument>0000000766</SalesDocument>
        <DocumentDateDateReceivedSent>2012-10-04</DocumentDateDateReceivedSent>
        <CustomerPurchaseOrderNumber>test</CustomerPurchaseOrderNumber>
        <OverallProcessingStatusOfDocument>A</OverallProcessingStatusOfDocument>
        <OverallDeliveryStatusForAllItems>A</OverallDeliveryStatusForAllItems>
        <RequestedDeliveryDate>2012-10-04</RequestedDeliveryDate>
        <SalesDocumentItem>000010</SalesDocumentItem>
        <MaterialNumber>000000000000001971</MaterialNumber>
        <ShortTextForSalesOrderItem>AAA</ShortTextForSalesOrderItem>
        <ScheduleLineDate>2012-10-04</ScheduleLineDate>
        <CumulativeOrderQuantityInSalesUnits>10.000</CumulativeOrderQuantityInSalesUnits>
        <CumulativeConfirmedQuantityInSalesUnit>10.000</CumulativeConfirmedQuantityInSalesUnit>
        <SalesUnit>LB</SalesUnit>
        <NetValueOfTheOrderItemInDocumentCurrency>10.00</NetValueOfTheOrderItemInDocumentCurrency>
        <SdDocumentCurrency>USD</SdDocumentCurrency>
        <NetPrice>50.00</NetPrice>
        <ConditionPricingUnit>1</ConditionPricingUnit>
        <ConditionUnit>AAA</ConditionUnit>
        <OverallDeliveryStatusOfTheItem>A</OverallDeliveryStatusOfTheItem>
        <DeliveryItem>000000</DeliveryItem>
        <ActualQuantityDeliveredInSalesUnits>0.000</ActualQuantityDeliveredInSalesUnits>
        <ReferencedQuantityInBaseUnitOfMeasure>0.000</ReferencedQuantityInBaseUnitOfMeasure>
        <SalesUnitInIsoCode>AAA</SalesUnitInIsoCode>
        <ConditionUnitOfMeasureInUom>AA</ConditionUnitOfMeasureInUom>
        <IsoCodeCurrency>USD</IsoCodeCurrency>
        <EntryTime>00:00:00</EntryTime>
        <CustomerPurchaseOrderNumber810181970>test</CustomerPurchaseOrderNumber810181970>
        </SapStatusinfo>
        <SapStatusinfo>
        <SalesDocument>0000000766</SalesDocument>
        <DocumentDateDateReceivedSent>2012-10-04</DocumentDateDateReceivedSent>
        <CustomerPurchaseOrderNumber>test</CustomerPurchaseOrderNumber>
        <OverallProcessingStatusOfDocument>A</OverallProcessingStatusOfDocument>
        <OverallDeliveryStatusForAllItems>A</OverallDeliveryStatusForAllItems>
        <RequestedDeliveryDate>2012-10-04</RequestedDeliveryDate>
        <SalesDocumentItem>000020</SalesDocumentItem>
        <MaterialNumber>000000000000001885</MaterialNumber>
        <ShortTextForSalesOrderItem>AAA</ShortTextForSalesOrderItem>
        <ScheduleLineDate>2012-10-05</ScheduleLineDate>
        <CumulativeOrderQuantityInSalesUnits>1.000</CumulativeOrderQuantityInSalesUnits>
        <CumulativeConfirmedQuantityInSalesUnit>1.000</CumulativeConfirmedQuantityInSalesUnit>
        <SalesUnit>AA</SalesUnit>
        <NetValueOfTheOrderItemInDocumentCurrency>10.00</NetValueOfTheOrderItemInDocumentCurrency>
        <SdDocumentCurrency>USD</SdDocumentCurrency>
        <NetPrice>10.00</NetPrice>
        <ConditionPricingUnit>1</ConditionPricingUnit>
        <ConditionUnit>AA</ConditionUnit>
        <OverallDeliveryStatusOfTheItem>A</OverallDeliveryStatusOfTheItem>
        <DeliveryItem>000000</DeliveryItem>
        <ActualQuantityDeliveredInSalesUnits>0.000</ActualQuantityDeliveredInSalesUnits>
        <ReferencedQuantityInBaseUnitOfMeasure>0.000</ReferencedQuantityInBaseUnitOfMeasure>
        <SalesUnitInIsoCode>EA</SalesUnitInIsoCode>
        <ConditionUnitOfMeasureInUom>EA</ConditionUnitOfMeasureInUom>
        <IsoCodeCurrency>USD</IsoCodeCurrency>
        <EntryTime>00:00:00</EntryTime>
        <CustomerPurchaseOrderNumber810181970>test</CustomerPurchaseOrderNumber810181970>
        </SapStatusinfo>
        </NS1:SapBapiSalesorderGetstatus>
        *******************************
        dtd created and placed in C:\IBM\WCDE_ENT70\workspace\WC\xml\messaging
        dtd has been added to wc-server.xml
        *******************************
        <!ELEMENT NS1:SapBapiSalesorderGetstatus ((SapReturn, SapStatusinfo+))>
        <!ATTLIST NS1:SapBapiSalesorderGetstatus
        xmlns:NS1 CDATA #FIXED "http://www.ibm.com/xmlns/prod/websphere/j2ca/sap/sapbapisalesordergetstatus"
        >
        <!ELEMENT SapStatusinfo ((SalesDocument, DocumentDateDateReceivedSent, CustomerPurchaseOrderNumber, OverallProcessingStatusOfDocument, OverallDeliveryStatusForAllItems, RequestedDeliveryDate, SalesDocumentItem, MaterialNumber, ShortTextForSalesOrderItem, ScheduleLineDate, CumulativeOrderQuantityInSalesUnits, CumulativeConfirmedQuantityInSalesUnit, SalesUnit, NetValueOfTheOrderItemInDocumentCurrency, SdDocumentCurrency, NetPrice, ConditionPricingUnit, ConditionUnit, OverallDeliveryStatusOfTheItem, DeliveryItem, ActualQuantityDeliveredInSalesUnits, ReferencedQuantityInBaseUnitOfMeasure, SalesUnitInIsoCode, ConditionUnitOfMeasureInUom, IsoCodeCurrency, EntryTime, CustomerPurchaseOrderNumber810181970))>
        <!ELEMENT SapReturn ((ApplicationLogInternalMessageSerialNumber))>
        <!ELEMENT ShortTextForSalesOrderItem (#PCDATA)>
        <!ELEMENT SdDocumentCurrency (#PCDATA)>
        <!ELEMENT ScheduleLineDate (#PCDATA)>
        <!ELEMENT SalesUnitInIsoCode (#PCDATA)>
        <!ELEMENT SalesUnit (#PCDATA)>
        <!ELEMENT SalesDocumentItem (#PCDATA)>
        <!ELEMENT SalesDocument (#PCDATA)>
        <!ELEMENT RequestedDeliveryDate (#PCDATA)>
        <!ELEMENT ReferencedQuantityInBaseUnitOfMeasure (#PCDATA)>
        <!ELEMENT OverallProcessingStatusOfDocument (#PCDATA)>
        <!ELEMENT OverallDeliveryStatusOfTheItem (#PCDATA)>
        <!ELEMENT OverallDeliveryStatusForAllItems (#PCDATA)>
        <!ELEMENT NetValueOfTheOrderItemInDocumentCurrency (#PCDATA)>
        <!ELEMENT NetPrice (#PCDATA)>
        <!ELEMENT MaterialNumber (#PCDATA)>
        <!ELEMENT IsoCodeCurrency (#PCDATA)>
        <!ELEMENT EntryTime (#PCDATA)>
        <!ELEMENT DocumentDateDateReceivedSent (#PCDATA)>
        <!ELEMENT DeliveryItem (#PCDATA)>
        <!ELEMENT CustomerPurchaseOrderNumber810181970 (#PCDATA)>
        <!ELEMENT CustomerPurchaseOrderNumber (#PCDATA)>
        <!ELEMENT CumulativeOrderQuantityInSalesUnits (#PCDATA)>
        <!ELEMENT CumulativeConfirmedQuantityInSalesUnit (#PCDATA)>
        <!ELEMENT ConditionUnitOfMeasureInUom (#PCDATA)>
        <!ELEMENT ConditionUnit (#PCDATA)>
        <!ELEMENT ConditionPricingUnit (#PCDATA)>
        <!ELEMENT ApplicationLogInternalMessageSerialNumber (#PCDATA)>
        <!ELEMENT ActualQuantityDeliveredInSalesUnits (#PCDATA)>
        ***********************************
        user_template.xml in C:\IBM\WCDE_ENT70\workspace\WC\xml\messaging
        ***********************************
        <?xml version='1.0' encoding='UTF-8'?>
        <!DOCTYPE ECTemplate SYSTEM 'ec_template.dtd' >
        <ECTemplate>
        <TemplateDocument>
        <DocumentType version='1.0'>NS1:SapBapiSalesorderGetstatus</DocumentType>
        <StartElement>NS1:SapBapiSalesorderGetstatus</StartElement>
        <TemplateTagName>SAPSyncOrderStatusMap</TemplateTagName>
        <CommandMapping>
        <Command CommandName='UVRSAPIntegrationCmd' />
        </CommandMapping>
        </TemplateDocument>
        <TemplateTag name='SAPSyncOrderStatusMap'>
        <!-- Command Parameters -->
        <Tag XPath='SapReturn/ApplicationLogInternalMessageSerialNumber' Field='ApplicationLogInternalMessageSerialNumber' />
        <Tag XPath='SapStatusinfo[1]/CustomerPurchaseOrderNumber' Field='CustomerPurchaseOrderNumber2' />
        <Tag XPath='SapStatusinfo[1]/SalesDocument' Field='SalesDocument2' />
        <Tag XPath='SapStatusinfo[1]/DocumentDateDateReceivedSent' Field='DocumentDateDateReceivedSent2' />
        <Tag XPath='SapStatusinfo[1]/OverallProcessingStatusOfDocument' Field='OverallProcessingStatusOfDocument2' />
        <Tag XPath='SapStatusinfo[1]/OverallDeliveryStatusForAllItems' Field='OverallDeliveryStatusForAllItems2' />
        <Tag XPath='SapStatusinfo[1]/RequestedDeliveryDate' Field='RequestedDeliveryDate2' />
        <Tag XPath='SapStatusinfo[1]/SalesDocumentItem' Field='SalesDocumentItem2' />
        <Tag XPath='SapStatusinfo[1]/MaterialNumber' Field='MaterialNumber2' />
        <Tag XPath='SapStatusinfo[1]/ShortTextForSalesOrderItem' Field='ShortTextForSalesOrderItem2' />
        <Tag XPath='SapStatusinfo[1]/ScheduleLineDate' Field='ScheduleLineDate2' />
        <Tag XPath='SapStatusinfo[1]/CumulativeOrderQuantityInSalesUnits' Field='CumulativeOrderQuantityInSalesUnits2' />
        <Tag XPath='SapStatusinfo[1]/CumulativeConfirmedQuantityInSalesUnit' Field='CumulativeConfirmedQuantityInSalesUnit2' />
        <Tag XPath='SapStatusinfo[1]/SalesUnit' Field='SalesUnit2' />
        <Tag XPath='SapStatusinfo[1]/NetValueOfTheOrderItemInDocumentCurrency' Field='NetValueOfTheOrderItemInDocumentCurrency2' />
        <Tag XPath='SapStatusinfo[1]/SdDocumentCurrency' Field='SdDocumentCurrency2' />
        <Tag XPath='SapStatusinfo[1]/NetPrice' Field='NetPrice2' />
        <Tag XPath='SapStatusinfo[1]/ConditionPricingUnit' Field='ConditionPricingUnit2' />
        <Tag XPath='SapStatusinfo[1]/ConditionUnit' Field='ConditionUnit2' />
        <Tag XPath='SapStatusinfo[1]/OverallDeliveryStatusOfTheItem' Field='OverallDeliveryStatusOfTheItem2' />
        <Tag XPath='SapStatusinfo[1]/DeliveryItem' Field='DeliveryItem2' />
        <Tag XPath='SapStatusinfo[1]/ActualQuantityDeliveredInSalesUnits' Field='ActualQuantityDeliveredInSalesUnits2' />
        <Tag XPath='SapStatusinfo[1]/ReferencedQuantityInBaseUnitOfMeasure' Field='ReferencedQuantityInBaseUnitOfMeasure2' />
        <Tag XPath='SapStatusinfo[1]/IsoCodeCurrency' Field='IsoCodeCurrency2' />
        <Tag XPath='SapStatusinfo[1]/EntryTime' Field='EntryTime2' />
        <Tag XPath='SapStatusinfo[1]/CustomerPurchaseOrderNumber810181970' Field='CustomerPurchaseOrderNumber2' />
        </TemplateTag>
        <TemplateDocument>
        <DocumentType version='1.0'>Update_First_Element</DocumentType>
        <StartElement>Update_First_Element</StartElement>
        <TemplateTagName>NewMessageMap</TemplateTagName>
        <CommandMapping>
        <Command CommandName='ProcessInBoundTestXML' />
        </CommandMapping>
        </TemplateDocument>
        <TemplateTag name='NewMessageMap'>
        <!-- Command Parameters -->
        <Tag XPath='DataArea/ABC' Field='abc_id' />
        </TemplateTag>
        </ECTemplate>
        ***************************
        Thanks a lot for your time and inputs.