Skip to main content
Chakri
Participant
June 25, 2015
Question

Coldfusion generated WSDL showing wrong targetNameSpace

  • June 25, 2015
  • 2 replies
  • 1285 views

We recently migration our application from CF 8 to CF 11 Update 3. There is a ColdFusion web service that is being consumed by a .NET application. The cfcomponent tag is specified with the following attributes

<cfcomponent

style = "rpc"

bindingname = "component1.cfcSoapBinding"

namespace="http://#cgi.host_name#/<webservicefolder>/component1.cfc"

serviceaddress="http://#cgi.host_name#/<webservicefolder>/component1.cfc"

porttypename = "component1"

serviceportname = "component1.cfc"

>

In Our Test server (same CF version), the webservice is invoked by the .NET application successfully. However, in Production server, the .NET application is getting error when trying to invoke the service. The error information at .NET end is :

 

There is an error in XML document (31, 31).

at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)     at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)     at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)     at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)....

When we compared the WSDL generated from QA & Prod server, we noticed difference in tns1 and targetNamespace.

QA WSDL (which is working)

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

<wsdl:definitions targetNamespace="serviceaddress" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="serviceaddress" xmlns:intf="serviceaddress" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="http://<webservicefolder>" xmlns:tns2="http://rpc.xml.coldfusion" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  <wsdl:types>

   <schema targetNamespace="http://<webservicefolder>" xmlns="http://www.w3.org/2001/XMLSchema">

Prod WSDL (not working)

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

wsdl:definitions targetNamespace="serviceaddress" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="serviceaddress" xmlns:intf="serviceaddress" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1=http://<webservicefolder>.<rootfolder>  xmlns:tns2="http://rpc.xml.coldfusion" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<wsdl:types>

<schema targetNamespace="http://<webservicefolder>.<rootfolder>" xmlns="http://www.w3.org/2001/XMLSchema">

You can see the difference in the tns2, targetNamespace value. We do not understand how this namespace is getting generated and why it is different in the 2 servers with same code & same CF version.

Any help on this will be greatly appreciated.

    This topic has been closed for replies.

    2 replies

    December 8, 2015

    I have a similar issue in that we use the default targetNamespace="http://ws.apache.org/axis2" however when we added a mapping in our Application.cfc ( this.mappings["/webroot"] = "/var/www/mywebsite"; ) the targetnamespace of all our webservice wsdls got rewritten to targetNamespace="http://<webservicefolder>.webroot". Have you had any success in getting to the bottom of this?

    Dave Ferguson
    Participating Frequently
    June 25, 2015

    In the CF admin under Data & Services > Web Services change the web service version to 1.  See if that fixes your issue.

    --Dave

    Chakri
    ChakriAuthor
    Participant
    June 26, 2015

    Hi,  The Web service version is 1 in both QA and Prod currently.

    Any idea on what determines the targetNamespace value when ColdFusion generates the WSDL and how we can control it in code (apart from what we have already done by specifying above mentioned attributes in <cfcomponent> tag) ?.

    I also need to mention that we tried saving the correct WSDL (from QA)  in the server and referring to it in <cfcomponent> tag as < cfcomponent wsdlfile = wsdlfilepath > . Even then, in the response, the tns1 value is set wrongly.

    Chakri
    ChakriAuthor
    Participant
    June 26, 2015

    Also, correction to my first query. The difference between QA & Prod WSDLs is in values tns1, targetNamespace values. QA (correct one) values are http://webservicefolder  name  & Prod (not working) is http://webservicefolder.rootfolder.