Skip to main content
nurcanb61753314
Inspiring
October 19, 2020
Answered

check tax number at our coldfusion sytem of crm-erp

  • October 19, 2020
  • 1 reply
  • 890 views

Hello,

I want to  check tax number at our coldfusion sytem of crm-erp.For example we are adding a company of our crm but we dont know that its tax number true or false.So ı tried  make it like this code but ıts not work.Can u help me please?

<cfscript>
wsURL = ' http://185.198.197.162/vknsorgulama/getall/dogrulama?vkn=18644905568&durum=2';
Ad= 'GÜNGÖR',
Soyad= 'YILMAZ',
BabaAdi= 'MEMET',
VergiDairesiAdi= 'KALEKAPI',
VergiDairesiKodu= '007252',
VKN= '9690365396',
Unvan= null,
</cfscript>

<cfxml variable="requestXML"><cfoutput>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://www.w3.org/2001/XMLSchema-instance">
<soap:Header/>
<soap:Body>
<ws:VKN>
<ws:VKN>#VKN#</ws:VKN>
<!--Optional:-->
<ws:Ad>#Ad#</ws:Ad>
<!--Optional:-->
<ws:Soyad>#Soyad#</ws:Soyad>
<ws:VergiDairesiAdi>#VergiDairesiAdi#</ws:VergiDairesiAdi>
</ws:VKN>
</soap:Body>
</soap:Envelope></cfoutput>
</cfxml>

<cfhttp url = "#wsURL#" method = "post" result = "res">
<cfhttpparam type="header" name="content-type" value="text/xml">
<cfhttpparam type="header" name="SOAPAction" value="http://tempuri.org/DisKullaniciKimlikDogrula2">
<cfhttpparam type="header" name="content-length" value="#len(trim(requestXML))#">
<cfhttpparam type="header" name="charset" value="utf-8">
<cfhttpparam type="xml" name="message" value="#trim(requestXML)#">
</cfhttp>

<cfset VKNResult = xmlParse(res.FileContent).Envelope.Body.VKNResponse.VKNResult.XmlText>

<cfdump var="#VKNnResult#">

    This topic has been closed for replies.
    Correct answer nurcanb61753314

    Hi nurcanb61753314,

     

    The best example is your own code. So I have included some suggestions in it.

     

    Please note something John123 said: the result is JSON, not XML

     

     

    <cfscript>
    wsURL = 'http://185.198.197.162/vknsorgulama/getall/dogrulama?vkn=18644905568&durum=2';
    Ad= 'GÜNGÖR';
    Soyad= 'YILMAZ';
    BabaAdi= 'MEMET';
    VergiDairesiAdi= 'KALEKAPI';
    VergiDairesiKodu= '007252';
    VKN= '9690365396';
    Unvan= 'null';
    </cfscript>
    
    <cfoutput>
    <cfsavecontent variable="requestXML"><?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        <soapenv:Header/>
        
    <!-- 
         The function (ws operation) name here is nameOfWSOperation. 
         Its argument, named 'VKN', is a complex type. 
         The element VKN has sub-elements VKN, Ad, Soyad and VergiDairesiAdi
     -->
        <soapenv:Body>
              <ws:nameOfWSOperation soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
                <ws:VKN>
    			<ws:VKN>#VKN#</ws:VKN>
    			<!--Optional:-->
    			<ws:Ad>#Ad#</ws:Ad>
    			<!--Optional:-->
    			<ws:Soyad>#Soyad#</ws:Soyad>
    			<ws:VergiDairesiAdi>#VergiDairesiAdi#</ws:VergiDairesiAdi>
    			</ws:VKN>
              </ws:nameOfWSOperation>
        </soapenv:Body>
    </soapenv:Envelope>
    </cfsavecontent>
    
    </cfoutput>
    
    
    
    <cfhttp url = "#wsURL#" method = "post" result = "res">
    <cfhttpparam type="header" name="content-type" value="text/xml">
    <cfhttpparam type="header" name="SOAPAction" value="http://tempuri.org/DisKullaniciKimlikDogrula2">
    <cfhttpparam type="header" name="content-length" value="#len(trim(requestXML))#">
    <cfhttpparam type="header" name="charset" value="utf-8">
    <cfhttpparam type="header" name="TE" value="deflate;q=0">
    <cfhttpparam type="xml" name="message" value="#trim(requestXML)#">
    </cfhttp>
    
    <cfset VKNResult = trim(res.FileContent)>
    
    <!--- Verify whether the WS result is of JSON type. If so, convert to struct. --->
    <cfif isJSON(VKNResult)>
    	<cfset wsResultStruct = deserializeJSON(VKNResult)>
    	
    	<cfdump var="#wsResultStruct#">
    </cfif>
    <!---<cfdump var="#res#">--->
    
    
    

     


    First really ı understand and ı can forget again.Thank  u so much really u helping 🙂

    1 reply

    Participating Frequently
    October 19, 2020

    In the first part of the script where you are setting variables you need to have a semi colon at the end of each line rather than commas.

     

    The call to the remote service is completing successfully but it is not returning XML. If you dump the result of the call, the "res" variable, you will see the response in FileContent looks like JSON however it does not seem to be valid JSON when I try to decode it.

    Participating Frequently
    October 19, 2020

    The return in FileContent is valid JSON, I mistyped something in my test, so you need to deserialize it to a CF structure. Use dataStruct = deserializeJSON(res.FileContent); to convert the returned JSON then you can reference the result values in dataStruct.

     

     

    nurcanb61753314
    Inspiring
    October 19, 2020

    Thank u so much for u helping first.Maybe ı can see an example about that ı can understand do u have any link for this topic?