Bom dia.
Estou tentando consumir um webservice em Soap do Portal Tui.
https://webapp-portaltui-homolog.azurewebsites.net/webservices/portaltui.asmx?WSDL
Preciso chamar o método ObterChave que recebe um xml com 3 parâmetros no header (pw = senha, user = usuario e devToken = token) e 2 parâmetros no body (smatricula = matricula e scodfilial = código da filial).
Usei o > wsimport -keep -verbose url para gerar as classes e estou tentando dessa forma.
URL urlWebservice = new URL(“https://webapp-portaltui-homolog.azurewebsites.net/webservices/portaltui.asmx?WSDL”);
QName qname = new QName("http://tempuri.org/", "WebService_PortalTUISoap"); Service service = Service.create(qname); WebServicePortalTUISoap serviceInterface = service.getPort(WebServicePortalTUISoap.class); Map<String, Object> requestContext = ((BindingProvider)serviceInterface).getRequestContext(); requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "https://webapp-portaltui-homolog.azurewebsites.net/webservices/portaltui.asmx?WSDL"); Map<String, List<String>> requestHeaders = new HashMap<String, List<String>>(); requestHeaders.put("Pw", Collections.singletonList("123")); requestHeaders.put("User", Collections.singletonList("BETTER")); requestHeaders.put("DevToken", Collections.singletonList("c6c045bd22a3c6cc0776b504e3668e74")); requestContext.put(MessageContext.HTTP_REQUEST_HEADERS, requestHeaders);
Mas está gerando esse erro:
Exception in thread “main” javax.xml.ws.WebServiceException: WSDL Metadata not available to create the proxy, either Service instance or ServiceEndpointInterface org.tempuri.WebServicePortalTUISoap should have WSDL information
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:343)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:355)
at javax.xml.ws.Service.getPort(Service.java:188)
at org.main.main(main.java:33)
Alguem pode me ajudar? Sou novo em webservice.