use of org.apache.cxf.service.model.OperationInfo in project cxf by apache.
the class STSUtils method addCancelOperation.
private static OperationInfo addCancelOperation(InterfaceInfo ii, String namespace, String servNamespace) {
OperationInfo oi = ii.addOperation(new QName(servNamespace, "CancelSecurityToken"));
MessageInfo mii = oi.createMessage(new QName(servNamespace, "CancelSecurityTokenMsg"), MessageInfo.Type.INPUT);
oi.setInput("CancelSecurityTokenMsg", mii);
MessagePartInfo mpi = mii.addMessagePart("request");
mpi.setElementQName(new QName(namespace, "RequestSecurityToken"));
MessageInfo mio = oi.createMessage(new QName(servNamespace, "CancelSecurityTokenResponseMsg"), MessageInfo.Type.OUTPUT);
oi.setOutput("CancelSecurityTokenResponseMsg", mio);
mpi = mio.addMessagePart("response");
if (WST_NS_05_02.equals(namespace)) {
mpi.setElementQName(new QName(namespace, "RequestSecurityTokenResponse"));
} else {
mpi.setElementQName(new QName(namespace, "RequestSecurityTokenResponseCollection"));
}
return oi;
}
use of org.apache.cxf.service.model.OperationInfo in project cxf by apache.
the class STSUtils method createSTSEndpoint.
// CHECKSTYLE:OFF
private static Endpoint createSTSEndpoint(Bus bus, String namespace, String transportId, String location, String soapVersion, Policy policy, QName epName, boolean sc) throws BusException, EndpointException {
// CHECKSTYLE:ON
Service service = null;
String ns = namespace + "/wsdl";
ServiceInfo si = new ServiceInfo();
QName iName = new QName(ns, sc ? "SecureConversationTokenService" : "SecurityTokenService");
si.setName(iName);
InterfaceInfo ii = new InterfaceInfo(si, iName);
OperationInfo ioi = addIssueOperation(ii, namespace, ns);
OperationInfo coi = addCancelOperation(ii, namespace, ns);
OperationInfo roi = addRenewOperation(ii, namespace, ns);
si.setInterface(ii);
service = new ServiceImpl(si);
BindingFactoryManager bfm = bus.getExtension(BindingFactoryManager.class);
BindingFactory bindingFactory = bfm.getBindingFactory(soapVersion);
BindingInfo bi = bindingFactory.createBindingInfo(service, soapVersion, null);
si.addBinding(bi);
if (transportId == null) {
ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class);
ConduitInitiator ci = cim.getConduitInitiatorForUri(location);
transportId = ci.getTransportIds().get(0);
}
EndpointInfo ei = new EndpointInfo(si, transportId);
ei.setBinding(bi);
ei.setName(epName == null ? iName : epName);
ei.setAddress(location);
si.addEndpoint(ei);
if (policy != null) {
ei.addExtensor(policy);
}
BindingOperationInfo boi = bi.getOperation(ioi);
SoapOperationInfo soi = boi.getExtensor(SoapOperationInfo.class);
if (soi == null) {
soi = new SoapOperationInfo();
boi.addExtensor(soi);
}
soi.setAction(namespace + (sc ? "/RST/SCT" : "/RST/Issue"));
boi = bi.getOperation(coi);
soi = boi.getExtensor(SoapOperationInfo.class);
if (soi == null) {
soi = new SoapOperationInfo();
boi.addExtensor(soi);
}
soi.setAction(namespace + (sc ? "/RST/SCT/Cancel" : "/RST/Cancel"));
boi = bi.getOperation(roi);
soi = boi.getExtensor(SoapOperationInfo.class);
if (soi == null) {
soi = new SoapOperationInfo();
boi.addExtensor(soi);
}
soi.setAction(namespace + (sc ? "/RST/SCT/Renew" : "/RST/Renew"));
service.setDataBinding(new SourceDataBinding());
return new EndpointImpl(bus, service, ei);
}
use of org.apache.cxf.service.model.OperationInfo in project cxf by apache.
the class STSUtils method addRenewOperation.
private static OperationInfo addRenewOperation(InterfaceInfo ii, String namespace, String servNamespace) {
OperationInfo oi = ii.addOperation(new QName(servNamespace, "RenewSecurityToken"));
MessageInfo mii = oi.createMessage(new QName(servNamespace, "RenewSecurityTokenMsg"), MessageInfo.Type.INPUT);
oi.setInput("RenewSecurityTokenMsg", mii);
MessagePartInfo mpi = mii.addMessagePart("request");
mpi.setElementQName(new QName(namespace, "RequestSecurityToken"));
MessageInfo mio = oi.createMessage(new QName(servNamespace, "RenewSecurityTokenResponseMsg"), MessageInfo.Type.OUTPUT);
oi.setOutput("RenewSecurityTokenResponseMsg", mio);
mpi = mio.addMessagePart("response");
if (WST_NS_05_02.equals(namespace)) {
mpi.setElementQName(new QName(namespace, "RequestSecurityTokenResponse"));
} else {
mpi.setElementQName(new QName(namespace, "RequestSecurityTokenResponseCollection"));
}
return oi;
}
use of org.apache.cxf.service.model.OperationInfo in project cxf by apache.
the class STSUtils method addIssueOperation.
private static OperationInfo addIssueOperation(InterfaceInfo ii, String namespace, String servNamespace) {
OperationInfo oi = ii.addOperation(new QName(servNamespace, "RequestSecurityToken"));
MessageInfo mii = oi.createMessage(new QName(servNamespace, "RequestSecurityTokenMsg"), MessageInfo.Type.INPUT);
oi.setInput("RequestSecurityTokenMsg", mii);
MessagePartInfo mpi = mii.addMessagePart("request");
mpi.setElementQName(new QName(namespace, "RequestSecurityToken"));
MessageInfo mio = oi.createMessage(new QName(servNamespace, "RequestSecurityTokenResponseMsg"), MessageInfo.Type.OUTPUT);
oi.setOutput("RequestSecurityTokenResponseMsg", mio);
mpi = mio.addMessagePart("response");
if (WST_NS_05_02.equals(namespace)) {
mpi.setElementQName(new QName(namespace, "RequestSecurityTokenResponse"));
} else {
mpi.setElementQName(new QName(namespace, "RequestSecurityTokenResponseCollection"));
}
return oi;
}
use of org.apache.cxf.service.model.OperationInfo in project cxf by apache.
the class ServiceWSDLBuilder method buildPortTypeOperation.
protected void buildPortTypeOperation(PortType portType, Collection<OperationInfo> operationInfos, final Definition def) {
for (OperationInfo operationInfo : operationInfos) {
Operation operation = null;
try {
operation = operationInfo.getProperty(WSDLServiceBuilder.WSDL_OPERATION, Operation.class);
} catch (ClassCastException e) {
// do nothing
}
if (operation == null) {
operation = def.createOperation();
addDocumentation(operation, operationInfo.getDocumentation());
operation.setUndefined(false);
operation.setName(operationInfo.getName().getLocalPart());
addNamespace(operationInfo.getName().getNamespaceURI(), def);
if (operationInfo.isOneWay()) {
operation.setStyle(OperationType.ONE_WAY);
}
addExtensibilityElements(def, operation, getWSDL11Extensors(operationInfo));
Input input = def.createInput();
addDocumentation(input, operationInfo.getInput().getDocumentation());
input.setName(operationInfo.getInputName());
Message message = def.createMessage();
buildMessage(message, operationInfo.getInput(), def);
this.addExtensibilityAttributes(def, input, getInputExtensionAttributes(operationInfo));
this.addExtensibilityElements(def, input, getWSDL11Extensors(operationInfo.getInput()));
input.setMessage(message);
operation.setInput(input);
operation.setParameterOrdering(operationInfo.getParameterOrdering());
if (operationInfo.getOutput() != null) {
Output output = def.createOutput();
addDocumentation(output, operationInfo.getOutput().getDocumentation());
output.setName(operationInfo.getOutputName());
message = def.createMessage();
buildMessage(message, operationInfo.getOutput(), def);
this.addExtensibilityAttributes(def, output, getOutputExtensionAttributes(operationInfo));
this.addExtensibilityElements(def, output, getWSDL11Extensors(operationInfo.getOutput()));
output.setMessage(message);
operation.setOutput(output);
}
// loop to add fault
Collection<FaultInfo> faults = operationInfo.getFaults();
Fault fault = null;
for (FaultInfo faultInfo : faults) {
fault = def.createFault();
addDocumentation(fault, faultInfo.getDocumentation());
fault.setName(faultInfo.getFaultName().getLocalPart());
message = def.createMessage();
buildMessage(message, faultInfo, def);
this.addExtensibilityAttributes(def, fault, faultInfo.getExtensionAttributes());
this.addExtensibilityElements(def, fault, getWSDL11Extensors(faultInfo));
fault.setMessage(message);
operation.addFault(fault);
}
}
portType.addOperation(operation);
}
}
Aggregations