PureConnect

Discussion Thread View
Expand all | Collapse all

create the SOAP body in handler

Jump to Best Answer
  • 1.  create the SOAP body in handler

    Top 25 Contributor
    Posted 04-30-2019 08:58
    Hi All

    I have to create the below soap body as a part of my soap request . The challenge i am facing here is to create the array elements.
    Can anyone help me/suggest way to  create the below soap body.

    <soapenv:Body>
    <ivr:IVRMessage>
    <ivr:Request>
    <ivr:MeterReading>
    <ivr:AccountNumber>1234</ivr:AccountNumber>
    <ivr:PhoneNumber>5467</ivr:PhoneNumber>
    <ivr:Reading>
    <ivr:MeterNumber>5555</ivr:MeterNumber>
    <ivr:Installation>4444</ivr:Installation>
    <ivr:Value>1111</ivr:Value>
    </ivr:Reading>
    <ivr:Reading>
    <ivr:MeterNumber>666</ivr:MeterNumber>
    <ivr:Installation>777</ivr:Installation>
    <ivr:Value>222</ivr:Value>
    </ivr:Reading>
    <ivr:Reading>
    <ivr:MeterNumber>333</ivr:MeterNumber>
    <ivr:Installation>999</ivr:Installation>
    <ivr:Value>888</ivr:Value>
    </ivr:Reading>
    </ivr:MeterReading>
    </ivr:Request>
    </ivr:IVRMessage>
    </soapenv:Body>
    #Handlers

    ------------------------------
    Halesha Nagarajappa
    Accenture Solutions Pvt. Ltd.
    ------------------------------


  • 2.  RE: create the SOAP body in handler

    GCAP Member
    Posted 04-30-2019 10:21
    Look at the "Assemble string from attributes" tool and the related help topic in Interaction Designer.  This is a pretty decent way to build out request bodies from attributes you've collected.

    ------------------------------
    Aaron Lael
    State of Utah
    ------------------------------



  • 3.  RE: create the SOAP body in handler

    Top 25 Contributor
    Posted 04-30-2019 11:12
    I typically use an assignment step to create the SOAP request envelope in a string. There is a little known "feature" where if you paste a string into an assignment step with carriage returns or spaces the tool step will keep the formatting. Simply taking the above string and pasting it in will add the \r\n characters. I will usually mock up the SOAP envelope and then add variable names for the values which change. After the input XML is saved as a string I put the string into a XML Create Document From String tool step and then use that XMLDocument as my request envelope. I adopted this approach after seeing how Genesys PSO writes SOAP integrations. I figured if this approach was good enough for PSO it was good enough for my needs.

    ------------------------------
    Mark Tatera
    ConvergeOne

    Opinions are my own and not the views of my employer. Any suggestions or programming changes I suggest come with no warranty and should be tried at your own risk.
    ------------------------------



  • 4.  RE: create the SOAP body in handler

    Top 25 Contributor
    Posted 15 days ago
    Hi all

    I have tried  using above method but i am getting error while pasting the request xml ..Below is XML request i was trying to create and here i need to add the account number and phone number dynamically. can anyone please suggest way to create this? can i use tool "XML Create Document"  to create below? but how can i add the account number and phone number dynamically? 


    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:oas="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:add="http://www.w3.org/2005/08/addressing" xmlns:ivr="http://schemas.company.com/ivr/">

       <soapenv:Header>

          <oas:Timestamp oas:Id="?">

                     <oas:Created oas:Id="?">?</oas:Created>

                      <oas:Expires oas:Id="?">?</oas:Expires>

                 </oas:Timestamp>

          <add:RelatesTo RelationshipType="http://www.w3.org/2005/08/addressing/reply">?</add:RelatesTo>

          <add:MessageID>?</add:MessageID>

          <add:ReplyTo>

             <add:Address>?</add:Address>

             <add:ReferenceParameters>

                  </add:ReferenceParameters>

             <add:Metadata>

             </add:Metadata>

                  </add:ReplyTo>

          <add:Action>?</add:Action>

          <add:To>?</add:To>

          <add:From>

             <add:Address>?</add:Address>

             <add:ReferenceParameters>

             </add:ReferenceParameters>

                      <add:Metadata>

                      </add:Metadata>

                </add:From>

       </soapenv:Header>

       <soapenv:Body>

          <ivr:IVRMessage>

             <ivr:Request>

                <ivr:CustomerInfo>

                   <ivr:AccountNumber>?</ivr:AccountNumber>

                   <ivr:PhoneNumber>?</ivr:PhoneNumber>

                </ivr:CustomerInfo>

             </ivr:Request>

           </ivr:IVRMessage>

       </soapenv:Body>

    </soapenv:Envelope

    ------------------------------
    Halesha Nagarajappa
    Accenture India
    ------------------------------



  • 5.  RE: create the SOAP body in handler

    Top 25 Contributor
    Posted 15 days ago
    Halesha,

    When you try putting this into the assignment step you need to escape the double quotes. Also I noticed your /soapenv:Envelope is missing the greater than sign. What error message are you getting?

    Thanks,

    ------------------------------
    Mark Tatera
    ConvergeOne

    Opinions are my own and not the views of my employer. Any suggestions or programming changes I suggest come with no warranty and should be tried at your own risk.
    ------------------------------



  • 6.  RE: create the SOAP body in handler
    Best Answer

    GCAP Member
    Posted 12 days ago
    Hi Halesha,

    In this case always make new subroutine where you can pass input parameters(PhoneNumber and AccountNumber).

    You can make use of below steps to create you logic.

    Step 1 : in subroutine initiator add two input parameters phone and account number.
    Step 2 : use "XML Create document" and add your request xml.
    Step 3 : use "XML select single node set value" step for adding dynamically Phone and  Account number.
    Step 4 : now make use of "SOAP HTTP Request Ex3" for posting your request.

    Thanks.

    ------------------------------
    Venkoba Adeshappa
    Philips Electronics North America
    ------------------------------



  • 7.  RE: create the SOAP body in handler

    Top 25 Contributor
    Posted 12 days ago
    Hi Venkoba,
    I tried same method, but getting error while setting Node value. so broke steps, instead of using directly "XML select single node set value" step, i first used " XML select Single Node" then used the "XML get Node info " to see datatype of the node. Here i am getting no value for the data type. in the next step i used "XML set node value" to without defining any data type in this step. still its taking the failure path . can you help here what i am doing wrong? and also where should i check for what reason this node is taking failure path?

    ------------------------------
    Halesha Nagarajappa
    Accenture India
    ------------------------------



  • 8.  RE: create the SOAP body in handler

    Top 25 Contributor
    Posted 12 days ago
    Hi Venkoba,
    I tried same method, but getting error while setting Node value. so broke steps, instead of using directly "XML select single node set value" step, i first used " XML select Single Node" then used the "XML get Node info " to see datatype of the node. Here i am getting no value for the data type. in the next step i used "XML set node value" to without defining any data type in this step. still its taking the failure path . can you help here what i am doing wrong? and also where should i check for what reason this node is taking failure path?

    ------------------------------
    Halesha Nagarajappa
    Accenture India
    ------------------------------



  • 9.  RE: create the SOAP body in handler

    Top 25 Contributor
    Posted 12 days ago
    Hi All,
    I got it worked. It was my bad . In tool "XML Create document" setting, i was making it as read only. Once I unchecked that, it worked correctly .

    Thank you all 


    ------------------------------
    Halesha Nagarajappa
    Accenture India
    ------------------------------



  • 10.  RE: create the SOAP body in handler

    Top 25 Contributor
    Posted 12 days ago
    Halesha,

    Could you please check the best answer for whichever method you used to solve your issue?

    Thanks,

    ------------------------------
    Mark Tatera
    ConvergeOne

    Opinions are my own and not the views of my employer. Any suggestions or programming changes I suggest come with no warranty and should be tried at your own risk.
    ------------------------------



  • 11.  RE: create the SOAP body in handler

    GCAP Member
    Posted 11 days ago
    That's great!

    Thank you.

    ------------------------------
    Venkoba Adeshappa
    Philips Electronics North America
    ------------------------------