How to use webservice in cyclos 3.7.1
Posted: Mon Dec 10, 2012 8:10 am
Hi!
I am new to cyclos system. I have spent some time getting familiar with Cyclos system on local server.
I have now installed a cyclos onto my laptop and it is running without any problem. But when I am trying to connect to cyclos web service I am getting Server error: unauthorized-access.
Thanks in advance for your help to solve this. It would be great if someone tells me the steps needed to configure and connect to web service.
The code I have written as client are as follows:
CyclosWebServicesClientFactory factory = new CyclosWebServicesClientFactory();
factory.setServerRootUrl("http://192.168.1.114:8080/cyclos");
PaymentWebService paymentWebService = factory.getPaymentWebService();
//AdWebService adWebService = factory.getAdWebService();
//AdCategoryVO []categories=adWebService.listCategories();
//System.out.println(categories);
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
PaymentParameters params = new PaymentParameters();
// Prompt the parameters
System.out.print("Amount: ");
params.setAmount(new BigDecimal(in.readLine()));
System.out.print("Login name: "); //This user should have the channel set as enabled
params.setFromMember(in.readLine());
System.out.print("PIN: ");
//params.setCredentials(in.readLine());
// Perform the payment
PaymentResult result = paymentWebService.doPayment(params);
System.out.println(result);
I am getting the following error:
Dec 10, 2012 5:16:35 PM org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
INFO: Creating Service {http://payments.webservices.cyclos.stro ... iceService from class nl.strohalm.cyclos.webservices.payments.PaymentWebService
Amount: 500
Login name: mamun
PIN: 2131
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Server error: unauthorized-access
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:156)
at $Proxy38.doPayment(Unknown Source)
at nl.strohalm.cyclos.webservices.client.CyclosWebClient.main(CyclosWebClient.java:44)
Caused by: org.apache.cxf.binding.soap.SoapFault: Server error: unauthorized-access
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:75)
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:46)
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:35)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:113)
at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69)
at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:798)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1667)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1520)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1428)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:658)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:532)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:464)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:367)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:320)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:89)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
... 2 more
Please let me know if anything is missing while configuring web service clients or the documentation in wiki need to be changed for 3.7.1.
Thanks.
I am new to cyclos system. I have spent some time getting familiar with Cyclos system on local server.
I have now installed a cyclos onto my laptop and it is running without any problem. But when I am trying to connect to cyclos web service I am getting Server error: unauthorized-access.
Thanks in advance for your help to solve this. It would be great if someone tells me the steps needed to configure and connect to web service.
The code I have written as client are as follows:
CyclosWebServicesClientFactory factory = new CyclosWebServicesClientFactory();
factory.setServerRootUrl("http://192.168.1.114:8080/cyclos");
PaymentWebService paymentWebService = factory.getPaymentWebService();
//AdWebService adWebService = factory.getAdWebService();
//AdCategoryVO []categories=adWebService.listCategories();
//System.out.println(categories);
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
PaymentParameters params = new PaymentParameters();
// Prompt the parameters
System.out.print("Amount: ");
params.setAmount(new BigDecimal(in.readLine()));
System.out.print("Login name: "); //This user should have the channel set as enabled
params.setFromMember(in.readLine());
System.out.print("PIN: ");
//params.setCredentials(in.readLine());
// Perform the payment
PaymentResult result = paymentWebService.doPayment(params);
System.out.println(result);
I am getting the following error:
Dec 10, 2012 5:16:35 PM org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
INFO: Creating Service {http://payments.webservices.cyclos.stro ... iceService from class nl.strohalm.cyclos.webservices.payments.PaymentWebService
Amount: 500
Login name: mamun
PIN: 2131
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Server error: unauthorized-access
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:156)
at $Proxy38.doPayment(Unknown Source)
at nl.strohalm.cyclos.webservices.client.CyclosWebClient.main(CyclosWebClient.java:44)
Caused by: org.apache.cxf.binding.soap.SoapFault: Server error: unauthorized-access
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:75)
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:46)
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:35)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:113)
at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69)
at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:798)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1667)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1520)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1428)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:658)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:532)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:464)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:367)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:320)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:89)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
... 2 more
Please let me know if anything is missing while configuring web service clients or the documentation in wiki need to be changed for 3.7.1.
Thanks.