Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8326685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:50:44+00:00 2026-06-09T00:50:44+00:00

I am far from expert in ColdFusion or XML, so this is probably a

  • 0

I am far from expert in ColdFusion or XML, so this is probably a silly question. But is there a way to dynamically construct parts of a SOAP transaction, perhaps by including CFML within the transaction itself?? The API I am working with has a “MultiQuery” that allows a number of simple queries to be run within a single SOAP transaction. I want to use this feature to query using a bunch of Unique IDs that are provided by the previous web page. I don’t know ahead of time how many IDs I will need to add to the “MultiQuery,” so my thought was to pass each ID into an array on the page containing “MultiQuery,” and then loop through the array (“allOfficers”) to build the SOAP transaction, like this:

<cfset queryOpen=HTMLEditFormat("<arr:string>")>
<cfset queryClose=HTMLEditFormat("</arr:string>")>
<soapenv:Body>
  <ser:MultiQuery>
     <ser:associationGuid>e1c095ca39af</ser:associationGuid>
     <ser:queries>
        <cfloop index="i" from="1" to="#arrayLen(allOfficers)#">
            <cfoutput>#queryOpen#</cfoutput>from Membership memb where memb.Owner='<cfoutput>#allOfficers[1]#</cfoutput>'<cfoutput>#queryClose#</cfoutput>
        </cfloop>
    </ser:queries>
  </ser:MultiQuery>
</soapenv:Body>

Which of course does not work. When I output just the array, it produces nice output like this:

<arr:string>from Membership memb where memb.Owner='006e1c09-25f9-4178-86de-13c3e63200ce'</arr:string>

which is just the format I need for the SOAP envelope. But again, it does not work — clearly it’s the cfloop I am trying to use, because when I manually insert the output from the loop, the SOAP transaction works fine.

So, if anybody could give me some suggestions or get me pointed in the right direction, I sure would appreciate it. Again, I am bascially trying to dynamically add stuff to the SOAP transaction. Thanks in advance for your help!

UPDATE: here is the complete code I am using to try and build this SOAP request. Thank you all for your help!

<cfset queryOpen=HTMLEditFormat("<arr:string>")>
<cfset queryClose=HTMLEditFormat("</arr:string>")>

<cfloop index="i" from="1" to="#arrayLen(allOfficers)#">
<cfoutput>#queryOpen#</cfoutput>from Membership memb where memb.Owner='<cfoutput>#allOfficers[1]#</cfoutput>'<cfoutput>#queryClose#<br /></cfoutput>
        </cfloop>

<cfsavecontent variable="soapBody">
<cfoutput>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:imp="http://test.com/Services/Imports" xmlns:ser="http://test.com/Services" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<soapenv:Header>
  <imp:SessionIdentifier Id="#URL.sessionGuid#"/>
</soapenv:Header>
<soapenv:Body>
  <ser:MultiQuery>
     <ser:associationGuid>12345</ser:associationGuid>
     <ser:queries>
        <cfloop index="i" from="1" to="#arrayLen(allOfficers)#">
            <cfoutput>#queryOpen#</cfoutput>from Membership memb where memb.Owner='<cfoutput>#allOfficers[i]#</cfoutput>'<cfoutput>#queryClose#</cfoutput>
        </cfloop>
    </ser:queries>
  </ser:MultiQuery>
</soapenv:Body>
</soapenv:Envelope>
</cfoutput>
</cfsavecontent>

<cfhttp url="https://test.com/Live/Partner/ObjectService" method="post" useragent="#CGI.http_user_agent#">
<cfhttpparam type="header" name="SOAPAction" value="http://test.com/Services/IObjectService/MultiQuery" />
<cfhttpparam type="header" name="accept-encoding" value="no-compression" />
<cfhttpparam type="xml" name="soapenv" value="#trim(soapBody)#" /> 
</cfhttp>

<cfset soapBody = xmlParse(cfhttp.fileContent) />
<cfset soapBody = soapBody['s:Envelope']['s:Body'].MultiQueryResponse.MultiQueryResult.Objects.ArrayOfanyType.anyType.Fields />
<cfset keyValue = xmlSearch(soapBody,"//*[local-name()='KeyValueOfstringanyType']") />

I can then loop over keyValue[] to build my page. The code as presented above does not work. When I take out the cfloop and replace it manually, it works. So i guess my question is, how can I add more queries to the queries section of the SOAP body? Or, is that even the right approach to be using? I do not know how many Chapter Officers each committee has, nor do I know their GUIDs until a user selects a chapter.

Hope this makes sense! Thanks again for your help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T00:50:46+00:00Added an answer on June 9, 2026 at 12:50 am

    why not put a <cfsavecontent> tag around it and then dump it to the screen to see the output.

    I don’t see any <cfoutput> tags there, but hard to guess if it is being executed as text or cfml

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I'm far from an expert on C, but something's been bugging me about
I've been using StructureMap for sometime now but I'm far from an expert. My
Fair warning: I am no expert, but I did manage to get this far.
I'm far from a JavaScript expert but I'm trying to migrate some mootools code
I'm making a simple jQuery navigation system but I am far from expert at
Ok, so I'm far from an expert developer, as you'll soon find out, but
As far as I understand from the documentation the QUdpSocket are async but, still,
so I'm very very far from an expert on MVC or ASP.NET. I just
I have used regExp quit a bit of times but still far from being
I am no SQL expert, far from it. I am writing a Rails application,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.