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

ColdFusion 2016 invoke webservice returns error - works fine on CF 9

Contributor ,
Aug 24, 2016 Aug 24, 2016

Copy link to clipboard

Copied

So I am trying to migrate a site from CF 9 to CF 2016 after getting past a few issues I have run into one I can't seem to figure out. Basically I call the web service like so

<cfinvoke

webservice="#APPLICATION.SiteURL#/cfapi/webservices/Orders.cfc?wsdl"

method="QueryOrder"

returnvariable="REQUEST.XML">

<cfinvokeargument name="WebOrderNumber" value="#URL.WebOrderNumber#" />

</cfinvoke>

And it calls a page that returns an order via xml. On CF 9 it works fine. CF 2016 returns the XML but it also returns an error. The error says

This page contains the following errors:

error on line 66 at column 1: Extra content at the end of the document

Below is a rendering of the page up to the first error.

Then it lists my XML but just as straight string data. Even though if you view the source it shows the exact same XML content as the CF 9 server returns. The only other error info I see is this. "Cannot perform web service invocation QueryOrder"

I'm stuck! Any ideas?

Views

1.3K

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

correct answers 1 Correct answer

Contributor , Aug 24, 2016 Aug 24, 2016

I found the issue. I had an OnRequestEnd function in my Application.cfc that was adding some white space

Votes

Translate

Translate
LEGEND ,
Aug 24, 2016 Aug 24, 2016

Copy link to clipboard

Copied

I know that CF isn't exactly inexpensive.  Just one of the reasons why it has been declining in popularity for a while, now.  But when you skip a generation or two and then upgrade, you're most likely going to experience issues.

I'd guess that the XML isn't as properly formed as CF12 (CF2016) would like it to be, based upon the error message.

Check the CFAdmin logs for anything that might be telling.  If that doesn't provide an idea, then surround your invoke with CFTRY/CFCATCH and use CFDUMP inside the catch to either display the cause, or have it emailed to your address.  Post it, here, and hopefully someone can spot the trouble.

HTH,

^_^

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
Contributor ,
Aug 24, 2016 Aug 24, 2016

Copy link to clipboard

Copied

Ok i think the issue might not be with the cfinvoke itself but in the display of the xml once it is returned. The XML is at the very bottom which appears to be ok to me.

If I just cfdump the return XML it dumps out as plain text just fine. However I have this code I am using to display it as XML data and I think this cose is what is causing the problem. If I comment it out the cfcontent tag it works without error. I add the cfcontent tag back in and I get the error. Suggestions?

<cfcontent type="application/xml; charset=UTF-8">

<cfoutput>#REQUEST.XML#</cfoutput>

<?xml version="1.0" encoding="utf-8"?>

<Result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.acctivate.com/xmlschema/">

  <Status>Success</Status>

  <Order>

    <WebOrderNumber>36312</WebOrderNumber>

    <OrderDate>x</OrderDate>

    <PONumber>x</PONumber>

    <WebCustomerID>x</WebCustomerID>

    <Reference2>x</Reference2>

    <ShipToDescription>x</ShipToDescription>

    <ShipToAttention></ShipToAttention>

    <ShipToAddress1>x</ShipToAddress1>

    <ShipToAddress2>x</ShipToAddress2>

    <ShipToAddress3></ShipToAddress3>

    <ShipToCity>x</ShipToCity>

    <ShipToState>x</ShipToState>

    <ShipToZip>x</ShipToZip>

    <ShipToCountry>x</ShipToCountry>

    <SoldToName></SoldToName>

    <SoldToAddress1>x</SoldToAddress1>

    <SoldToAddress2>x</SoldToAddress2>

    <SoldToAddress3></SoldToAddress3>

    <SoldToCity>x</SoldToCity>

    <SoldToState>x</SoldToState>

    <SoldToZip>x</SoldToZip>

    <SoldToCountry>x</SoldToCountry>

    <ContactFirstName></ContactFirstName>

    <ContactLastName></ContactLastName>

    <ContactName></ContactName>

    <ContactEMailAddress></ContactEMailAddress>

    <ContactPhoneNumber>x</ContactPhoneNumber>

    <ContactFax></ContactFax>

    <ShippingInstructions></ShippingInstructions>

    <SpecialInstructions>x</SpecialInstructions>

    <PendingShippingCharges>x</PendingShippingCharges>

    <TaxCode>x</TaxCode>

    <TaxCategoryID></TaxCategoryID>

    <ShipVia>x</ShipVia>

    <Carrier></Carrier>

    <CarrierService>First Class</CarrierService>

    <MethodOfPayment></MethodOfPayment>

    <CheckOrCreditCardNumber></CheckOrCreditCardNumber>

    <CreditCardExpirationDate></CreditCardExpirationDate>

    <CreditCardExpirationMonth></CreditCardExpirationMonth>

    <CreditCardExpirationYear></CreditCardExpirationYear>

    <CreditCardName></CreditCardName>

    <CreditCardAddress></CreditCardAddress>

    <CreditCardPostalCode></CreditCardPostalCode>

    <AmtPaid>x</AmtPaid>

    <TotalAmount>x</TotalAmount>

    <DiscountOrCharges>

      <DiscountOrCharge Value="0" />

    </DiscountOrCharges>

    <OrderLines>

      <OrderLine>

        <LineID>1</LineID>

        <VendorProductID>x</VendorProductID>

        <DisplayQtyOrdered>1</DisplayQtyOrdered>

        <DisplayUnit>x</DisplayUnit>

        <BasePrice>x</BasePrice>

        <SpecialInstructions></SpecialInstructions>

      </OrderLine>

    </OrderLines>

  </Order>

