Carlos Bejarano [
https://community.jboss.org/people/cbejarano] created the discussion
"How can I resolve
"org.apache.cxf.service.factory.ServiceConstructionException"?"
To view the discussion, visit:
https://community.jboss.org/message/783338#783338
--------------------------------------------------------------
Hi,
I am using Jboss 6.1.0 Final and Jboss-cxf 3.4.1 GA...
I have problems with my application(this app consume a WS to send SMS), but when I run it,
the console show this:
Here my console output:
[#|Preparing to sms send. Subscriber: 340677]
URL WSDL :::>
http://192.168.164.153:8011/platform/MessagingService?WSDL
http://192.168.164.153:8011/platform/MessagingService?WSDL
-- Enviar SMS a Destino -- 50494540128
Inicializar Servicio :::>
http://192.168.164.153:8011/platform/MessagingService?WSDL
http://192.168.164.153:8011/platform/MessagingService?WSDL
Estado Servicio :::>
hn.com.tigo.corporatesms.negocio.wsclient.MessagingServiceHttpBindingQSService@545eb748
hn.com.tigo.corporatesms.negocio.wsclient.SendMessageTechnicalExceptionMsg:
org.apache.cxf.service.factory.ServiceConstructionException
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:332)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:317)
at javax.xml.ws.Service.getPort(Unknown Source)
at
hn.com.tigo.corporatesms.negocio.wsclient.MessagingServiceHttpBindingQSService.getMessagingServiceHttpBindingQSPort(MessagingServiceHttpBindingQSService.java:61)
at
hn.com.tigo.corporatesms.negocio.wsclient.facade.SendSMSWSClientFacade.sendSMS(SendSMSWSClientFacade.java:79)
at
hn.com.tigo.corporatesms.negocio.wsclient.facade.SendSMSWSClientFacade.sendSMSToMSISDN(SendSMSWSClientFacade.java:136)
at hn.com.tigo.corporatesms.negocio.sms.SendSMS.send(SendSMS.java:120)
at hn.com.tigo.corporatesms.negocio.sms.SendSMS.send(SendSMS.java:98)
at
hn.com.tigo.corporatesms.negocio.motor.tarea.TareaMotor02.sendSubscriberList(TareaMotor02.java:324)
at
hn.com.tigo.corporatesms.negocio.motor.tarea.TareaMotor02.doTask(TareaMotor02.java:256)
at
hn.com.tigo.corporatesms.negocio.motor.tarea.TareaMotor02.ejecutarTarea(TareaMotor02.java:91)
at
hn.com.tigo.corporatesms.negocio.timer.TareaGeneral.run(TareaGeneral.java:132)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:97)
at
org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:117)
at
org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:124)
at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:463)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:330)
... 12 more
Caused by: org.apache.cxf.BusException: No binding factory for namespace
http://schemas.xmlsoap.org/ws/2004/09/policy http://schemas.xmlsoap.org/ws/2004/09/policy
registered.
at
org.apache.cxf.binding.BindingFactoryManagerImpl.getBindingFactory(BindingFactoryManagerImpl.java:120)
at
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:115)
at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:90)
... 16 more
[#|SMS not sended]
and here my client code:
private GeneralResponse sendSMS(MobileMessage pMobileMessage)
throws SendMessageTechnicalExceptionMsg {
try {
System.out.println("Inicializar Servicio :::> "
+ this.urlWSDL);
MessagingServiceHttpBindingQSService servicio = new
MessagingServiceHttpBindingQSService(
new URL(this.urlWSDL));
System.out.println("Estado Servicio :::> " +
servicio);
MessagingService port = servicio
.getMessagingServiceHttpBindingQSPort();
// and this point my code dies
Map<String, Object> ctx = ((BindingProvider) port)
.getRequestContext();
ctx.put("ws-security.username", userName);
ctx.put("ws-security.password", password);
System.out.println("Port :::> " + port);
printXMLRequest(pMobileMessage);
GeneralResponse response =
port.sendMessage(pMobileMessage);
printXMLResponse(response);
return response;
} catch (MalformedURLException ex) {
SendMessageTechnicalExceptionMsg sendEX = new
SendMessageTechnicalExceptionMsg(
ex.getMessage(), ex.getCause());
sendEX.setStackTrace(ex.getStackTrace());
throw sendEX;
} catch (Exception e) {
SendMessageTechnicalExceptionMsg sendEX = new
SendMessageTechnicalExceptionMsg(
e.getMessage(), e.getCause());
sendEX.setStackTrace(e.getStackTrace());
throw sendEX;
}
}
the next code is from MessagingServiceHttpBindingQSService class, where the code explodes
in the method getMessagingServiceHttpBindingQSPort
/*
*
*/
package hn.com.tigo.corporatesms.negocio.wsclient;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
/**
* This class was generated by Apache CXF 2.3.1
* Wed Sep 14 12:03:15 CST 2011
* Generated source version: 2.3.1
*
*/
@WebServiceClient(name = "MessagingServiceHttpBindingQSService",
wsdlLocation = "http://osb.celtel.net:8001/platform/MessagingService?wsdl",
targetNamespace = "http://tigo.hn/platform/messaging")
public class MessagingServiceHttpBindingQSService extends Service {
public final static URL WSDL_LOCATION;
public final static QName SERVICE = new
QName("http://tigo.hn/platform/messaging",
"MessagingServiceHttpBindingQSService");
public final static QName MessagingServiceHttpBindingQSPort = new
QName("http://tigo.hn/platform/messaging",
"MessagingServiceHttpBindingQSPort");
static {
URL url = null;
try {
url = new
URL("http://osb.celtel.net:8001/platform/MessagingService?wsdl");
} catch (MalformedURLException e) {
System.err.println("Can not initialize the default wsdl from
http://osb.celtel.net:8001/platform/MessagingService?wsdl");
// e.printStackTrace();
}
WSDL_LOCATION = url;
}
public MessagingServiceHttpBindingQSService(URL wsdlLocation) {
super(wsdlLocation, SERVICE);
}
public MessagingServiceHttpBindingQSService(URL wsdlLocation, QName serviceName) {
super(wsdlLocation, serviceName);
}
public MessagingServiceHttpBindingQSService() {
super(WSDL_LOCATION, SERVICE);
}
/**
*
* @return
* returns MessagingService
*/
@WebEndpoint(name = "MessagingServiceHttpBindingQSPort")
public MessagingService getMessagingServiceHttpBindingQSPort() {
return super.getPort(MessagingServiceHttpBindingQSPort, MessagingService.class);
//Other point with problems
}
/**
*
* @param features
* A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy.
Supported features not in the <code>features</code> parameter will have their
default values.
* @return
* returns MessagingService
*/
@WebEndpoint(name = "MessagingServiceHttpBindingQSPort")
public MessagingService getMessagingServiceHttpBindingQSPort(WebServiceFeature...
features) {
return super.getPort(MessagingServiceHttpBindingQSPort, MessagingService.class,
features);
}
}
Thanks a lot for your help
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/783338#783338]
Start a new discussion in JBoss AS Documentation at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]