Solved

FSM Connect - Pass multiple attributes

  • 2 November 2023
  • 14 replies
  • 143 views

Userlevel 5
Badge +14

Hi,

 

Working on a project to connect to a 3rd party.

 

The API i’m posting to is wanting to receive single and multiple attributes.

 Example;

<cXML payloadID="20230926230000000.19736.50338@company.name" timestamp="2023-09-26T23:00:00+0100" xml:lang="en-GB">
    <Header>
        <From>
            <Credential domain="NetworkId">
                <Identity>Markerstudy</Identity>
            </Credential>
        </From>
        
        <To>
            <Credential domain="NetworkId">
                <Identity>S0002027</Identity>
            </Credential>
        </To>
        <Sender>
            <Credential domain="NetworkId">
                <Identity>Proactis</Identity>
            </Credential>
            <UserAgent>proactis-us-agent</UserAgent>
        </Sender>
    </Header>
    
    <Request deploymentMode="test">
        <ReceiptRequest>
            <ReceiptRequestHeader receiptID="Rec_1000000355" receiptDate="2023-09-26T23:00:00">

 

Is there a way in FSM Connect to achieve that in the XML Maps?

I can configure the map for  <Credential domain="NetworkId"> but i’m struggling for the the two bold examples (and therefore others that would be needed).

 

Any help would be appreciated.


Ady

icon

Best answer by SAMLK 28 November 2023, 11:35

View original

14 replies

Userlevel 5
Badge +14

Hi,

Anyone able to assist on this one please?

Ady

Userlevel 5
Badge +14

Hi,

Hopefully me asking for any assistance on this bumps it up any algorithm being used and someone see’s this.

Just want to know if the above is possible.

Ideally get answer through this platform.

Ady

 

 

Userlevel 4
Badge +12

Hi @AdrianEgley ,

Just noticed this question,

You may try this approach out. ‘@’ symbol usually denotes the simple attributes and make sure to inject these attributes using the xpath as below.

this will give you a result with multiple attributes as below.

<Request deploymentMode="test">
<ReceiptRequest>
<ReceiptRequestHeader receiptID="Rec_1000000355" receiptDate="20231128" />
<UserAgent>proactis-us-agent</UserAgent>
</ReceiptRequest>
</Request>

Let me know if you have any questions

Userlevel 5
Badge +14

Hi @SAMLK - absolute magic!!

That’s worked a treat, thank you very much.

One more question if I may. One of the attributes is ‘xml:lang’ - FSM when generating the XML doesn’t like the ‘ : ‘ colon character. Is there anything I can do the allow that to be supported when generating the XML?

 

Ady

Userlevel 4
Badge +12

Hi @SAMLK - absolute magic!!

That’s worked a treat, thank you very much.

One more question if I may. One of the attributes is ‘xml:lang’ - FSM when generating the XML doesn’t like the ‘ : ‘ colon character. Is there anything I can do the allow that to be supported when generating the XML?

 

Ady

Hi Ady,

Usually according to the w3 guide xml prefix is already bound to the namespace name itself. I assume the attribute ‘lang’ would be sufficient enough to pass your payload.

But if it is insisted, then you need to declare the xml namespace prefix under the namespaces tab as below.

prefix : xml 

namespace : http://www.w3.org/XML/1998/namespace

then you need to add the namespace this way without using xpath, so that it will be added to the top most node with the prefix as below.

 

the sample result will look like this,

<Request deploymentMode="test" xml:lang="en-US">
<ReceiptRequest>
<ReceiptRequestHeader receiptID="Rec_1000000355" receiptDate="20231128" />
<UserAgent>proactis-us-agent</UserAgent>
</ReceiptRequest>
</Request>

unfortunately this will not work, if you try to use the xpath (if used, then it will be ignored automatically if I’m not mistaken)

But in your case, I see that it only needs to be concatenated with the root node cXML.

Let me know if you need further assistance.