</Result>

<style> 

  table.cfdump_wddx,

  table.cfdump_xml,

  table.cfdump_struct,

  table.cfdump_varundefined,

  table.cfdump_array,

  table.cfdump_query,

  table.cfdump_cfc,

  table.cfdump_object,

  table.cfdump_binary,

  table.cfdump_udf,

  table.cfdump_udfbody,

  table.cfdump_udfarguments {

  font-size: xx-small;

  font-family: verdana, arial, helvetica, sans-serif;

  }

  table.cfdump_wddx th,

  table.cfdump_xml th,

  table.cfdump_struct th,

  table.cfdump_varundefined th,

  table.cfdump_array th,

  table.cfdump_query th,

  table.cfdump_cfc th,

  table.cfdump_object th,

  table.cfdump_binary th,

  table.cfdump_udf th,

  table.cfdump_udfbody th,

  table.cfdump_udfarguments th {

  text-align: left;

  color: white;

  padding: 5px;

  }

  table.cfdump_wddx td,

  table.cfdump_xml td,

  table.cfdump_struct td,

  table.cfdump_varundefined  td,

  table.cfdump_array td,

  table.cfdump_query td,

  table.cfdump_cfc td,

  table.cfdump_object td,

  table.cfdump_binary td,

  table.cfdump_udf td,

  table.cfdump_udfbody td,

  table.cfdump_udfarguments td {

  padding: 3px;

  background-color: #ffffff;

  vertical-align : top;

  }

  table.cfdump_wddx {

  background-color: #000000;

  }

  table.cfdump_wddx th.wddx {

  background-color: #444444;

  }

  table.cfdump_xml {

  background-color: #888888;

  }

  table.cfdump_xml th.xml {

  background-color: #aaaaaa;

  }

  table.cfdump_xml td.xml {

  background-color: #dddddd;

  }

  table.cfdump_struct {

  background-color: #0000cc ;

  }

  table.cfdump_struct th.struct {

  background-color: #4444cc ;

  }

  table.cfdump_struct td.struct {

  background-color: #ccddff;

  }

  table.cfdump_varundefined {

  background-color: #CC3300 ;

  }

  table.cfdump_varundefined th.varundefined {

  background-color: #CC3300 ;

  }

  table.cfdump_varundefined td.varundefined {

  background-color: #ccddff;

  }

  table.cfdump_array {

  background-color: #006600 ;

  }

  table.cfdump_array th.array {

  background-color: #009900 ;

  }

  table.cfdump_array td.array {

  background-color: #ccffcc ;

  }

  table.cfdump_query {

  background-color: #884488 ;

  }

  table.cfdump_query th.query {

  background-color: #aa66aa ;

  }

  table.cfdump_query td.query {

  background-color: #ffddff ;

  }

  table.cfdump_cfc {

  background-color: #ff0000;

  }

  table.cfdump_cfc th.cfc{

  background-color: #ff4444;

  }

  table.cfdump_cfc td.cfc {

  background-color: #ffcccc;

  }

  table.cfdump_object {

  background-color : #ff0000;

  }

  table.cfdump_object th.object{

  background-color: #ff4444;

  }

  table.cfdump_binary {

  background-color : #eebb00;

  }

  table.cfdump_binary th.binary {

  background-color: #ffcc44;

  }

  table.cfdump_binary td {

  font-size: x-small;

  }

  table.cfdump_udf {

  background-color: #aa4400;

  }

  table.cfdump_udf th.udf {

  background-color: #cc6600;

  }

  table.cfdump_udfarguments {

  background-color: #dddddd;

  }

  table.cfdump_udfarguments th {

  background-color: #eeeeee;

  color: #000000;

  }

