2
I was able to generate the (java) client in Eclipse, available in WSDL https://www3.bcb.gov.br/sgspub/JSP/sgsgeral/FachadaWSSGS.wsdl.
The following classes were generated:
package br.gov.bcb.pec.sgs.casosdeuso.ws.comum;
WSValorSerieVO
WSSerieVO
package br.gov.bcb.www3.wssgs.services.FachadaWSSGS
interface FachadaWSSGS
interface FachadaWSSGSService
classe FachadaWSSGSServiceLocator
classe FachadaWSSGSProxy
classe FachadaWSSGSSoapBindingStub
My question now is how to instantiate these classes and use the service.
My goal is to get the dollar quote on a specific date dd-mm-aaaa
Someone can give a boost?
I think it would be something close to:
public class main {
public static void main(String[] args) throws ServiceException {
FachadaWSSGSProxy proxy = new FachadaWSSGSProxy();
FachadaWSSGSServiceLocator service = new FachadaWSSGSServiceLocator();
FachadaWSSGSSoapBindingStub stub = (FachadaWSSGSSoapBindingStub) service.getPort(proxy.getEndpoint(),FachadaWSSGSService.class );
try {
System.out.println(stub.getValor (1,"24/01/2017").toString());
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
But this doesn’t work.
Hello Itamar, post more details about your problem. You generated the Java code how? Eclipse allows generating clients in the wsimport standard / JAX-RS (wsimport), Axis Standard (Wsdl2java ), etc. The call you are looking for is
getValor
within0
= 1 (Exchange rate series code) andin1
= date in formatdd/MM/aaaa
– Anthony Accioly
For more details about the WSSGS see help page
– Anthony Accioly
Dear Anthony, I managed the client on the Apache Axis and Client Type = Java Proxy standard. My question is how to instantiate the Service and Stub to be able to use the getValor method.
– Itamar Ribeiro
What exactly didn’t work? Edit the question and paste the stack trace of the error.
– Anthony Accioly
In the can not even run, because the excerpt of code posted above, was just an example of how I imagine the instantiation of classes, but I have no idea the correct way to do.
– Itamar Ribeiro
Itamar, I’m not realizing the problem... Unfortunately there is one more way to use the customer correctly. Are you afraid to run your code (if it goes wrong nothing bad will happen)? Or are you looking for examples to compare to your version? Follows a trivial example using Proxy and another using Locator.
– Anthony Accioly