use of org.apache.cxf.service.model.ServiceInfo in project tesb-rt-se by Talend.
the class CXFTestStubs method createEndpointInfoStub.
public static EndpointInfo createEndpointInfoStub(QName serviceName, String endpointName, String transportId) {
EndpointReferenceType epr = createEPR(endpointName);
ServiceInfo serviceInfo = EasyMock.createNiceMock(ServiceInfo.class);
expect(serviceInfo.getName()).andStubReturn(serviceName);
EndpointInfo endpointInfo = EasyMock.createNiceMock(EndpointInfo.class);
expect(endpointInfo.getAddress()).andStubReturn(endpointName);
expect(endpointInfo.getService()).andStubReturn(serviceInfo);
expect(endpointInfo.getTarget()).andStubReturn(epr);
expect(endpointInfo.getTransportId()).andStubReturn(transportId);
EasyMock.replay(serviceInfo, endpointInfo);
return endpointInfo;
}
use of org.apache.cxf.service.model.ServiceInfo in project jbossws-cxf by jbossws.
the class PolicySetsAnnotationListener method addPolicies.
private void addPolicies(AbstractServiceFactoryBean factory, OperationInfo inf, Method m) {
if (m == null) {
return;
}
final Class<?> cls = m.getDeclaringClass();
EndpointPolicyAttachments epa = getEndpointPolicyAttachment(cls);
if (epa != null) {
final ServiceInfo service = inf.getInterface().getService();
for (PolicyAttachment pa : epa.getPolicyAttachments(Placement.PORT_TYPE_OPERATION)) {
addPolicy(inf, service, pa, cls, inf.getName().getLocalPart() + "PortTypeOpPolicy");
}
for (PolicyAttachment pa : epa.getPolicyAttachments(Placement.PORT_TYPE_OPERATION_INPUT)) {
addPolicy(inf.getInput(), service, pa, cls, inf.getName().getLocalPart() + "PortTypeOpInputPolicy");
}
for (PolicyAttachment pa : epa.getPolicyAttachments(Placement.PORT_TYPE_OPERATION_OUTPUT)) {
addPolicy(inf.getOutput(), service, pa, cls, inf.getName().getLocalPart() + "PortTypeOpOutputPolicy");
}
for (PolicyAttachment pa : epa.getPolicyAttachments(Placement.PORT_TYPE_OPERATION_FAULT)) {
for (FaultInfo f : inf.getFaults()) {
addPolicy(f, service, pa, cls, f.getName().getLocalPart() + "PortTypeOpFaultPolicy");
}
}
}
}
use of org.apache.cxf.service.model.ServiceInfo in project jbossws-cxf by jbossws.
the class EndpointImpl method updateSoapAddress.
/**
* For both code-first and wsdl-first scenarios, reset the endpoint address
* so that it is written to the generated wsdl file.
*/
private void updateSoapAddress() {
final SOAPAddressRewriteMetadata metadata = getSOAPAddressRewriteMetadata();
if (metadata.isModifySOAPAddress()) {
// - code-first handling
List<ServiceInfo> sevInfos = getServer().getEndpoint().getService().getServiceInfos();
for (ServiceInfo si : sevInfos) {
Collection<EndpointInfo> epInfos = si.getEndpoints();
for (EndpointInfo ei : epInfos) {
String publishedEndpointUrl = (String) ei.getProperty(WSDLGetUtils.PUBLISHED_ENDPOINT_URL);
if (publishedEndpointUrl != null) {
ei.setAddress(publishedEndpointUrl);
} else {
// - wsdl-first handling
if (ei.getAddress().contains(ServerConfig.UNDEFINED_HOSTNAME)) {
String epurl = SoapAddressRewriteHelper.getRewrittenPublishedEndpointUrl(ei.getAddress(), metadata);
ei.setAddress(epurl);
}
}
}
}
}
}
use of org.apache.cxf.service.model.ServiceInfo in project tomee by apache.
the class StaxDataBinding method initialize.
public void initialize(Service service) {
for (ServiceInfo serviceInfo : service.getServiceInfos()) {
SchemaCollection schemaCollection = serviceInfo.getXmlSchemaCollection();
if (schemaCollection.getXmlSchemas().length > 1) {
// Schemas are already populated.
continue;
}
new ServiceModelVisitor(serviceInfo) {
@Override
public void begin(MessagePartInfo part) {
if (part.getTypeQName() != null || part.getElementQName() != null) {
return;
}
part.setTypeQName(Constants.XSD_ANYTYPE);
}
}.walk();
}
}
use of org.apache.cxf.service.model.ServiceInfo in project tomee by apache.
the class ClientImpl method findEndpoint.
private EndpointInfo findEndpoint(Service svc, QName port) {
if (port != null) {
EndpointInfo epfo = svc.getEndpointInfo(port);
if (epfo == null) {
throw new IllegalArgumentException("The service " + svc.getName() + " does not have an endpoint " + port + ".");
}
return epfo;
}
for (ServiceInfo svcfo : svc.getServiceInfos()) {
for (EndpointInfo e : svcfo.getEndpoints()) {
BindingInfo bfo = e.getBinding();
String bid = bfo.getBindingId();
if ("http://schemas.xmlsoap.org/wsdl/soap/".equals(bid) || "http://schemas.xmlsoap.org/wsdl/soap12/".equals(bid)) {
for (Object o : bfo.getExtensors().get()) {
try {
String s = (String) o.getClass().getMethod("getTransportURI").invoke(o);
if (s != null && s.endsWith("http")) {
return e;
}
} catch (Throwable t) {
// ignore
}
}
}
}
}
throw new UnsupportedOperationException("Only document-style SOAP 1.1 and 1.2 http are supported " + "for auto-selection of endpoint; none were found.");
}
Aggregations