.getExtensors(ExtensibilityElement.class); if (portExtensors != null) { Iterator<ExtensibilityElement> extensionElements = portExtensors.iterator(); QName wsaEpr = new QName(Names.WSA_NAMESPACE_NAME, "EndpointReference"); while (extensionElements.hasNext()) { ExtensibilityElement ext = extensionElements.next(); if (ext instanceof UnknownExtensibilityElement && wsaEpr.equals(ext.getElementType())) { Element eprEle = ((UnknownExtensibilityElement)ext).getElement(); List<Element> addressElements = DOMUtils.getChildrenWithName(eprEle, addressElements.get(0).setTextContent(this.endpoint.getEndpointInfo().getAddress()); builder.address(this.endpoint.getEndpointInfo().getAddress()); builder.endpointName(this.endpoint.getEndpointInfo().getName()); if (this.endpoint.getEndpointInfo().getService().getDescription() != null) { builder.wsdlDocumentLocation(this.endpoint.getEndpointInfo().getService().getDescription() .getBaseURI());
EndpointInfo endpointInfo = serv.getEndpoint().getEndpointInfo(); if (endpointInfo.getAddress() == null || !endpointInfo.getAddress().contains(addr)) { endpointInfo.setAddress(addr); endpointInfo.setProperty(WSDLGetUtils.PUBLISHED_ENDPOINT_URL, publishedEndpointUrl); Definition def = endpointInfo.getService() .getProperty(WSDLServiceBuilder.WSDL_DEFINITION, Definition.class); if (def == null) { def = bus.getExtension(WSDLManager.class).getDefinition(wsdlLocation); endpointInfo.setProperty(entry.getKey(), entry.getValue()); this.address = endpointInfo.getAddress();
ret = exchange.get(mappedkey); if (ret != null) { return ret; ret = tmp.get(Message.PROTOCOL_HEADERS); if (boi != null && !Boolean.TRUE.equals(boi.getProperty("operation.is.synthetic"))) { ret = boi.getName(); ret = boi.getBinding().getService().getName(); ret = boi.getBinding().getService().getInterface().getName(); ret = endpointInfo.getName(); URI wsdlDescription = endpointInfo.getProperty("URI", URI.class); if (wsdlDescription == null) { String address = endpointInfo.getAddress(); try { wsdlDescription = new URI(address + "?wsdl"); endpointInfo.setProperty("URI", wsdlDescription);
protected static EndpointInfo getAddressValue(EndpointInfo ei, boolean dp) { if (dp) { String eiAddress = ei.getAddress(); if (eiAddress == null) { try { ServerSocket s = new ServerSocket(0); ei.setAddress("http://localhost:" + s.getLocalPort()); s.close(); return ei; } catch (IOException ex) { // problem allocating a random port, go to the default one ei.setAddress("http://localhost"); } } String addr = StringUtils.addDefaultPortIfMissing(ei.getAddress()); if (addr != null) { ei.setAddress(addr); } } return ei; }
public static void setAddress(AbstractDestination dest, String absAddress) { dest.getEndpointInfo().setAddress(absAddress); if (dest.getEndpointInfo().getExtensor(AddressType.class) != null) { dest.getEndpointInfo().getExtensor(AddressType.class).setLocation(absAddress); } } }
private String getAbsoluteAddress(String basePath, AbstractDestination d) { String endpointAddress = (String)d.getEndpointInfo().getProperty("publishedEndpointUrl"); if (endpointAddress != null) { return endpointAddress; } endpointAddress = d.getEndpointInfo().getAddress(); if (endpointAddress.startsWith("http://") || endpointAddress.startsWith("https://")) { if (endpointAddress.startsWith(basePath) || showForeignContexts) { return endpointAddress; } return null; } String address = basePath; if (address.endsWith("/") && endpointAddress.startsWith("/")) { address = address.substring(0, address.length() - 1); } return address + endpointAddress; }
/** * @param address the address * @return a Destination for the address */ private Destination getDestination(Bus bus, String address, Message message) throws IOException { Destination destination = null; DestinationFactoryManager factoryManager = bus.getExtension(DestinationFactoryManager.class); DestinationFactory factory = factoryManager.getDestinationFactoryForUri(address); if (factory != null) { Endpoint ep = message.getExchange().getEndpoint(); EndpointInfo ei = new EndpointInfo(); ei.setName(new QName(ep.getEndpointInfo().getName().getNamespaceURI(), ep.getEndpointInfo().getName().getLocalPart() + ".decoupled")); ei.setAddress(address); destination = factory.getDestination(ei, bus); Conduit conduit = ContextUtils.getConduit(null, message); if (conduit != null) { MessageObserver ob = conduit.getMessageObserver(); ob = new InterposedMessageObserver(bus, ob); destination.setMessageObserver(ob); } } return destination; } protected static class InterposedMessageObserver implements MessageObserver {
for (EndpointInfo ep : si.getEndpoints()) { enames.add(ep.getName()); QName catchAll = new QName("http://cxf.apache.org/jaxws/provider", "invoke"); 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.getOutput().getMessagePartsNumber() == 0) { MessagePartInfo inf = o.getOutput().addMessagePart(o.getName()); inf.setConcreteName(new QName(o.getName().getNamespaceURI(), o.getName().getLocalPart() + "Response")); messageParts = o.getOutput().getMessageParts();
private void addInvokeOperation(QName operationName, boolean oneWay) { ServiceInfo info = client.getEndpoint().getEndpointInfo().getService(); OperationInfo invokeOpInfo = info.getInterface() .getOperation(oneWay ? INVOKE_ONEWAY_QNAME : INVOKE_QNAME); OperationInfo opInfo = info.getInterface().addOperation(operationName); opInfo.setInput(invokeOpInfo.getInputName(), invokeOpInfo.getInput()); if (!oneWay) { opInfo.setOutput(invokeOpInfo.getOutputName(), invokeOpInfo.getOutput()); } for (BindingInfo bind : client.getEndpoint().getEndpointInfo().getService().getBindings()) { BindingOperationInfo bo = new BindingOperationInfo(bind, opInfo); bind.addOperation(bo); } }
QName name = new QName(serviceName.getNamespaceURI(), port.getName()); Service service = sf.create(); for (ServiceInfo si : service.getServiceInfos()) { for (EndpointInfo ei : si.getEndpoints()) { String bindingID = BindingID.getJaxwsBindingID(ei.getTransportId()); addPort(ei.getName(), bindingID, ei.getAddress());
private static boolean portNameMatches(Server s, String portName) { boolean ret = false; if (null == portName || portName.equals(s.getEndpoint().getEndpointInfo().getName().getLocalPart())) { return true; } return ret; }
public static BindingOperationInfo getOperation(Exchange exchange, String opName) { Endpoint ep = exchange.get(Endpoint.class); if (ep == null) { return null; } BindingInfo service = ep.getEndpointInfo().getBinding(); for (BindingOperationInfo b : service.getOperations()) { if (b.getName().getLocalPart().equals(opName)) { return b; } } return null; }
public static BindingOperationInfo getOperation(Exchange exchange, String opName) { Endpoint ep = exchange.getEndpoint(); if (ep == null) { return null; } BindingInfo service = ep.getEndpointInfo().getBinding(); for (BindingOperationInfo b : service.getOperations()) { if (b.getName().getLocalPart().equals(opName)) { return b; } } return null; }
private void writerSoapEndpoint(PrintWriter writer, String basePath, AbstractDestination sd) { String absoluteURL = getAbsoluteAddress(basePath, sd); if (absoluteURL == null) { return; } writer.write("<tr><td>"); writer.write("<span class=\"porttypename\">" + sd.getEndpointInfo().getInterface().getName().getLocalPart() + "</span>"); writer.write("<ul>"); for (OperationInfo oi : sd.getEndpointInfo().getInterface().getOperations()) { if (!Boolean.TRUE.equals(oi.getProperty("operation.is.synthetic"))) { writer.write("<li>" + oi.getName().getLocalPart() + "</li>"); } } writer.write("</ul>"); writer.write("</td><td>"); writer.write("<span class=\"field\">Endpoint address:</span> " + "<span class=\"value\">" + absoluteURL + "</span>"); writer.write("<br/><span class=\"field\">WSDL :</span> " + "<a href=\"" + absoluteURL + "?wsdl\">" + sd.getEndpointInfo().getService().getName() + "</a>"); writer.write("<br/><span class=\"field\">Target namespace:</span> " + "<span class=\"value\">" + sd.getEndpointInfo().getService().getTargetNamespace() + "</span>"); addAtomLinkIfNeeded(absoluteURL, atomMap, writer); writer.write("</td></tr>"); }
public static EndpointInfo createEndpointInfo(Bus bus, ServiceInfo serviceInfo, BindingInfo bindingInfo, String address) { String transportURI = getTransportId(bus, address); EndpointInfo endpointInfo = new EndpointInfo(serviceInfo, transportURI); if (address != null) { endpointInfo.setName(new QName(address)); endpointInfo.setAddress(address); } System.out.println("seting binding info:" + bindingInfo); endpointInfo.setBinding(bindingInfo); return endpointInfo; }
private BindingOperationInfo findAnyOp(Exchange exchange) { Endpoint ep = exchange.get(Endpoint.class); BindingInfo service = ep.getEndpointInfo().getBinding(); for (BindingOperationInfo b : service.getOperations()) { if (b.getInput() != null && !b.getInput().getMessageInfo().getMessageParts().isEmpty()) { MessagePartInfo inf = b.getInput().getMessageInfo().getMessagePart(0); if (XMLSchemaQNames.XSD_ANY.equals(inf.getTypeQName())) { return b; } } } return null; }
private void getBindingOperationForEmptyBody(Collection<OperationInfo> operations, Endpoint ep, Exchange exchange) { // TO DO : check duplicate operation with no input and also check if the action matches for (OperationInfo op : operations) { MessageInfo bmsg = op.getInput(); int bPartsNum = bmsg.getMessagePartsNumber(); if (bPartsNum == 0 || (bPartsNum == 1 && Constants.XSD_ANYTYPE.equals(bmsg.getFirstMessagePart().getTypeQName()))) { BindingOperationInfo boi = ep.getEndpointInfo().getBinding().getOperation(op); exchange.put(BindingOperationInfo.class, boi); exchange.setOneWay(op.isOneWay()); } } }
protected void handleResponseInternal() throws IOException { Exchange exchange = outMessage.getExchange(); int responseCode = doProcessResponseCode(); inMessage.setExchange(exchange); updateResponseHeaders(inMessage); inMessage.put(Message.RESPONSE_CODE, responseCode); if (MessageUtils.getContextualBoolean(outMessage, SET_HTTP_RESPONSE_MESSAGE, false)) { inMessage.put(HTTP_RESPONSE_MESSAGE, getResponseMessage()); Endpoint ep = exchange.getEndpoint(); if (null != ep && null != ep.getEndpointInfo() && null == ep.getEndpointInfo(). getProperty("org.apache.cxf.ws.addressing.MAPAggregator.decoupledDestination")) { ClientCallback cc = exchange.remove(ClientCallback.class); if (null != cc) { cc.handleResponse(null, null); exchange.put("IN_CHAIN_COMPLETE", Boolean.TRUE); exchange.setInMessage(inMessage); return;
private static STSClient createSTSClient(Message message, String type) { if (type == null) { type = ""; } else { type = "." + type + "-client"; } STSClient client = new STSClient(message.getExchange().getBus()); Endpoint ep = message.getExchange().getEndpoint(); client.setEndpointName(ep.getEndpointInfo().getName().toString() + type); client.setBeanName(ep.getEndpointInfo().getName().toString() + type); if (SecurityUtils.getSecurityPropertyBoolean(SecurityConstants.STS_CLIENT_SOAP12_BINDING, message, false)) { client.setSoap12(); } return client; }