Userlevel 5
Badge +14

@SAMLK - That’s worked a treat also.

Thank you for the replies, it’s very much appreciated.

Ady

Userlevel 5
Badge +14

@SAMLK 

 

Whilst we’re on a roll.

The next part of the message to post is to pass an attribute and a variable.

                <Extrinsic name="ProactisDepartmentId">S005_D031</Extrinsic>
                <Extrinsic name="ProactisCostCenterId">S005_D031</Extrinsic>
                <Extrinsic name="ProactisCostCenterErpId">D031</Extrinsic>

 

I have set-up like;

 But the format XML being created show like

<Extrinsic name="N11" />

It is simply using the variable from the Purchase Order.

So what I want to get to is;

<Extrinsic name="ProactisDepartmentId">N11</Extrinsic>

Is there a way to achieve this?

Ady

Userlevel 4
Badge +12

@SAMLK

 

Whilst we’re on a roll.

The next part of the message to post is to pass an attribute and a variable.

                <Extrinsic name="ProactisDepartmentId">S005_D031</Extrinsic>
                <Extrinsic name="ProactisCostCenterId">S005_D031</Extrinsic>
                <Extrinsic name="ProactisCostCenterErpId">D031</Extrinsic>

 

I have set-up like;

 But the format XML being created show like

<Extrinsic name="N11" />

It is simply using the variable from the Purchase Order.

So what I want to get to is;

<Extrinsic name="ProactisDepartmentId">N11</Extrinsic>

Is there a way to achieve this?

Ady

Hi Ady,

Create one row to declare the attribute and the value in it.

Use the same xpath once again to add the variable in another row :)

Then the result would look like this

<Extrinsic name="ProactisDepartmentId">S005_D031</Extrinsic>

Hope this helps!

Userlevel 5
Badge +14

@SAMLK That works a treat. Thank you.

Userlevel 5
Badge +14

@SAMLK 

Hopefully looking at the document I have to map against this should be the last question.

All the elements start with the same value.

                <Extrinsic name="ProactisDepartmentId">S005_D031</Extrinsic>
                <Extrinsic name="ProactisCostCenterId">S005_D031</Extrinsic>
                <Extrinsic name="ProactisCostCenterErpId">D031</Extrinsic>

Therefore when the integration is triggered, and I produce an XML output file, only the last value is showing.

 

Is there a way to produce all 3 elements on the same XML as theoretically they are all the same name. Just the attribute is set in them to differentiate.

 

Thanks again Ady

Userlevel 4
Badge +12

@SAMLK

Hopefully looking at the document I have to map against this should be the last question.

All the elements start with the same value.

                <Extrinsic name="ProactisDepartmentId">S005_D031</Extrinsic>
                <Extrinsic name="ProactisCostCenterId">S005_D031</Extrinsic>
                <Extrinsic name="ProactisCostCenterErpId">D031</Extrinsic>

Therefore when the integration is triggered, and I produce an XML output file, only the last value is showing.

 

Is there a way to produce all 3 elements on the same XML as theoretically they are all the same name. Just the attribute is set in them to differentiate.

 

Thanks again Ady

Hi ady,

how are the extrinsic tags denoted in the xml structure? can you share the xml 

Userlevel 5
Badge +14

@SAMLK 

Thank you, I have attached the XML.

Ady

Userlevel 5
Badge +14

@SAMLK  - Hi, thanks again for the previous assistance. Just wondering if you were able to review the last request and the ability to duplicate the elements even though they are the same name?

 

Ady

Userlevel 4
Badge +12

Hi @AdrianEgley 

Sorry for the delay I didn't get a lot of time to analyse this problem. This one is a bit tough to answer as we might have a limitation here when setting the elements starting with the same name and different attributes. I will need to check this whether it can be achieved through configs.

@ruben.maas could you kindly help @AdrianEgley if you see a straight forward answer for the last question? 

Reply