Jump to content
General

Httpweb request

Recommended Posts

General

Bom dia tenho seguinte código em java e quero desenvolver para c# alguém já fez algo semelhante?

O código é o seguinte:

private boolean addRequestParametersToWebservice(SubmitWebserviceRequest submitRequest)
  {
    addParameter("systemName", "taxUser");
    addParameter("systemPass", Password.encryptWithPaddingLength("y5jeC$maQe"));

    addParameter("decl", submitRequest.getDeclaracaoToRequest());
    addParameter("declVersion", submitRequest.getDeclVersion());
    if (submitRequest.hasAppVersion()) addParameter("app_version", submitRequest.getAppVersion());

    addParameter("checkwarnings", String.valueOf(submitRequest.isCheckWarnings()));

    for (Iterator iter = submitRequest.getUsers().iterator(); iter.hasNext(); ) {
      SubmitUser submitUser = (SubmitUser)iter.next();

      if (submitUser.getId().equals("SPA")) {
        addParameter("nifA", submitUser.getNif());
        addParameter("passwordA", submitUser.getPassword());
      } else if (submitUser.getId().equals("SPB")) {
        addParameter("nifB", submitUser.getNif());
        addParameter("passwordB", submitUser.getPassword());
      } else if (submitUser.getId().equals("TOC")) {
        addParameter("nifTOC", submitUser.getNif());
        addParameter("passwordTOC", submitUser.getPassword());

        addParameter("toc", submitUser.getNif());
        addParameter("passwordToc", submitUser.getPassword());
      }
    }

    for (Iterator iter = submitRequest.getOptionalFields().iterator(); iter.hasNext(); ) {
      Pair optionalField = (Pair)iter.next();
      addParameter((String)optionalField.getFirst(), (String)optionalField.getSecond());
    }

    return true;
  }

A outra dúvida é:
Não tendo wsdl para o webservice: https://www.portaldasfinancas.gov.pt/pt/externalws/oadmrsv/entregarDMROffline.action

Há outra forma de identificar os parâmetros?

Obrigado

  • Vote 1

Share this post


Link to post
Share on other sites
Hugo Esteves

Estou com o mesmo problema, mas estou desenvolver em Node. 

Chegou a perceber como fazer? 

Endpoints etc?

Obrigado desde já

 

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.