+ Start a Discussion
Terry PostTerry Post 

Data Integration Specialist Superbadge - Step 7

Step 7 - Synchronize Salesforce project data with Square Peg's external billing system

I'm getting an error message when triggering the SOAP call from the UI via record update:

System.CalloutException: IO Exception: External server did not return any content

When I import the WSDL into SOAP UI and send the same package body, I receive this message:
HTTP/1.1 500 
Server: Cowboy
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 10 Jul 2017 17:58:08 GMT
Via: 1.1 vegur
Proxy-Connection: Keep-Alive
Connection: Keep-Alive

{"timestamp":1499709488068,"status":500,"error":"Internal Server Error","exception":"java.lang.OutOfMemoryError","message":"unable to create new native thread","path":"/ws"}

Does this mean that the herokuapp needs to be restarted or something? I've found a couple of posts with sample code for this challenge and with a few small differences, mine matches from what I can tell. Here's the code I'm using:

ProjectTrigger
trigger ProjectTrigger on Project__c (after update) {
    //Call the Billing Service callout logic here

    if (trigger.isAfter && trigger.isUpdate) {
        BillingCalloutService.callBillingService(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap);
    }

}

BillingCalloutService
public class BillingCalloutService {
    //Implement business and callout logic methods here
    public static void callBillingService(List<Project__c> newList, Map<Id, Project__c> newMap,
            List<Project__c> oldList, Map<Id, Project__c> oldMap) {

        if(!newList.isEmpty()) {
            Project__c project = newList[0];
            if (project.Status__c == 'Billable' && oldMap.get(project.Id).Status__c != 'Billable') {
                // Get Service Credentials from custom settings
                ServiceCredentials__c credentials = ServiceCredentials__c.getInstance('BillingServiceCredential');
                billProject(project.ProjectRef__c, project.Billable_Amount__c, credentials.Username__c, credentials.Password__c);
            }
        }
    }

    @Future(callout=true)
    private static void billProject(String projectRef, Decimal billAmount, String username, String password) {

        BillingServiceProxy.project project = new BillingServiceProxy.project();
        project.projectRef = projectRef;
        project.billAmount = billAmount;
        project.username = username;
        project.password = password;

        BillingServiceProxy.InvoicesPortSoap11 invoiceCall = new BillingServiceProxy.InvoicesPortSoap11();
        // Make the callout and update the Status if callout is successful
        String response = invoiceCall.billProject(project);

        List<Project__c> projects = new List<Project__c>();
        if(response != null && response.equalsIgnoreCase('OK')) {

            projects = [
                    Select Id, Status__c
                    From Project__c
                    Where ProjectRef__c = :projectRef
            ];
            if(!projects.isEmpty()) {
                projects[0].Status__c = 'Billed';
                update projects;
            }
        }

    }
}

BillingServiceProxy
//Generated by wsdl2apex

