• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

XML Query

New Here ,
Dec 28, 2008 Dec 28, 2008

Copy link to clipboard

Copied

Hi

Hope everyone is having a great break and christmas. Unfortunately I am back at work and have a query, hopefully to gain some understanding about some xml webservices I need to send data to. Using a 3rd party tool I have figured out the request data the webservice is looking for as below.

My question is, using coldfusion code, ie xmlnew(), XMLElemNew(). or other functions How would I create the <tns: and <soap: info in the header, and as a rule of thumb is this information required by the webservice (<tns:Surname /> as opposed to <Surname />) if that makes sense. I would ask the provider this question but nobody available at the moment. ;)

Cheers

MW
TOPICS
Advanced techniques

Views

325

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 29, 2008 Dec 29, 2008

Copy link to clipboard

Copied

patord wrote:
> Hi
>
> Hope everyone is having a great break and christmas. Unfortunately I am back
> at work and have a query, hopefully to gain some understanding about some xml
> webservices I need to send data to. Using a 3rd party tool I have figured out
> the request data the webservice is looking for as below.
>
> My question is, using coldfusion code, ie xmlnew(), XMLElemNew(). or other
> functions How would I create the <tns: and <soap: info in the header, and as a
> rule of thumb is this information required by the webservice (<tns:Surname />
> as opposed to <Surname />) if that makes sense. I would ask the provider this
> question but nobody available at the moment. ;)

There's no need to use XMLNew and friends. You can use plain old
concatenation:
<cfsavecontent variables="xmlBody">
<tns:CreateAccountV1>
<tns:AccountCoreDetails>
<tns:OrganisationCode>CODEHERE</tns:OrganisationCode>
<tns:Surname>#surname#</tns:Surname>
</tns:AccountCoreDetails>
</tns:CreateAccountV1>
</cfsavecontent>

--
Mack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 29, 2008 Dec 29, 2008

Copy link to clipboard

Copied

Thanks for that, well I should have mentioned that I am going to be querying a few thousand records may be upto 10,000 with a possible 225 elements, what would be the best way to be able to do this and what is the limit for coldfusion creating each element looping through a query?

MW

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 30, 2008 Dec 30, 2008

Copy link to clipboard

Copied

LATEST
Mark Wheeler wrote:
> Thanks for that, well I should have mentioned that I am going to be querying a
> few thousand records may be upto 10,000 with a possible 225 elements, what
> would be the best way to be able to do this and what is the limit for
> coldfusion creating each element looping through a query?

If you more then a few records then I recommend using the Java
StringBuffer class when doing the concatenation (just google
"stringBuffer coldfusion"), it's quite faster.

--
Mack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Dec 29, 2008 Dec 29, 2008

Copy link to clipboard

Copied

quote:

...as a rule of thumb is this information required by the webservice (<soap:Body>, <tns:...>)


Yes. XML entity names with a colon in them are within a namespace. In this case, this line:
<soap:Envelope xmlns:soap=" http://www.w3.org/2003/05/soap-envelope"
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd=" http://www.w3.org/2001/XMLSchema" xmlns:tns= http://ws.com/webservice>

sets up 4 namespaces. soap, xsi, xsd, and tns. The soap namespace is common to any soap-based web service. The tns namespace is specific to this webservice, or maybe generic across all webservices that this specific company has.

Be sure you include _everything_ that is in this snippet. You can't exclude any of it (except, of course, the XML declaration).

<cfxml variable="mySoapRequest">
<soap:Envelope xmlns:soap=" http://www.w3.org/2003/05/soap-envelope"
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd=" http://www.w3.org/2001/XMLSchema" xmlns:tns=" http://ws.com/webservice">
<soap:Body>
<tns:CreateAccountV1>
<tns:AccountCoreDetails>
<tns:OrganisationCode>CODE HERE</tns:OrganisationCode>
<tns:Surname />
</tns:AccountCoreDetails>
</tns:CreateAccountV1>
</soap:Body>
</soap:Envelope>
</cfxml>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation