Search in sources :

Example 6 with ServiceInfo

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;
}
Also used : ServiceInfo(org.apache.cxf.service.model.ServiceInfo) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) EndpointReferenceType(org.apache.cxf.ws.addressing.EndpointReferenceType)

Example 7 with ServiceInfo

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");
            }
        }
    }
}
Also used : ServiceInfo(org.apache.cxf.service.model.ServiceInfo) BindingFaultInfo(org.apache.cxf.service.model.BindingFaultInfo) FaultInfo(org.apache.cxf.service.model.FaultInfo)

Example 8 with ServiceInfo

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);
                    }
                }
            }
        }
    }
}
Also used : ServiceInfo(org.apache.cxf.service.model.ServiceInfo) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) SOAPAddressRewriteMetadata(org.jboss.wsf.spi.metadata.config.SOAPAddressRewriteMetadata)

Example 9 with ServiceInfo

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();
    }
}
Also used : ServiceInfo(org.apache.cxf.service.model.ServiceInfo) SchemaCollection(org.apache.cxf.common.xmlschema.SchemaCollection) MessagePartInfo(org.apache.cxf.service.model.MessagePartInfo) ServiceModelVisitor(org.apache.cxf.service.ServiceModelVisitor)

Example 10 with ServiceInfo

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.");
}
Also used : ServiceInfo(org.apache.cxf.service.model.ServiceInfo) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) BindingInfo(org.apache.cxf.service.model.BindingInfo)

Aggregations

ServiceInfo (org.apache.cxf.service.model.ServiceInfo)195 QName (javax.xml.namespace.QName)89 Test (org.junit.Test)76 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)63 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)47 BindingInfo (org.apache.cxf.service.model.BindingInfo)43 OperationInfo (org.apache.cxf.service.model.OperationInfo)37 InterfaceInfo (org.apache.cxf.service.model.InterfaceInfo)36 Service (org.apache.cxf.service.Service)33 Endpoint (org.apache.cxf.endpoint.Endpoint)31 MessagePartInfo (org.apache.cxf.service.model.MessagePartInfo)29 File (java.io.File)28 ArrayList (java.util.ArrayList)27 Bus (org.apache.cxf.Bus)26 InputStream (java.io.InputStream)23 Definition (javax.wsdl.Definition)20 Method (java.lang.reflect.Method)16 SchemaCollection (org.apache.cxf.common.xmlschema.SchemaCollection)15 HTTPTransportFactory (org.apache.cxf.transport.http.HTTPTransportFactory)15 IOException (java.io.IOException)12