use of org.apache.cxf.service.model.MessageInfo in project cxf by apache.
the class WrapperClassGenerator method generate.
public Set<Class<?>> generate() {
for (OperationInfo opInfo : interfaceInfo.getOperations()) {
if (opInfo.isUnwrappedCapable()) {
Method method = (Method) opInfo.getProperty(ReflectionServiceFactoryBean.METHOD);
if (method == null) {
continue;
}
MessagePartInfo inf = opInfo.getInput().getFirstMessagePart();
if (inf.getTypeClass() == null) {
MessageInfo messageInfo = opInfo.getUnwrappedOperation().getInput();
createWrapperClass(inf, messageInfo, opInfo, method, true);
}
MessageInfo messageInfo = opInfo.getUnwrappedOperation().getOutput();
if (messageInfo != null) {
inf = opInfo.getOutput().getFirstMessagePart();
if (inf.getTypeClass() == null) {
createWrapperClass(inf, messageInfo, opInfo, method, false);
}
}
}
}
return wrapperBeans;
}
use of org.apache.cxf.service.model.MessageInfo in project steve by RWTH-i5-IDSG.
the class FromAddressInterceptor method getChargeBoxId.
private String getChargeBoxId(Message message) {
MessageContentsList lst = MessageContentsList.getContentsList(message);
if (lst == null) {
return null;
}
MessageInfo mi = (MessageInfo) message.get("org.apache.cxf.service.model.MessageInfo");
for (MessagePartInfo mpi : mi.getMessageParts()) {
if (CHARGEBOX_ID_HEADER.equals(mpi.getName().getLocalPart())) {
return (String) lst.get(mpi);
}
}
return null;
}
use of org.apache.cxf.service.model.MessageInfo in project cxf by apache.
the class AbstractInDatabindingInterceptor method getMessageInfo.
protected MessageInfo getMessageInfo(Message message, BindingOperationInfo operation, boolean requestor) {
MessageInfo msgInfo;
OperationInfo intfOp = operation.getOperationInfo();
if (requestor) {
msgInfo = intfOp.getOutput();
message.put(MessageInfo.class, intfOp.getOutput());
} else {
msgInfo = intfOp.getInput();
message.put(MessageInfo.class, intfOp.getInput());
}
return msgInfo;
}
use of org.apache.cxf.service.model.MessageInfo in project cxf by apache.
the class SoapBindingFactory method initializeMessage.
private void initializeMessage(SoapBindingInfo bi, BindingOperationInfo boi, BindingMessageInfo bmsg) {
MessageInfo msg = bmsg.getMessageInfo();
List<MessagePartInfo> messageParts = new ArrayList<>();
messageParts.addAll(msg.getMessageParts());
List<SoapHeader> headers = SOAPBindingUtil.getSoapHeaders(bmsg.getExtensors(ExtensibilityElement.class));
if (headers != null) {
for (SoapHeader header : headers) {
SoapHeaderInfo headerInfo = new SoapHeaderInfo();
headerInfo.setUse(header.getUse());
if (StringUtils.isEmpty(header.getPart())) {
throw new RuntimeException("Problem with WSDL: soap:header element in operation " + boi.getName().getLocalPart() + " does not specify a part.");
}
MessagePartInfo part = msg.getMessagePart(new QName(msg.getName().getNamespaceURI(), header.getPart()));
if (part != null && header.getMessage() != null && !part.getMessageInfo().getName().equals(header.getMessage())) {
part = null;
// out of band, let's find it
for (MessagePartInfo mpi : msg.getOutOfBandParts()) {
if (mpi.getName().getLocalPart().equals(header.getPart()) && mpi.getMessageInfo().getName().equals(header.getMessage())) {
part = mpi;
}
}
}
if (part != null) {
headerInfo.setPart(part);
messageParts.remove(part);
bmsg.addExtensor(headerInfo);
}
}
// Exclude the header parts from the message part list.
bmsg.setMessageParts(messageParts);
}
SoapBodyInfo bodyInfo = new SoapBodyInfo();
SoapBody soapBody = SOAPBindingUtil.getSoapBody(bmsg.getExtensors(ExtensibilityElement.class));
List<?> parts = null;
if (soapBody == null) {
MIMEMultipartRelated mmr = bmsg.getExtensor(MIMEMultipartRelated.class);
if (mmr != null) {
parts = mmr.getMIMEParts();
}
} else {
bmsg.addExtensor(soapBody);
bodyInfo.setUse(soapBody.getUse());
parts = soapBody.getParts();
}
// Initialize the body parts.
List<MessagePartInfo> attParts = null;
if (parts != null) {
List<MessagePartInfo> bodyParts = new ArrayList<>();
for (Iterator<?> itr = parts.iterator(); itr.hasNext(); ) {
Object part = itr.next();
if (part instanceof MIMEPart) {
MIMEPart mpart = (MIMEPart) part;
attParts = handleMimePart(mpart, attParts, msg, bmsg, bodyParts, messageParts);
} else {
addSoapBodyPart(msg, bodyParts, (String) part);
}
}
bodyInfo.setParts(bodyParts);
bodyInfo.setAttachments(attParts);
} else {
bodyInfo.setParts(messageParts);
}
bmsg.addExtensor(bodyInfo);
}
use of org.apache.cxf.service.model.MessageInfo in project cxf by apache.
the class SoapBindingFactory method createBindingInfo.
public BindingInfo createBindingInfo(ServiceInfo si, String bindingid, Object conf) {
SoapBindingConfiguration config;
if (conf instanceof SoapBindingConfiguration) {
config = (SoapBindingConfiguration) conf;
} else {
config = new SoapBindingConfiguration();
}
if (WSDLConstants.NS_SOAP12.equals(bindingid) || WSDLConstants.NS_SOAP12_HTTP_BINDING.equals(bindingid)) {
config.setVersion(Soap12.getInstance());
config.setTransportURI(WSDLConstants.NS_SOAP_HTTP_TRANSPORT);
}
SoapBindingInfo info = new SoapBindingInfo(si, bindingid, config.getVersion());
info.setName(config.getBindingName(si));
info.setStyle(config.getStyle());
info.setTransportURI(config.getTransportURI());
if (config.isMtomEnabled()) {
info.setProperty(Message.MTOM_ENABLED, Boolean.TRUE);
}
for (OperationInfo op : si.getInterface().getOperations()) {
SoapOperationInfo sop = new SoapOperationInfo();
sop.setAction(config.getSoapAction(op));
sop.setStyle(config.getStyle(op));
BindingOperationInfo bop = info.buildOperation(op.getName(), op.getInputName(), op.getOutputName());
bop.addExtensor(sop);
info.addOperation(bop);
BindingMessageInfo bInput = bop.getInput();
if (bInput != null) {
final MessageInfo input;
BindingMessageInfo unwrappedMsg = bInput;
if (bop.isUnwrappedCapable()) {
input = bop.getOperationInfo().getUnwrappedOperation().getInput();
unwrappedMsg = bop.getUnwrappedOperation().getInput();
} else {
input = bop.getOperationInfo().getInput();
}
setupHeaders(bop, bInput, unwrappedMsg, input, config);
}
BindingMessageInfo bOutput = bop.getOutput();
if (bOutput != null) {
final MessageInfo output;
BindingMessageInfo unwrappedMsg = bOutput;
if (bop.isUnwrappedCapable()) {
output = bop.getOperationInfo().getUnwrappedOperation().getOutput();
unwrappedMsg = bop.getUnwrappedOperation().getOutput();
} else {
output = bop.getOperationInfo().getOutput();
}
setupHeaders(bop, bOutput, unwrappedMsg, output, config);
}
}
try {
createSoapBinding(info);
} catch (WSDLException e) {
e.printStackTrace();
}
return info;
}
Aggregations