<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Null Pinter Exception is coming in response in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Null-Pinter-Exception-is-coming-in-response/m-p/76453#M47759</link>
    <description>&lt;P&gt;User is getting an error while the transaction we have checked in our internal code there is an error in HTTP response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is the code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Http h = new Http();&lt;BR /&gt;HttpRequest req = new HttpRequest();&lt;BR /&gt;req.setMethod('POST');&lt;BR /&gt;system.debug('TestE'+auto.endPoint__c);&lt;/P&gt;&lt;P&gt;req.setEndpoint(auto.endPoint__c);&lt;BR /&gt;req.setHeader('Content-Type','application/json');//Set the Proper Header&lt;BR /&gt;req.setHeader('Accept','application/json');&lt;BR /&gt;system.debug('Test');&lt;/P&gt;&lt;P&gt;req.setBody(generateJSON());//JSON body as String&lt;/P&gt;&lt;P&gt;system.debug('Test');&lt;BR /&gt;HttpResponse res=new HttpResponse();&lt;BR /&gt;system.debug('Status 1'+req);&lt;BR /&gt;res=h.send(req);&lt;BR /&gt;system.debug('Resonpse**********'+res);&lt;/P&gt;&lt;P&gt;system.debug('Test1');&lt;/P&gt;&lt;P&gt;if(res.getStatusCode() == 200)&lt;BR /&gt;{&lt;BR /&gt;system.debug('Status'+res.getStatusCode());&lt;BR /&gt;String responseText = res.getBody();&lt;BR /&gt;JsonResponce=res.getBody();&lt;BR /&gt;system.debug('res.getBody() '+res.getBody());&lt;BR /&gt;if(responseText != null)&lt;BR /&gt;{&lt;BR /&gt;responseText = responseText.trim().replace('\uFEFF', '');&lt;BR /&gt;AuthrorizeNetTransactionResponse jsonResponse = new AuthrorizeNetTransactionResponse();&lt;BR /&gt;jsonResponse = AuthrorizeNetTransactionResponse.parse(responseText);&lt;/P&gt;&lt;P&gt;System.debug('**********jsonResponse************'+jsonResponse);&lt;BR /&gt;system.debug('AuthoObj'+authoObj);&lt;BR /&gt;authoObj.JSON_response__c=responseText;&lt;BR /&gt;authoObj.Transaction_Id__c=jsonResponse.transactionResponse.transId;&lt;BR /&gt;rCodeChar= jsonResponse.transactionResponse.responseCode;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are getting an error null pointer on the below&amp;nbsp; line&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;authoObj.Transaction_Id__c=jsonResponse.transactionResponse.transId;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;rCodeChar= jsonResponse.transactionResponse.responseCode;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which means the response is getting&lt;/P&gt;&lt;P&gt;can somebody explain to me why this error is coming&lt;/P&gt;&lt;P&gt;and why jsonResponse.transactionResponse.transId; is geetting null value ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 25 May 2021 10:36:05 GMT</pubDate>
    <dc:creator>Shubham</dc:creator>
    <dc:date>2021-05-25T10:36:05Z</dc:date>
    <item>
      <title>Null Pinter Exception is coming in response</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Null-Pinter-Exception-is-coming-in-response/m-p/76453#M47759</link>
      <description>&lt;P&gt;User is getting an error while the transaction we have checked in our internal code there is an error in HTTP response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is the code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Http h = new Http();&lt;BR /&gt;HttpRequest req = new HttpRequest();&lt;BR /&gt;req.setMethod('POST');&lt;BR /&gt;system.debug('TestE'+auto.endPoint__c);&lt;/P&gt;&lt;P&gt;req.setEndpoint(auto.endPoint__c);&lt;BR /&gt;req.setHeader('Content-Type','application/json');//Set the Proper Header&lt;BR /&gt;req.setHeader('Accept','application/json');&lt;BR /&gt;system.debug('Test');&lt;/P&gt;&lt;P&gt;req.setBody(generateJSON());//JSON body as String&lt;/P&gt;&lt;P&gt;system.debug('Test');&lt;BR /&gt;HttpResponse res=new HttpResponse();&lt;BR /&gt;system.debug('Status 1'+req);&lt;BR /&gt;res=h.send(req);&lt;BR /&gt;system.debug('Resonpse**********'+res);&lt;/P&gt;&lt;P&gt;system.debug('Test1');&lt;/P&gt;&lt;P&gt;if(res.getStatusCode() == 200)&lt;BR /&gt;{&lt;BR /&gt;system.debug('Status'+res.getStatusCode());&lt;BR /&gt;String responseText = res.getBody();&lt;BR /&gt;JsonResponce=res.getBody();&lt;BR /&gt;system.debug('res.getBody() '+res.getBody());&lt;BR /&gt;if(responseText != null)&lt;BR /&gt;{&lt;BR /&gt;responseText = responseText.trim().replace('\uFEFF', '');&lt;BR /&gt;AuthrorizeNetTransactionResponse jsonResponse = new AuthrorizeNetTransactionResponse();&lt;BR /&gt;jsonResponse = AuthrorizeNetTransactionResponse.parse(responseText);&lt;/P&gt;&lt;P&gt;System.debug('**********jsonResponse************'+jsonResponse);&lt;BR /&gt;system.debug('AuthoObj'+authoObj);&lt;BR /&gt;authoObj.JSON_response__c=responseText;&lt;BR /&gt;authoObj.Transaction_Id__c=jsonResponse.transactionResponse.transId;&lt;BR /&gt;rCodeChar= jsonResponse.transactionResponse.responseCode;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are getting an error null pointer on the below&amp;nbsp; line&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;authoObj.Transaction_Id__c=jsonResponse.transactionResponse.transId;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;rCodeChar= jsonResponse.transactionResponse.responseCode;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which means the response is getting&lt;/P&gt;&lt;P&gt;can somebody explain to me why this error is coming&lt;/P&gt;&lt;P&gt;and why jsonResponse.transactionResponse.transId; is geetting null value ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 10:36:05 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Null-Pinter-Exception-is-coming-in-response/m-p/76453#M47759</guid>
      <dc:creator>Shubham</dc:creator>
      <dc:date>2021-05-25T10:36:05Z</dc:date>
    </item>
  </channel>
</rss>