</style>

<script language="javascript">

// for queries we have more than one td element to collapse/expand

  var expand = "open";

  dump = function( obj ) {

  var out = "" ;

  if ( typeof obj == "object" ) {

  for ( key in obj ) {

  if ( typeof obj[key] != "function" ) out += key + ': ' + obj[key] + '<br>' ;

  }

  }

  }

  cfdump_toggleRow = function(source) {

  //target is the right cell

  if(document.all) target = source.parentElement.cells[1];

  else {

  var element = null;

  var vLen = source.parentNode.childNodes.length;

  for(var i=vLen-1;i>0;i--){

  if(source.parentNode.childNodes.nodeType == 1){

  element = source.parentNode.childNodes;

  break;

  }

  }

  if(element == null)

  target = source.parentNode.lastChild;

  else

  target = element;

  }

  //target = source.parentNode.lastChild ;

  cfdump_toggleTarget( target, cfdump_toggleSource( source ) ) ;

  }

  cfdump_toggleXmlDoc = function(source) {

  var caption = source.innerHTML.split( ' [' ) ;

  // toggle source (header)

  if ( source.style.fontStyle == 'italic' ) {

  // closed -> short

  source.style.fontStyle = 'normal' ;

  source.innerHTML = caption[0] + ' [short version]' ;

  source.title = 'click to maximize' ;

  switchLongToState = 'closed' ;

  switchShortToState = 'open' ;

  } else if ( source.innerHTML.indexOf('[short version]') != -1 ) {

  // short -> full

  source.innerHTML = caption[0] + ' [long version]' ;

  source.title = 'click to collapse' ;

  switchLongToState = 'open' ;

  switchShortToState = 'closed' ;

  } else {

  // full -> closed

  source.style.fontStyle = 'italic' ;

  source.title = 'click to expand' ;

  source.innerHTML = caption[0] ;

  switchLongToState = 'closed' ;

  switchShortToState = 'closed' ;

  }

  // Toggle the target (everething below the header row).

  // First two rows are XMLComment and XMLRoot - they are part

  // of the long dump, the rest are direct children - part of the

  // short dump

  if(document.all) {

  var table = source.parentElement.parentElement ;

  for ( var i = 1; i < table.rows.length; i++ ) {

  target = table.rows ;

  if ( i < 3 ) cfdump_toggleTarget( target, switchLongToState ) ;

  else cfdump_toggleTarget( target, switchShortToState ) ;

  }

  }

  else {

  var table = source.parentNode.parentNode ;

  var row = 1;

  for ( var i = 1; i < table.childNodes.length; i++ ) {

  target = table.childNodes ;

  if( target.style ) {

  if ( row < 3 ) {

  cfdump_toggleTarget( target, switchLongToState ) ;

  } else {

  cfdump_toggleTarget( target, switchShortToState ) ;

  }

  row++;

  }

  }

  }

  }

  cfdump_toggleTable = function(source) {

  var switchToState = cfdump_toggleSource( source ) ;

  if(document.all) {

  var table = source.parentElement.parentElement ;

  for ( var i = 1; i < table.rows.length; i++ ) {

  target = table.rows ;

  cfdump_toggleTarget( target, switchToState ) ;

  }

  }

  else {

  var table = source.parentNode.parentNode ;

  for ( var i = 1; i < table.childNodes.length; i++ ) {

  target = table.childNodes ;

  if(target.style) {

  cfdump_toggleTarget( target, switchToState ) ;

  }

  }

  }

  }

  cfdump_toggleSource = function( source ) {

  if ( source.style.fontStyle == 'italic' || source.style.fontStyle == null) {

  source.style.fontStyle = 'normal' ;

  source.title = 'click to collapse' ;

  return 'open' ;

  } else {

  source.style.fontStyle = 'italic' ;

  source.title = 'click to expand' ;

  return 'closed' ;

  }

  }

  cfdump_toggleTarget = function( target, switchToState ) {

  if ( switchToState == 'open' ) target.style.display = '' ;

  else target.style.display = 'none' ;

  }

  // collapse all td elements for queries

  cfdump_toggleRow_qry = function(source) {

  expand = (source.title == "click to collapse") ? "closed" : "open";

  if(document.all) {

  var nbrChildren = source.parentElement.cells.length;

  if(nbrChildren > 1){

  for(i=nbrChildren-1;i>0;i--){

  target = source.parentElement.cells;

  cfdump_toggleTarget( target,expand ) ;

  cfdump_toggleSource_qry(source);

  }

  }

  else {

  //target is the right cell

  target = source.parentElement.cells[1];

  cfdump_toggleTarget( target, cfdump_toggleSource( source ) ) ;

  }

  }

  else{

  var target = null;

  var vLen = source.parentNode.childNodes.length;

  for(var i=vLen-1;i>1;i--){

  if(source.parentNode.childNodes.nodeType == 1){

  target = source.parentNode.childNodes;

  cfdump_toggleTarget( target,expand );

  cfdump_toggleSource_qry(source);

  }

  }

  if(target == null){

  //target is the last cell

  target = source.parentNode.lastChild;

  cfdump_toggleTarget( target, cfdump_toggleSource( source ) ) ;

  }

  }

  }

  cfdump_toggleSource_qry = function(source) {

  if(expand == "closed"){

  source.title = "click to expand";

  source.style.fontStyle = "italic";

  }

  else{

  source.title = "click to collapse";

  source.style.fontStyle = "normal";

  }

  }