public class BillingServiceProxy {
    public class billProjectRequest_element {
        public BillingServiceProxy.project project;
        private String[] project_type_info = new String[]{'project','http://salesforce.com/th/invoice-web-service',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://salesforce.com/th/invoice-web-service','true','false'};
        private String[] field_order_type_info = new String[]{'project'};
    }
    public class project {
        public String username;
        public String password;
        public String projectRef;
        public Double billAmount;
        private String[] username_type_info = new String[]{'username','http://salesforce.com/th/invoice-web-service',null,'1','1','false'};
        private String[] password_type_info = new String[]{'password','http://salesforce.com/th/invoice-web-service',null,'1','1','false'};
        private String[] projectRef_type_info = new String[]{'projectRef','http://salesforce.com/th/invoice-web-service',null,'1','1','false'};
        private String[] billAmount_type_info = new String[]{'billAmount','http://salesforce.com/th/invoice-web-service',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://salesforce.com/th/invoice-web-service','true','false'};
        private String[] field_order_type_info = new String[]{'username','password','projectRef','billAmount'};
    }
    public class billProjectResponse_element {
        public String status;
        private String[] status_type_info = new String[]{'status','http://salesforce.com/th/invoice-web-service',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://salesforce.com/th/invoice-web-service','true','false'};
        private String[] field_order_type_info = new String[]{'status'};
    }
    public class InvoicesPortSoap11 {
        public String endpoint_x = 'http://sb-integration-bs.herokuapp.com:80/ws';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'http://salesforce.com/th/invoice-web-service', 'BillingServiceProxy'};
        public String billProject(BillingServiceProxy.project project) {
            BillingServiceProxy.billProjectRequest_element request_x = new BillingServiceProxy.billProjectRequest_element();
            request_x.project = project;
            BillingServiceProxy.billProjectResponse_element response_x;
            Map<String, BillingServiceProxy.billProjectResponse_element> response_map_x = new Map<String, BillingServiceProxy.billProjectResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              '',
              'http://salesforce.com/th/invoice-web-service',
              'billProjectRequest',
              'http://salesforce.com/th/invoice-web-service',
              'billProjectResponse',
              'BillingServiceProxy.billProjectResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.status;
        }
    }
}

Any ideas what I'm doing wrong here? Any assistance would be most appreciated!

Thanks!



 
Best Answer chosen by Terry Post
Madison Rawles 2Madison Rawles 2
Just wanted to let you know that I tried to complete step 7 today without making any changes and it worked, so it was likely their end.

All Answers

Madison Rawles 2Madison Rawles 2
I was just about to post the exact same problem.  When I visit the URLs in the WSDL (http://salesforce.com/th/invoice-web-service and http://sb-integration-bs.herokuapp.com:80/ws) I get a 404 for the former and a blank page for the latter. Visiting http://sb-integration-bs.herokuapp.com gives a 404.  I'm thinking/hoping it's an issue on their end.  My code looks like yours too.  Replying so I can get an answer as well.
Madison Rawles 2Madison Rawles 2
Just wanted to let you know that I tried to complete step 7 today without making any changes and it worked, so it was likely their end.
This was selected as the best answer
Terry PostTerry Post
Agreed. It is working for me today as well. Thanks!
vasudeva gorakativasudeva gorakati
I'm getting an error message when triggering the SOAP call from the UI via record update:

System.CalloutException: IO Exception: External server did not return any content. My code looks fine
Dima KryvyiDima Kryvyi
Facing the same issue with item #7, looks like endpoint is down again..?
"There was an unexpected error in your org which is preventing this assessment check from completing: System.CalloutException: IO Exception: External server did not return any content" ... 
Melissa RainboldtMelissa Rainboldt
I'm getting the following error: The SOAP call to the BillingService did not return the correct response. Please check your configurations and code.
Robert MéndezRobert Méndez
@Melissa Rainboldt
i am getting the same error even though my process works. I get an "ok" status as the response for the SOAP call. Were you able to solve this?
Angela Benavides 11Angela Benavides 11
I'm stuck in the same problem. I don't know what this means.

Error: "The SOAP call to the BillingService did not return the correct response. Please check your configurations and code."
Saksham MahendruSaksham Mahendru
Hi @Anglea, I am also stuck on the same error. I have also tried putting a question on StackExchange also. No luck.
PujaraneePPujaraneeP
Hi All,

same issue, no luck yet
Test call out gives this response:
{response_x=billProjectResponse_element:[apex_schema_type_info=(http://salesforce.com/th/invoice-web-service, true, false), field_order_type_info=(status), status=ok, status_type_info=(status, http://salesforce.com/th/invoice-web-service, null, 1, 1, false)]}
Raja Paul 11Raja Paul 11

Hi,

I too having the same error !!!

Raising a case with SF

Angela Benavides 11Angela Benavides 11
@Robert Mendez did it too, I tried to add a new comment there to show them that I got an "ok" calling the service using SOAP UI but my comment was deleted and the post was put on hold.

https://salesforce.stackexchange.com/questions/229094/data-integration-specialist-challenge-7-not-completing

I checked the configurations, all my test run correctly and the service answers "ok" when called using SOAP UI. I don't know where else to search.
Avi Rai 8Avi Rai 8
I am also having the same error.
Is it a problem with trailhead?
PujaraneePPujaraneeP
getting the below response now

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><ns2:billProjectResponse xmlns:ns2="http://salesforce.com/th/invoice-web-service"><ns2:status>unauthorized</ns2:status></ns2:billProjectResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

Raised a case, hope they would respond soon.

@trailhead
yasin khan 12yasin khan 12
Me too having a same error. 
Any updates from SF for raised SF case?
 
PujaraneePPujaraneeP
not as of now, just the acknowledgement email
d@vidSFd@vidSF
Thank you PujaraneeP, same error here!!!

I get unauthorized responde when i don't send billAmount or credentials. It doesn't matter  if i set ProjectRef in request or not.
On the other hand, a new version of wsdl was generated from last months to now.  In the current soap service you can see ProjectId variable instead of Project Ref. Not sure how trailhead validates our development, and if even is trying to set older projectRef instead of ProjectId in their tests. Anyway, im setting projectRef__c on ProjectId attribute but still getting errors.

By the way, right now i received a different response from yesterday. Now im not receiving ok or unauthorized . In all cases i receive
"EXCEPTION: System.CalloutException: IO Exception: External server did not return any content" Not sure if salesforce is working in this error.
Let us know any news about the case. 

Thanks in advance!!
Angela Benavides 11Angela Benavides 11
Until yesterday I got a status "ok" when I call the service using SOAP UI:

OK Response

But today I'm getting a different error message with the same test:
{"timestamp":1534866652212,"status":500,"error":"Internal Server Error","exception":"java.lang.OutOfMemoryError","message":"unable to create new native thread","path":"/ws"}

Internal Server Error Response

In the trailhead challenge, I keep getting the same error: "The SOAP call to the BillingService did not return the correct response. Please check your configurations and code."
ravilravil
All,

Even i am getting the same error, stuck @ Step# 7 for the past 3 days.

Data Integration Superbadge - Step 7 issue
Pascal tagPascal tag
Using SOAP UI, I get the same error as Angela.
The only way to get an XML answer is entering incorrect credentials or removing Billing markup in the request...
Pascal tagPascal tag
Wow, just after posting, I have rerun the same request with SOAP :

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header/>
   <SOAP-ENV:Body>
      <ns2:billProjectResponse xmlns:ns2="http://salesforce.com/th/invoice-web-service">
         <ns2:status>ok</ns2:status>
      </ns2:billProjectResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
ravilravil
@pascal tag - Can you please help me closing this issue, i am still struggling to close this.


 
d@vidSFd@vidSF
Thanks Pascal, now im receiving ok as well!!!! from Workbench. But still same error in trailhead. 
Did you  already pass successfully step 7? 
PujaraneePPujaraneeP
The challenge is still not completing because the check is using the same credentials to verify the callout and the response.  Assistance from salesforce trailhead is required here. Case raised case #00009760.
Avi Rai 8Avi Rai 8
Does anybody solve it on @trailhead?
Pascal tagPascal tag
For now, SOAP web service works.
My code seems to work correctly too as status is changing to Billed. But Trailhead check keep on displaying :
The SOAP call to the BillingService did not return the correct response. Please check your configurations and code.

I have double checked requirements and tried several ways of writing my code but even if it's working, validation fails :-(
@Pujaranee : thanks for raising a case !
To me this sounds like a Trailhead issue

When checking requirements, I paid attention to the bold words :
Status - Billable
ProjectTrigger - ProjectRef - Amount
BillingCalloutService - callBillingService - BillingServiceProxy


Business logic should not be included in Trigger and from trailhead checker (is it trustfull enough ?), old and new collection must be passed.
So I guess trigger should include something like BillingCalloutService.callBillingService(Trigger.old, Trigger.new);
But doing so means we can't add the "@future" annotation (as it doesn't accept list of objects) so we need a helper.
What I'm wondering is where to use ProjectRef - Amount ?
As they are bold written, they may be used in a method signature. There are 2 choices :
1. callBillingService > but this means filtering only project with changing status to Billable should be done in the trigger (which doesn't match with "No business logic in trigger"). I tried it anyway but get the same results
2. Helper method of callBillingService > Retrieving credentials from this helper method or inside callBillingService ends with same results

Only other differences I see is :
- WSDL has changed since last year (ProjectRef replaced by ProjectId) > using the former one or latest one doesn't change anything too.
- Amount field is a Decimal type in Project__c object whereas Double type is expected. Casting type has no effect too.

I tryed using the code of the first post of this trail (Terry) but it doens't work too. From what he said, he did nothing but retrying once Trailhead was corrected. It seems the last thing left to do...

@Ravil / David : Besides a good check, does your code actually work ? I mean, when you change the status of a project to Billable, does it change to Billed after a few seconds ?
Dennis PereverzevDennis Pereverzev
I have same problem. @Pascal tag, yes in my code project status changed after a fews secs.
d@vidSFd@vidSF
Yes Pascal,my code is working perfectly. I receive ok status from the service in my @future callout and finally project status is properly updated. 
I tried a lot of things, paying atention to tralihead requirements. Even I bulkified the trigger to make callouts for many projects, and finally update projects with ok response. Obviusly here we can reach some limits executing a request per project but anyway,  for three projects test, bulk friendly code is working perfectly, and trailhead is getting same error:  The SOAP call to the BillingService did not return the correct response. Please check your configurations and code.
Angela Benavides 15Angela Benavides 15
I've also raised a case in trailhead last week, Case 00009153, but still no answer from them.

Like you mentioned, I'm also receiving an "ok" response using SOAP UI, but the challenge in trailhead still doesn't work. Still getting "The SOAP call to the BillingService did not return the correct response. Please check your configurations and code."
ravilravil
@Pascal tag,

Yes with in few seconds, project status is changed from Billing to Billed, hence no issues in Coding and Configurations.
 
Harsha KhiroyaHarsha Khiroya
I am facing the same issue. My code is working fine ie. when I change status to billable it changes to billed after few seconds, and I getting 'ok' in postman too. It's difficult to know exactly what is the issue.
Rajavardhan Shontireddy 14Rajavardhan Shontireddy 14
HI Team,

I am also facing same issue in trailhead.
my code is working fine but some how trailhead is checking incorrectly
Challenge Not yet complete... here's what's wrong: 
The SOAP call to the BillingService did not return the correct response. Please check your configurations and code
yasin khan 9yasin khan 9
@PujaraneeP - Yes even I have raised the case but no response from SF yet. Also tried validationg the challenge for blank class BillingServiceProxy but still getting the below error.

Challenge Not yet complete... here's what's wrong: 
The SOAP call to the BillingService did not return the correct response. Please check your configurations and code
Raju KrishnamoorthyRaju Krishnamoorthy
I am the latest one running into this error.  Unable to complete the challenge in trailhead, the step 7.  hoping Trailhead folks clears it soon.
Vaishali Patil 27Vaishali Patil 27
I am also facing the same issue since last 4 days.
VPROKVPROK
Struggling with this for 4 days now as well. THe SOAP response has "OK" now, but the invoice is not being created in the external system. I'm pretty sure that there is something on their side. Did you guys tried if the invoice is created for you?
Pascal tagPascal tag
Hi Vprok, I didn't think trying this. Indeed, I have checked now. Although we get an OK status, nothing seems created. I connected to this external objects and run a report against it > the latest invoices were created in April 2017 !
It doesn't look like we can really create invoices in the system (it contains some old test data > maybe creating data was possible before ?)
Rajavardhan Shontireddy 14Rajavardhan Shontireddy 14
@Pascal tag 
could you please eloborate further?
VPROKVPROK
It feels like there is just not enough memory to create an invoice. Would be great to know what exactly trailhead checks. I think it actually checks if invoice was created + the status of a project. Mb somebody from trailhead team can give us more info. But I do believe, that this service should have two checks: 1) current org(my trailplayground) 2) System org that should work as expected. Trailblazers should get the message that the service is down or not working properly. I have lost much more time debugging this than full badge took me. That is VERY, VERY frustrating.
Andrea CatalanoAndrea Catalano
Hi,
   today I was able to overcome the issue knowing that previously there project input class had the projectref field instead that the projectid field.
Basically, on the BillingServiceProxy I changed the project class as follows:
public class project {
        public String username;
        public String password;
        public String projectid;
        public String projectRef;
        public Double billAmount;
        private String[] username_type_info = new String[]{'username','http://salesforce.com/th/invoice-web-service',null,'1','1','false'};
        private String[] password_type_info = new String[]{'password','http://salesforce.com/th/invoice-web-service',null,'1','1','false'};
        private String[] projectid_type_info = new String[]{'projectid','http://salesforce.com/th/invoice-web-service',null,'1','1','false'};
        private String[] projectRef_type_info = new String[]{'projectRef','http://salesforce.com/th/invoice-web-service',null,'1','1','false'};
        private String[] billAmount_type_info = new String[]{'billAmount','http://salesforce.com/th/invoice-web-service',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://salesforce.com/th/invoice-web-service','true','false'};
        private String[] field_order_type_info = new String[]{'username','password','projectRef','projectid','billAmount'};
    }

Then I maintained the old input and gave a value to the new input field on the BillingCalloutService class:
project.projectid =  projectRef == '' ? ' ' : projectRef;
project.projectRef =  projectRef == '' ? ' ' : projectRef;
So, now let's go with the 8th challenge!
 
Andrea CatalanoAndrea Catalano
@hugo incredible we reached the same solution at the same time!
Hugo van KrimpenHugo van Krimpen
@Andrea I know right! I was so happy I found the solution and to share it with everyone, only to find out you posted the solution 30seconds before me haha. Deleted my post to keep things clean.
Pascal tagPascal tag
Congratulations Hugo & Andrea !!!
I have tried projectid, then projectRef (knowing it was the legacy WSDL) but didn't think about mixing both !!!
You removed tons of frustration. Thanks a lot !

I will copy this answer and copyright you on the dedicated trail I opened for this.
d@vidSFd@vidSF
Thank you Hugo& Andrea. 
I never could find this workaround by myself. I hope  salesforce fix this bug in order avoid our colleagues spent long time with this kind of issues.
Regards
Angela Benavides 15Angela Benavides 15
Thanks, @Andrea Catalano and @Hugo van Krimpen! You are the best!!
That definitely solved the problem and I finally got the challenge # 7 to work. 
Jonathan Meltzer 14Jonathan Meltzer 14
This community is awesome.  Thank you so much for helping me to work around the headache of the obscure error message. :)
ravilravil
All - This is great help, i was able to complete it. Appreciate it. Thanks.
yasin khan 9yasin khan 9
Thank you Andrea & Hugo... You are the best!!
Leandro TidemanLeandro Tideman
Thank you Andrea Catalano & Hugo van Krimpen!
I was blocked with same error: "The SOAP call to the BillingService did not return the correct response. Please check your configurations and code".
ID~747ID~747

Facing the same issue...

User-added image
Can anyone help me out?
 

sh hasansh hasan

Challenge Not yet complete... here's what's wrong: 
The SOAP call to the BillingService did not return the correct response. Please check your configurations and code.

 I am getting this error...where the response is giving 'OK'. 
I also checked with SOAPUI and getting 'OK' response. User-added image

Any ideas folks please?
Thanks 
Christopher Thaxter 4Christopher Thaxter 4

To those still looking for the "did not return the correct response" solution (last two commenters and anyone else), see Andrea's comment above. Or check out my detailed steps of her resolution, here:

https://developer.salesforce.com/forums/?id=9060G0000005m6rQAA

Nagarjuna ParalaNagarjuna Parala
Thank you@Andrea Catalano. After a huge battle everything working fine..
 
Nagarjuna ParalaNagarjuna Parala
BillingServiceProxy
//Generated by wsdl2apex

public class BillingServiceProxy {
    public class billProjectRequest_element {
        public BillingServiceProxy.project project;
        private String[] project_type_info = new String[]{'project','http://salesforce.com/th/invoice-web-service',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://salesforce.com/th/invoice-web-service','true','false'};
        private String[] field_order_type_info = new String[]{'project'};
    }
    public class project {
        public String username;
        public String password;
        public String projectid;
        public String projectRef;
        public Double billAmount;
        private String[] username_type_info = new String[]{'username','http://salesforce.com/th/invoice-web-service',null,'1','1','false'};
        private String[] password_type_info = new String[]{'password','http://salesforce.com/th/invoice-web-service',null,'1','1','false'};
        private String[] projectid_type_info = new String[]{'projectid','http://salesforce.com/th/invoice-web-service',null,'1','1','false'};
        private String[] projectRef_type_info = new String[]{'projectRef','http://salesforce.com/th/invoice-web-service',null,'1','1','false'};
        private String[] billAmount_type_info = new String[]{'billAmount','http://salesforce.com/th/invoice-web-service',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://salesforce.com/th/invoice-web-service','true','false'};
        private String[] field_order_type_info = new String[]{'username','password','projectRef','projectid','billAmount'};
    }
    public class billProjectResponse_element {
        public String status;
        private String[] status_type_info = new String[]{'status','http://salesforce.com/th/invoice-web-service',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://salesforce.com/th/invoice-web-service','true','false'};
        private String[] field_order_type_info = new String[]{'status'};
    }
    public class InvoicesPortSoap11 {
        public String endpoint_x = 'http://sb-integration-bs.herokuapp.com:80/ws';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'http://salesforce.com/th/invoice-web-service', 'BillingServiceProxy'};
        public String billProject(BillingServiceProxy.project project) {
            BillingServiceProxy.billProjectRequest_element request_x = new BillingServiceProxy.billProjectRequest_element();
            request_x.project = project;
            BillingServiceProxy.billProjectResponse_element response_x;
            Map<String, BillingServiceProxy.billProjectResponse_element> response_map_x = new Map<String, BillingServiceProxy.billProjectResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              '',
              'http://salesforce.com/th/invoice-web-service',
              'billProjectRequest',
              'http://salesforce.com/th/invoice-web-service',
              'billProjectResponse',
              'BillingServiceProxy.billProjectResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.status;
        }
    }
}
Luke ChenLuke Chen
Big thanks to @Andrea Catalano and @Hugo van Krimpen! You are the best!!
I kept getting the same error until seeing your solution. Now I can move to Item #8.
PratapSFDCPratapSFDC
thank you so much @Andrea Catalano. from last 7 days have stucked on this challege.  thanks again.
ajay sikhwalajay sikhwal
HI All I am facing Below issue while checking for challenge 7 Synchronize Salesforce project data with Square Peg's external billing system
for Superbadge
Data Integration Specialist
Error
Challenge Not yet complete... here's what's wrong: 
The SOAP call to the BillingService did not return the correct response. Please check your configurations and code.
Close errors
7
Can someone please help ??
Angela Benavides 23Angela Benavides 23
@AjaySikhwal, Did you try making the changes proposed by @Andrea Catalano and @Hugo van Krimpen? You should check the previous post, that helped me solving my issue and passing the challenge.