0
votes

I have some problem on a WCF proxy class (not sure if it's the proxy or the service class), here is the context:

I have a WCF service that I consume on a web application, this service calls another service and then process the response to take it back to the web app. Here is the construction of that method

        public CreateProjectResponse CreateNewProject(List<CreateProjectRequestProject> projects)
    {
        ServiceHelper helper = new ServiceHelper();
        CreateProjectResponse response = helper.CreateNewProject(projects);
        return response;
    }

Everything is just fine up to the response object assignation. I have my correct list of "CreateProjectResponseProject" objects. The problem is that after the return statement I see that the service class is creating a NEW set of "CreateProjectResponseProject" objects as if it's calling the constructor again and assigning the default values (null in this case).

Does anyone have an idea what can be happening? I have been researching and don't seem to find any related solution. BTW... this process was working before, nothing have changed on the solution. Hope someone can help. Thanks!

EDIT: Here is the code for the helper class:

 public class ServiceHelper
{

    public CreateProjectResponse CreateNewProject(List<CreateProjectRequestProject> projects)
    {
        CreateProjectRequest request = new CreateProjectRequest();
        CreateProjectResponse response = new CreateProjectResponse();
        ProjectCreator create = new ProjectCreator();
        WebServiceConfig configs = new WebServiceConfig();

        request.Projects = projects;

        configs.Password = "XXXXXXX";
        configs.Username = "USER";
        configs.RemoteAddress = "https://server/listener/connector";
        configs.EndpoingConfig = "CreateProjectEndpoint";

        try
        {
            response = create.CreateProject(configs, request);
        }
        catch (Exception ex)
        {
            string messageError = "unable to create project:" + ex.Message.ToString();
        }
        return response;
    }

}
1
"this process was working before, nothing have changed on solution" - Um, if it's not working now and it was before, then something changed somewhere. However, there's not enough information here to give you good help - at least post the code for ServiceHelper so we can see what's going on, otherwise it's just a guessing game. - Tim
Hi! I didn't put the code for that helper because the response is working ok up to that point.... when I hit the return statement is when the method calls for a NEW instance which is weird because I already had my instances on the "response" object. Either way, I'll edit the question with the requested code. - Fernando Orozco Franco
Turns out that the proxy class was the one making the unexpected things... I'm using directly the helper class from the web site solution and the result is as it should, this is not really an answer for me but the process works well without intermediates. Thanks! - Fernando Orozco Franco

1 Answers

0
votes

I was using the WCF service as an intermediate to communicate to another service, I removed the intermediate and called my helper class directly from the web application (with the proper endpoint config) and everything works fine now.