@Override public org.apache.cxf.service.Service create() { org.apache.cxf.service.Service s = super.create(); s.put(ENDPOINT_CLASS, implInfo.getEndpointClass()); if (s.getDataBinding() != null) { setMTOMFeatures(s.getDataBinding()); } return s; }
private synchronized WrapperHelper getWrapperHelper(Message message, MessageInfo messageInfo, MessageInfo wrappedMessageInfo, Class<?> wrapClass, MessagePartInfo messagePartInfo) { WrapperHelper helper = messagePartInfo.getProperty("WRAPPER_CLASS", WrapperHelper.class); if (helper == null) { Service service = ServiceModelUtil.getService(message.getExchange()); DataBinding dataBinding = service.getDataBinding(); if (dataBinding instanceof WrapperCapableDatabinding) { helper = createWrapperHelper((WrapperCapableDatabinding)dataBinding, messageInfo, wrappedMessageInfo, wrapClass); messagePartInfo.setProperty("WRAPPER_CLASS", helper); } } return helper; }
@Override protected void initializeFaultInterceptors() { getService().getOutFaultInterceptors().add(new WebFaultOutInterceptor()); }
protected void initializeWSDLOperationsForProvider() { Class<?> c = getProviderParameterType(getServiceClass()); if (c == null) { throw new ServiceConstructionException(new Message("INVALID_PROVIDER_EXC", LOG)); for (ServiceInfo si : getService().getServiceInfos()) { for (EndpointInfo ep : si.getEndpoints()) { enames.add(ep.getName()); for (ServiceInfo si : getService().getServiceInfos()) { si.setProperty("soap.force.doclit.bare", Boolean.TRUE); if (!isFromWsdl()) { for (EndpointInfo ei : si.getEndpoints()) { ei.setProperty("soap.no.validate.parts", Boolean.TRUE); for (BindingInfo bind : si.getBindings()) { for (BindingOperationInfo bop : bind.getOperations()) { OperationInfo o = bop.getOperationInfo(); if (bop.isUnwrappedCapable()) { bop.getOperationInfo().setUnwrappedOperation(null); bop.setUnwrappedOperation(null); if (o.getInput() != null) { final List<MessagePartInfo> messageParts; if (o.getInput().getMessagePartsNumber() == 0) { MessagePartInfo inf = o.getInput().addMessagePart(o.getName()); inf.setConcreteName(o.getName()); messageParts = o.getInput().getMessageParts(); bop.getInput().setMessageParts(messageParts);
if (boi.isUnwrappedCapable()) { BindingOperationInfo boi2 = boi.getUnwrappedOperation(); OperationInfo op = boi2.getOperationInfo(); BindingMessageInfo bmi; if (wrappedMessageInfo == boi.getOperationInfo().getInput()) { messageInfo = op.getInput(); bmi = boi2.getInput(); } else { messageInfo = op.getOutput(); bmi = boi2.getOutput(); MessagePartInfo wrapperPart = wrappedMessageInfo.getFirstMessagePart(); Class<?> wrapperClass = wrapperPart.getTypeClass(); Object wrappedObject = lst.get(wrapperPart.getIndex()); if (wrapperClass == null || wrappedObject == null || (wrapperClass != null && !wrapperClass.isInstance(wrappedObject))) { WrapperHelper helper = wrapperPart.getProperty("WRAPPER_CLASS", WrapperHelper.class); if (helper == null) { Service service = ServiceModelUtil.getService(message.getExchange()); DataBinding dataBinding = service.getDataBinding(); if (dataBinding instanceof WrapperCapableDatabinding) { helper = createWrapperHelper((WrapperCapableDatabinding)dataBinding, messageInfo, wrappedMessageInfo, wrapperClass); wrapperPart.setProperty("WRAPPER_CLASS", helper); } else { return;
WSDLServiceFactory sf = new WSDLServiceFactory(bus, wsdlURL, serviceName); dispatchService = sf.create(); dispatchService.setDataBinding(db); serviceFactory = sf; } else { for (ServiceInfo si : dispatchService.getServiceInfos()) { si.setProperty("soap.force.doclit.bare", Boolean.TRUE); if (null == wsdlURL) { for (EndpointInfo ei : si.getEndpoints()) { ei.setProperty("soap.no.validate.parts", Boolean.TRUE); for (BindingInfo bind : si.getBindings()) { for (BindingOperationInfo bop : bind.getOperations()) { if (bop.isUnwrappedCapable()) { bop.getOperationInfo().setUnwrappedOperation(null); bop.setUnwrappedOperation(null);
builder.address(ep.getEndpointInfo().getAddress()); builder.serviceName(ep.getService().getName()); builder.endpointName(ep.getEndpointInfo().getName()); URI wsdlDescription = ep.getEndpointInfo().getProperty("URI", URI.class); if (wsdlDescription == null) { String address = ep.getEndpointInfo().getAddress(); try { wsdlDescription = new URI(address + "?wsdl"); ep.getEndpointInfo().setProperty("URI", wsdlDescription);
.getExtensors(ExtensibilityElement.class); if (portExtensors != null) { Iterator<ExtensibilityElement> extensionElements = portExtensors.iterator(); addressElements.get(0).setTextContent(this.endpoint.getEndpointInfo().getAddress()); builder.address(this.endpoint.getEndpointInfo().getAddress()); builder.serviceName(this.endpoint.getService().getName()); builder.endpointName(this.endpoint.getEndpointInfo().getName()); if (this.endpoint.getEndpointInfo().getService().getDescription() != null) { builder.wsdlDocumentLocation(this.endpoint.getEndpointInfo().getService().getDescription() .getBaseURI());
for (ServiceInfo si : service.getServiceInfos()) { for (EndpointInfo ei : si.getEndpoints()) { String bindingID = BindingID.getJaxwsBindingID(ei.getTransportId()); addPort(ei.getName(), bindingID, ei.getAddress());
private JaxWsClientEndpointImpl getJaxwsEndpoint(QName portName, AbstractServiceFactoryBean sf, WebServiceFeature...features) { Service service = sf.getService(); EndpointInfo ei = null; if (portName == null) { ei = service.getServiceInfos().get(0).getEndpoints().iterator().next(); } else { ei = service.getEndpointInfo(portName); if (ei == null) { PortInfoImpl portInfo = getPortInfo(portName); if (portInfo != null && portInfo.getAddress() != null && !portInfo.getAddress().equals(ei.getAddress())) { ei.setAddress(portInfo.getAddress());
.createBindingInfo(serviceFactory.getService(), bindingID, config); Service service = serviceFactory.getService(); service.getServiceInfos().get(0).addBinding(bindingInfo); ei = new EndpointInfo(service.getServiceInfos().get(0), transportId); ei.setName(portName); ei.setAddress(address); ei.setBinding(bindingInfo); service.getServiceInfos().get(0).addEndpoint(ei); return ei;
public void handleMessage(SoapMessage message) throws Fault { Exchange ex = message.getExchange(); BindingOperationInfo bop = ex.getBindingOperationInfo(); if (bop == null) { return; } if (bop.isUnwrapped()) { bop = bop.getWrappedOperation(); } boolean client = isRequestor(message); BindingMessageInfo bmi = client ? bop.getInput() : bop.getOutput(); if (bmi == null) { return; } SoapBodyInfo sbi = bmi.getExtensor(SoapBodyInfo.class); if (sbi == null || sbi.getAttachments() == null || sbi.getAttachments().isEmpty()) { Service s = ex.getService(); DataBinding db = s.getDataBinding(); if (db instanceof JAXBDataBinding && hasSwaRef((JAXBDataBinding) db)) { setupAttachmentOutput(message); } return; } processAttachments(message, sbi); } protected void processAttachments(SoapMessage message, SoapBodyInfo sbi) {
String address = endpoint.getEndpointInfo().getAddress(); MethodDispatcher dispatcher = (MethodDispatcher)endpoint.getService().get( MethodDispatcher.class .getName()); BindingOperationInfo oi = dispatcher.getBindingOperation(method, endpoint); if (oi == null) { Message msg = new Message("NO_BINDING_OPERATION_INFO", LOG, method.getName());
/** * Obtain handler chain from annotations. * @param server * */ private void buildHandlerChain(Server server) { AnnotationHandlerChainBuilder builder = new AnnotationHandlerChainBuilder(); @SuppressWarnings("rawtypes") List<Handler> chain = new ArrayList<>(handlers); chain.addAll(builder.buildHandlerChainFromClass(getServiceBeanClass(), server.getEndpoint().getEndpointInfo().getName(), server.getEndpoint().getService().getName(), this.getBindingId())); for (Handler<?> h : chain) { injectResources(h); } ((JaxWsEndpointImpl)server.getEndpoint()).getJaxwsBinding().setHandlerChain(chain); }
EndpointInfo ei = ServiceModelUtil.findBestEndpointInfo(portTypeName, service.getServiceInfos()); if (ei != null) { portName = ei.getName(); } else { portName = serviceFactory.getEndpointName();
private Set<Class<?>> generatedWrapperBeanClass() { DataBinding b = getDataBinding(); if (b.getClass().getName().endsWith("JAXBDataBinding") && schemaLocations == null) { ServiceInfo serviceInfo = getService().getServiceInfos().get(0); WrapperClassGenerator wrapperGen = new WrapperClassGenerator(this, serviceInfo.getInterface(), getQualifyWrapperSchema()); return wrapperGen.generate(); } return Collections.emptySet(); }
private void validatePossibleFault(Message message, BindingOperationInfo bop, Node ds) { Element el = DOMUtils.getFirstElement(ds); if (!"Fault".equals(el.getLocalName())) { return; } message.put(Message.RESPONSE_CODE, 500); el = DOMUtils.getFirstElement(el); while (el != null && !"detail".equals(el.getLocalName())) { el = DOMUtils.getNextElement(el); } if (el != null) { Schema schema = EndpointReferenceUtils.getSchema(message.getExchange().getService() .getServiceInfos().get(0), message.getExchange().getBus()); try { validateFaultDetail(el, schema, bop); } catch (Exception e) { throw new Fault(e); } //We validated what we can from a fault standpoint message.put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.FALSE); } } private void validateFaultDetail(Element detail, Schema schema, BindingOperationInfo bop) throws Exception {
@Override protected void buildServiceFromClass() { super.buildServiceFromClass(); getService().put(WS_FEATURES, getWsFeatures()); }
private void validateFault(SoapMessage message, SOAPFault fault, BindingOperationInfo bop) { if (ServiceUtils.isSchemaValidationEnabled(SchemaValidationType.OUT, message)) { Schema schema = EndpointReferenceUtils.getSchema(message.getExchange().getService() .getServiceInfos().get(0), message.getExchange().getBus()); Detail d = fault.getDetail(); try { validateFaultDetail(d, schema, bop); } catch (Exception e) { throw new SoapFault(e.getMessage(), e, message.getVersion().getReceiver()); } //We validated what we can from a fault standpoint message.put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.FALSE); } }
if (needWrapperClassInterceptor(service.getServiceInfos().get(0))) { List<Interceptor<? extends Message>> in = super.getInInterceptors(); List<Interceptor<? extends Message>> out = super.getOutInterceptors();