org.apache.cxf.service.model.MessagePartInfo Java Examples
The following examples show how to use
org.apache.cxf.service.model.MessagePartInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JAXRSServiceImpl.java From cxf with Apache License 2.0 | 6 votes |
private void createMessagePartInfo(OperationInfo oi, Class<?> type, QName qname, Method m, boolean input) { if (type == void.class || Source.class.isAssignableFrom(type)) { return; } if (InjectionUtils.isPrimitive(type) || Response.class == type) { return; } QName mName = new QName(qname.getNamespaceURI(), (input ? "in" : "out") + m.getName()); MessageInfo ms = oi.createMessage(mName, input ? MessageInfo.Type.INPUT : MessageInfo.Type.OUTPUT); if (input) { oi.setInput("in", ms); } else { oi.setOutput("out", ms); } QName mpQName = JAXRSUtils.getClassQName(type); MessagePartInfo mpi = ms.addMessagePart(mpQName); mpi.setConcreteName(mpQName); mpi.setTypeQName(mpQName); mpi.setTypeClass(type); }
Example #2
Source File: RMEndpoint.java From cxf with Apache License 2.0 | 6 votes |
void buildCloseSequenceOperationInfo(InterfaceInfo ii, ProtocolVariation protocol) { OperationInfo operationInfo = null; MessageInfo messageInfo = null; RMConstants consts = protocol.getConstants(); operationInfo = ii.addOperation(consts.getCloseSequenceOperationName()); messageInfo = operationInfo.createMessage(consts.getCloseSequenceOperationName(), MessageInfo.Type.INPUT); operationInfo.setInput(messageInfo.getName().getLocalPart(), messageInfo); if (RM11Constants.NAMESPACE_URI.equals(protocol.getWSRMNamespace())) { MessagePartInfo partInfo = messageInfo.addMessagePart(CLOSE_PART_NAME); partInfo.setElementQName(consts.getCloseSequenceOperationName()); partInfo.setElement(true); partInfo.setTypeClass(CloseSequenceType.class); messageInfo = operationInfo.createMessage( RM11Constants.INSTANCE.getCloseSequenceResponseOperationName(), MessageInfo.Type.OUTPUT); operationInfo.setOutput(messageInfo.getName().getLocalPart(), messageInfo); partInfo = messageInfo.addMessagePart(CLOSE_RESPONSE_PART_NAME); partInfo.setElementQName(RM11Constants.INSTANCE.getCloseSequenceResponseOperationName()); partInfo.setElement(true); partInfo.setTypeClass(CloseSequenceResponseType.class); partInfo.setIndex(0); } }
Example #3
Source File: STSUtils.java From steady with Apache License 2.0 | 6 votes |
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; }
Example #4
Source File: ReflectionServiceFactoryBean.java From cxf with Apache License 2.0 | 6 votes |
protected void checkForElement(ServiceInfo serviceInfo, MessagePartInfo mpi) { SchemaInfo si = getOrCreateSchema(serviceInfo, mpi.getElementQName().getNamespaceURI(), getQualifyWrapperSchema()); XmlSchemaElement e = si.getSchema().getElementByName(mpi.getElementQName().getLocalPart()); if (e != null) { mpi.setXmlSchema(e); return; } XmlSchema schema = si.getSchema(); si.setElement(null); //cached element is now invalid XmlSchemaElement el = new XmlSchemaElement(schema, true); el.setName(mpi.getElementQName().getLocalPart()); el.setNillable(true); XmlSchemaType tp = (XmlSchemaType)mpi.getXmlSchema(); if (tp == null) { throw new ServiceConstructionException(new Message("INTRACTABLE_PART", LOG, mpi.getName(), mpi.getMessageInfo().getName())); } el.setSchemaTypeName(tp.getQName()); mpi.setXmlSchema(el); }
Example #5
Source File: STSUtils.java From cxf with Apache License 2.0 | 6 votes |
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; }
Example #6
Source File: STSUtils.java From steady with Apache License 2.0 | 6 votes |
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, "CancelSecurityToken")); MessageInfo mio = oi.createMessage(new QName(servNamespace, "CancelSecurityTokenResponseMsg"), MessageInfo.Type.OUTPUT); oi.setOutput("CancelSecurityTokenResponseMsg", mio); mpi = mio.addMessagePart("response"); mpi.setElementQName(new QName(namespace, "CancelSecurityTokenResponse")); return oi; }
Example #7
Source File: STSUtils.java From steady with Apache License 2.0 | 6 votes |
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, "CancelSecurityToken")); MessageInfo mio = oi.createMessage(new QName(servNamespace, "CancelSecurityTokenResponseMsg"), MessageInfo.Type.OUTPUT); oi.setOutput("CancelSecurityTokenResponseMsg", mio); mpi = mio.addMessagePart("response"); mpi.setElementQName(new QName(namespace, "CancelSecurityTokenResponse")); return oi; }
Example #8
Source File: CorbaStreamFaultInInterceptor.java From cxf with Apache License 2.0 | 6 votes |
private void createFaultDetail(Document faultData, FaultInfo faultInfo, Fault faultEx) { MessagePartInfo partInfo = faultInfo.getMessageParts().get(0); QName partInfoName = partInfo.getElementQName(); Document faultDoc = DOMUtils.getEmptyDocument(); Element faultElement = faultDoc.createElement("detail"); Element partElement = faultDoc.createElementNS(partInfoName.getNamespaceURI(), partInfoName.getLocalPart()); Element faultDataElement = (Element) faultData.getFirstChild(); Node node = faultDataElement.getFirstChild(); while (node != null) { Node importedFaultData = faultDoc.importNode(node, true); partElement.appendChild(importedFaultData); node = node.getNextSibling(); } faultElement.appendChild(partElement); faultEx.setDetail(faultElement); }
Example #9
Source File: ServiceWSDLBuilder.java From cxf with Apache License 2.0 | 6 votes |
protected void buildMessage(Message message, AbstractMessageContainer messageContainer, final Definition def) { addDocumentation(message, messageContainer.getMessageDocumentation()); message.setQName(messageContainer.getName()); message.setUndefined(false); def.addMessage(message); List<MessagePartInfo> messageParts = messageContainer.getMessageParts(); Part messagePart = null; for (MessagePartInfo messagePartInfo : messageParts) { messagePart = def.createPart(); messagePart.setName(messagePartInfo.getName().getLocalPart()); if (messagePartInfo.isElement()) { messagePart.setElementName(messagePartInfo.getElementQName()); addNamespace(messagePartInfo.getElementQName().getNamespaceURI(), def); } else if (messagePartInfo.getTypeQName() != null) { messagePart.setTypeName(messagePartInfo.getTypeQName()); addNamespace(messagePartInfo.getTypeQName().getNamespaceURI(), def); } message.addPart(messagePart); } }
Example #10
Source File: ParameterProcessor.java From cxf with Apache License 2.0 | 6 votes |
protected JavaParameter addParameter(MessagePartInfo mpart, JavaMethod method, JavaParameter parameter) throws ToolException { if (parameter == null) { return null; } String name = parameter.getName(); int count = 0; while (method.getParameter(parameter.getName()) != null && context.optionSet(ToolConstants.CFG_AUTORESOLVE) && parameter.getStyle() != JavaType.Style.INOUT) { parameter.setName(name + (++count)); } parameter.setMethod(method); parameter.annotate(new WebParamAnnotator(isOutOfBandHeader(mpart))); method.addParameter(parameter); return parameter; }
Example #11
Source File: WrapperClassGenerator.java From cxf with Apache License 2.0 | 6 votes |
private List<Annotation> getJaxbAnnos(MessagePartInfo mpi) { List<Annotation> list = new java.util.concurrent.CopyOnWriteArrayList<>(); Annotation[] anns = getMethodParameterAnnotations(mpi); if (anns != null) { for (Annotation anno : anns) { if (anno.annotationType() == XmlList.class || anno.annotationType() == XmlAttachmentRef.class || anno.annotationType() == XmlJavaTypeAdapter.class || anno.annotationType() == XmlMimeType.class || anno.annotationType() == XmlElement.class || anno.annotationType() == XmlElementWrapper.class) { list.add(anno); } } } return list; }
Example #12
Source File: ParameterProcessor.java From cxf with Apache License 2.0 | 6 votes |
private void processInput(JavaMethod method, MessageInfo inputMessage) throws ToolException { if (requireOutOfBandHeader()) { try { Class.forName("org.apache.cxf.binding.soap.SoapBindingFactory"); } catch (Exception e) { LOG.log(Level.WARNING, new Message("SOAP_MISSING", LOG).toString()); } } JAXWSBinding mBinding = inputMessage.getOperation().getExtensor(JAXWSBinding.class); for (MessagePartInfo part : inputMessage.getMessageParts()) { if (isOutOfBandHeader(part) && !requireOutOfBandHeader()) { continue; } JavaParameter param = getParameterFromPart(method, part, JavaType.Style.IN); if (mBinding != null && mBinding.getJaxwsParas() != null) { for (JAXWSParameter jwp : mBinding.getJaxwsParas()) { if (part.getName().getLocalPart().equals(jwp.getPart())) { param.setName(jwp.getName()); } } } addParameter(part, method, param); } }
Example #13
Source File: ParameterProcessor.java From cxf with Apache License 2.0 | 6 votes |
private void processWrappedOutput(JavaMethod method, MessageInfo inputMessage, MessageInfo outputMessage) throws ToolException { processWrappedAbstractOutput(method, inputMessage, outputMessage); // process out of band headers if (countOutOfBandHeader(outputMessage) > 0) { for (MessagePartInfo hpart : outputMessage.getMessageParts()) { if (!isOutOfBandHeader(hpart) || !requireOutOfBandHeader()) { continue; } addParameter(hpart, method, getParameterFromPart(method, hpart, JavaType.Style.OUT)); } } }
Example #14
Source File: WebFaultOutInterceptor.java From cxf with Apache License 2.0 | 6 votes |
private MessagePartInfo getFaultMessagePart(QName qname, OperationInfo op) { for (FaultInfo faultInfo : op.getFaults()) { for (MessagePartInfo mpi : faultInfo.getMessageParts()) { String ns = null; if (mpi.isElement()) { ns = mpi.getElementQName().getNamespaceURI(); } else { ns = mpi.getTypeQName().getNamespaceURI(); } if (qname.getLocalPart().equals(mpi.getConcreteName().getLocalPart()) && qname.getNamespaceURI().equals(ns)) { return mpi; } } } return null; }
Example #15
Source File: JaxWsServiceConfiguration.java From cxf with Apache License 2.0 | 6 votes |
public Boolean isWrapperPartQualified(MessagePartInfo mpi) { Annotation[] annotations = (Annotation[])mpi.getProperty("parameter.annotations"); if (annotations != null) { for (Annotation an : annotations) { String tns = null; if (an instanceof WebParam) { tns = ((WebParam)an).targetNamespace(); } else if (an instanceof WebResult) { tns = ((WebResult)an).targetNamespace(); } if (tns != null && !StringUtils.isEmpty(tns)) { return Boolean.TRUE; } } } return null; }
Example #16
Source File: ReflectionServiceFactoryBean.java From cxf with Apache License 2.0 | 6 votes |
private Map<Class<?>, Boolean> getJaxbAnnoMap(MessagePartInfo mpi) { Map<Class<?>, Boolean> map = new ConcurrentHashMap<>(4, 0.75f, 1); Annotation[] anns = getMethodParameterAnnotations(mpi); if (anns != null) { for (Annotation anno : anns) { if (anno instanceof XmlList) { map.put(XmlList.class, true); } if (anno instanceof XmlAttachmentRef) { map.put(XmlAttachmentRef.class, true); } if (anno instanceof XmlJavaTypeAdapter) { map.put(XmlJavaTypeAdapter.class, true); } if (anno instanceof XmlElementWrapper) { map.put(XmlElementWrapper.class, true); } } } return map; }
Example #17
Source File: JAXBEncoderDecoderTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testUnmarshallFromStaxEventReader() throws Exception { QName elName = new QName(wrapperAnnotation.targetNamespace(), wrapperAnnotation.localName()); MessagePartInfo part = new MessagePartInfo(elName, null); InputStream is = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq.xml"); XMLInputFactory factory = XMLInputFactory.newInstance(); FixNamespacesXMLEventReader reader = new FixNamespacesXMLEventReader(factory.createXMLEventReader(is)); assertNull(reader.getUnmarshaller()); part.setTypeClass(GreetMe.class); Unmarshaller um = context.createUnmarshaller(); Object val = JAXBEncoderDecoder.unmarshall(um, reader, part, true); assertEquals(um, reader.getUnmarshaller()); assertNotNull(val); assertTrue(val instanceof GreetMe); assertEquals("TestSOAPInputPMessage", ((GreetMe)val).getRequestType()); is.close(); }
Example #18
Source File: SoapBindingFactory.java From cxf with Apache License 2.0 | 6 votes |
private void setupHeaders(BindingOperationInfo op, BindingMessageInfo bMsg, BindingMessageInfo unwrappedBMsg, MessageInfo msg, SoapBindingConfiguration config) { List<MessagePartInfo> parts = new ArrayList<>(); for (MessagePartInfo part : msg.getMessageParts()) { if (config.isHeader(op, part)) { SoapHeaderInfo headerInfo = new SoapHeaderInfo(); headerInfo.setPart(part); headerInfo.setUse(config.getUse()); bMsg.addExtensor(headerInfo); } else { parts.add(part); } } unwrappedBMsg.setMessageParts(parts); }
Example #19
Source File: XMLStreamDataReaderTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testReadBare() throws Exception { JAXBDataBinding db = getDataBinding(TradePriceData.class); reader = getTestReader("../resources/sayHiDocLitBareReq.xml"); assertNotNull(reader); DataReader<XMLStreamReader> dr = db.createReader(XMLStreamReader.class); assertNotNull(dr); QName elName = new QName("http://apache.org/hello_world_doc_lit_bare/types", "inout"); MessagePartInfo part = new MessagePartInfo(elName, null); part.setElement(true); part.setElementQName(elName); part.setTypeClass(TradePriceData.class); Object val = dr.read(part, reader); assertNotNull(val); assertTrue(val instanceof TradePriceData); assertEquals("CXF", ((TradePriceData)val).getTickerSymbol()); assertEquals(Float.valueOf(1.0f), new Float(((TradePriceData)val).getTickerPrice())); }
Example #20
Source File: WebFaultInInterceptor.java From cxf with Apache License 2.0 | 6 votes |
private MessagePartInfo getFaultMessagePart(QName qname, OperationInfo op) { if (op.isUnwrapped() && (op instanceof UnwrappedOperationInfo)) { op = ((UnwrappedOperationInfo)op).getWrappedOperation(); } for (FaultInfo faultInfo : op.getFaults()) { for (MessagePartInfo mpi : faultInfo.getMessageParts()) { String ns = null; if (mpi.isElement()) { ns = mpi.getElementQName().getNamespaceURI(); } else { ns = mpi.getTypeQName().getNamespaceURI(); } if (qname.getLocalPart().equals(mpi.getConcreteName().getLocalPart()) && qname.getNamespaceURI().equals(ns)) { return mpi; } } } return null; }
Example #21
Source File: ReflectionServiceFactoryTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testWrappedBuild() throws Exception { Service service = createService(true); ServiceInfo si = service.getServiceInfos().get(0); InterfaceInfo intf = si.getInterface(); assertEquals(4, intf.getOperations().size()); String ns = si.getName().getNamespaceURI(); OperationInfo sayHelloOp = intf.getOperation(new QName(ns, "sayHello")); assertNotNull(sayHelloOp); assertEquals("sayHello", sayHelloOp.getInput().getName().getLocalPart()); List<MessagePartInfo> messageParts = sayHelloOp.getInput().getMessageParts(); assertEquals(1, messageParts.size()); assertNotNull(messageParts.get(0).getXmlSchema()); // test unwrapping assertTrue(sayHelloOp.isUnwrappedCapable()); OperationInfo unwrappedOp = sayHelloOp.getUnwrappedOperation(); assertEquals("sayHello", unwrappedOp.getInput().getName().getLocalPart()); messageParts = unwrappedOp.getInput().getMessageParts(); assertEquals(0, messageParts.size()); // test output messageParts = sayHelloOp.getOutput().getMessageParts(); assertEquals(1, messageParts.size()); assertEquals("sayHelloResponse", sayHelloOp.getOutput().getName().getLocalPart()); messageParts = unwrappedOp.getOutput().getMessageParts(); assertEquals("sayHelloResponse", unwrappedOp.getOutput().getName().getLocalPart()); assertEquals(1, messageParts.size()); MessagePartInfo mpi = messageParts.get(0); assertEquals("return", mpi.getName().getLocalPart()); assertEquals(String.class, mpi.getTypeClass()); }
Example #22
Source File: JAXBSchemaInitializer.java From cxf with Apache License 2.0 | 5 votes |
private void createBridgeXsElement(MessagePartInfo part, QName qn, QName typeName) { XmlSchemaElement el = null; SchemaInfo schemaInfo = serviceInfo.getSchema(qn.getNamespaceURI()); if (schemaInfo != null) { el = schemaInfo.getElementByQName(qn); if (el == null) { createXsElement(schemaInfo.getSchema(), part, typeName, schemaInfo); } else if (!typeName.equals(el.getSchemaTypeName())) { throw new Fault(new Message("CANNOT_CREATE_ELEMENT", LOG, qn, typeName, el.getSchemaTypeName())); } return; } XmlSchema schema = schemas.newXmlSchemaInCollection(qn.getNamespaceURI()); if (qualifiedSchemas) { schema.setElementFormDefault(XmlSchemaForm.QUALIFIED); } schemaInfo = new SchemaInfo(qn.getNamespaceURI(), qualifiedSchemas, false); schemaInfo.setSchema(schema); el = createXsElement(schema, part, typeName, schemaInfo); NamespaceMap nsMap = new NamespaceMap(); nsMap.add(WSDLConstants.CONVENTIONAL_TNS_PREFIX, schema.getTargetNamespace()); nsMap.add(WSDLConstants.NP_SCHEMA_XSD, WSDLConstants.NS_SCHEMA_XSD); schema.setNamespaceContext(nsMap); serviceInfo.addSchema(schemaInfo); }
Example #23
Source File: JAXBSchemaInitializer.java From cxf with Apache License 2.0 | 5 votes |
private XmlSchemaElement createXsElement(XmlSchema schema, MessagePartInfo part, QName typeName, SchemaInfo schemaInfo) { XmlSchemaElement el = new XmlSchemaElement(schema, true); el.setName(part.getElementQName().getLocalPart()); el.setNillable(true); el.setSchemaTypeName(typeName); part.setXmlSchema(el); schemaInfo.setElement(null); return el; }
Example #24
Source File: JaxWsServiceFactoryBean.java From cxf with Apache License 2.0 | 5 votes |
protected void initializeParameter(MessagePartInfo part, Class<?> rawClass, Type type) { if (implInfo.isWebServiceProvider()) { part.setTypeQName(Constants.XSD_ANYTYPE); part.setTypeClass(rawClass); return; } super.initializeParameter(part, rawClass, type); }
Example #25
Source File: DataWriterImpl.java From cxf with Apache License 2.0 | 5 votes |
private void checkPart(MessagePartInfo part, Object object) { if (part == null || part.getTypeClass() == null || object == null) { return; } Class<?> typeClass = part.getTypeClass(); if (typeClass == null) { return; } if (typeClass.isPrimitive()) { if (typeClass == Long.TYPE) { typeClass = Long.class; } else if (typeClass == Integer.TYPE) { typeClass = Integer.class; } else if (typeClass == Short.TYPE) { typeClass = Short.class; } else if (typeClass == Byte.TYPE) { typeClass = Byte.class; } else if (typeClass == Character.TYPE) { typeClass = Character.class; } else if (typeClass == Double.TYPE) { typeClass = Double.class; } else if (typeClass == Float.TYPE) { typeClass = Float.class; } else if (typeClass == Boolean.TYPE) { typeClass = Boolean.class; } } else if (typeClass.isArray() && object instanceof Collection) { //JAXB allows a pseudo [] <--> List equivalence return; } if (!typeClass.isInstance(object)) { throw new IllegalArgumentException("Part " + part.getName() + " should be of type " + typeClass.getName() + ", not " + object.getClass().getName()); } }
Example #26
Source File: ParameterMapper.java From cxf with Apache License 2.0 | 5 votes |
private static void processXmlSchemaSimpleType(XmlSchemaSimpleType xmlSchema, JavaMethod jm, JavaParameter parameter, MessagePartInfo part) { if (xmlSchema.getContent() instanceof XmlSchemaSimpleTypeList && (!part.isElement() || !jm.isWrapperStyle())) { parameter.annotate(new XmlListAnotator(jm.getInterface())); } if (Constants.XSD_HEXBIN.equals(xmlSchema.getQName()) && (!part.isElement() || !jm.isWrapperStyle())) { parameter.annotate(new XmlJavaTypeAdapterAnnotator(jm.getInterface(), HexBinaryAdapter.class)); } }
Example #27
Source File: ParameterMapper.java From cxf with Apache License 2.0 | 5 votes |
public static JavaParameter map(JavaMethod jm, MessagePartInfo part, JavaType.Style style, ToolContext context) { String name = ProcessorUtil.mangleNameToVariableName(part.getName().getLocalPart()); String namespace = ProcessorUtil.resolvePartNamespace(part); String type = ProcessorUtil.resolvePartType(part, context); JavaParameter parameter = new JavaParameter(name, type, namespace); parameter.setPartName(part.getName().getLocalPart()); if (part.getXmlSchema() instanceof XmlSchemaSimpleType) { processXmlSchemaSimpleType((XmlSchemaSimpleType)part.getXmlSchema(), jm, parameter, part); } else if (part.getXmlSchema() instanceof XmlSchemaElement) { XmlSchemaElement element = (XmlSchemaElement)part.getXmlSchema(); if (element.getSchemaType() instanceof XmlSchemaSimpleType) { processXmlSchemaSimpleType((XmlSchemaSimpleType)element.getSchemaType(), jm, parameter, part); } } parameter.setQName(ProcessorUtil.getElementName(part)); parameter.setDefaultValueWriter(ProcessorUtil.getDefaultValueWriter(part, context)); String fullJavaName = ProcessorUtil.getFullClzName(part, context, false); parameter.setClassName(fullJavaName); if (style == JavaType.Style.INOUT || style == JavaType.Style.OUT) { parameter.setHolder(true); parameter.setHolderName(javax.xml.ws.Holder.class.getName()); String holderClass = fullJavaName; if (JAXBUtils.holderClass(fullJavaName) != null) { holderClass = JAXBUtils.holderClass(fullJavaName).getName(); } parameter.setClassName(holderClass); } parameter.setStyle(style); return parameter; }
Example #28
Source File: BareOutInterceptor.java From cxf with Apache License 2.0 | 5 votes |
public void handleMessage(Message message) { Exchange exchange = message.getExchange(); BindingOperationInfo operation = exchange.getBindingOperationInfo(); if (operation == null) { return; } MessageContentsList objs = MessageContentsList.getContentsList(message); if (objs == null || objs.isEmpty()) { return; } List<MessagePartInfo> parts = null; BindingMessageInfo bmsg = null; boolean client = isRequestor(message); if (!client) { if (operation.getOutput() != null) { bmsg = operation.getOutput(); parts = bmsg.getMessageParts(); } else { // partial response to oneway return; } } else { bmsg = operation.getInput(); parts = bmsg.getMessageParts(); } writeParts(message, exchange, operation, objs, parts); }
Example #29
Source File: DefaultServiceConfiguration.java From cxf with Apache License 2.0 | 5 votes |
public Long getWrapperPartMaxOccurs(MessagePartInfo mpi) { String miString = (String)mpi.getProperty("maxOccurs"); if (miString != null) { if ("unbounded".equals(miString)) { return Long.MAX_VALUE; } return Long.valueOf(miString, 10); } // If no explicit spec and an array of bytes, default to unbounded. if (mpi.getTypeClass() != null && mpi.getTypeClass().isArray() && !Byte.TYPE.equals(mpi.getTypeClass().getComponentType())) { return Long.MAX_VALUE; } return null; }
Example #30
Source File: XMLStreamDataWriterTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testWriteRPCLit1() throws Exception { JAXBDataBinding db = getTestWriterFactory(); DataWriter<XMLStreamWriter> dw = db.createWriter(XMLStreamWriter.class); assertNotNull(dw); String val = new String("TESTOUTPUTMESSAGE"); QName elName = new QName("http://apache.org/hello_world_rpclit/types", "in"); MessagePartInfo part = new MessagePartInfo(elName, null); part.setElement(true); part.setElementQName(elName); dw.write(val, part, streamWriter); streamWriter.flush(); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); XMLStreamReader xr = inFactory.createXMLStreamReader(bais); DepthXMLStreamReader reader = new DepthXMLStreamReader(xr); StaxUtils.toNextElement(reader); assertEquals(new QName("http://apache.org/hello_world_rpclit/types", "in"), reader.getName()); StaxUtils.nextEvent(reader); StaxUtils.toNextText(reader); assertEquals("TESTOUTPUTMESSAGE", reader.getText()); }