</script>

  <table class="cfdump_struct">

  <tr><th class="struct" colspan="2" onClick="cfdump_toggleTable(this);" style="cursor:pointer;" title="click to collapse">struct</th></tr>

  <tr>

  <td class="struct" onClick="cfdump_toggleRow(this);" style="cursor:pointer;" title="click to collapse">cfid</td>

  <td>

  35015

  </td>

  </tr>

  <tr>

  <td class="struct" onClick="cfdump_toggleRow(this);" style="cursor:pointer;" title="click to collapse">cftoken</td>

  <td>

  94eb9d2d8ec5f403-6D394063-B1E6-0CCE-DE69B5150DC44ADD

  </td>

  </tr>

  <tr>

  <td class="struct" onClick="cfdump_toggleRow(this);" style="cursor:pointer;" title="click to collapse">sessionid</td>

  <td>

  243141

  </td>

  </tr>

  <tr>

  <td class="struct" onClick="cfdump_toggleRow(this);" style="cursor:pointer;" title="click to collapse">urltoken</td>

  <td>

  CFID=35015&CFTOKEN=94eb9d2d8ec5f403-6D394063-B1E6-0CCE-DE69B5150DC44ADD

  </td>

  </tr>

  <tr>

  <td class="struct" onClick="cfdump_toggleRow(this);" style="cursor:pointer;" title="click to collapse">vendor</td>

  <td>

  <table class="cfdump_struct">

  <tr><th class="struct" colspan="2" onClick="cfdump_toggleTable(this);" style="cursor:pointer;" title="click to collapse">struct</th></tr>

  <tr>

  <td class="struct" onClick="cfdump_toggleRow(this);" style="cursor:pointer;" title="click to collapse">PRODUCTSBY</td>

  <td>

  Category

  </td>

  </tr>

  </table>

  </td>

  </tr>

  </table>

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
Contributor ,
Aug 24, 2016 Aug 24, 2016

Copy link to clipboard

Copied

I found the issue. I had an OnRequestEnd function in my Application.cfc that was adding some white space

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 ,
Aug 24, 2016 Aug 24, 2016

Copy link to clipboard

Copied

LATEST

That'll do it.  It should have failed in CF9, as well, but I guess CF9 isn't as pedantic as CF2016, so it let it slide.  Glad you got it fixed.

V/r,

^_^

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