Java Code Examples for javax.wsdl.Definition#addMessage()
The following examples show how to use
javax.wsdl.Definition#addMessage() .
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: 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 2
Source File: WSDLDocCreator.java From jolie with GNU Lesser General Public License v2.1 | 5 votes |
private Message addRequestMessage( Definition localDef, OperationDeclaration op ) { Message inputMessage = localDef.createMessage(); inputMessage.setUndefined( false ); Part inputPart = localDef.createPart(); inputPart.setName( "body" ); try { // adding wsdl_types related to this message if( op instanceof OneWayOperationDeclaration ) { OneWayOperationDeclaration op_ow = (OneWayOperationDeclaration) op; // set the message name as the name of the jolie request message type inputMessage.setQName( new QName( tns, op_ow.requestType().id() ) ); addMessageType( op_ow.requestType(), op_ow.id() ); } else { RequestResponseOperationDeclaration op_rr = (RequestResponseOperationDeclaration) op; // set the message name as the name of the jolie request message type inputMessage.setQName( new QName( tns, op_rr.requestType().id() ) ); addMessageType( op_rr.requestType(), op_rr.id() ); } // set the input part as the operation name inputPart.setElementName( new QName( tnsSchema, op.id() ) ); inputMessage.addPart( inputPart ); inputMessage.setUndefined( false ); localDef.addMessage( inputMessage ); } catch( Exception e ) { e.printStackTrace(); } return inputMessage; }
Example 3
Source File: WSDLDocCreator.java From jolie with GNU Lesser General Public License v2.1 | 5 votes |
private Message addResponseMessage( Definition localDef, OperationDeclaration op ) { Message outputMessage = localDef.createMessage(); outputMessage.setUndefined( false ); Part outputPart = localDef.createPart(); outputPart.setName( "body" ); // adding wsdl_types related to this message try { RequestResponseOperationDeclaration op_rr = (RequestResponseOperationDeclaration) op; String outputPartName = op_rr.id() + "Response"; // set the message name as the name of the jolie response message type outputMessage.setQName( new QName( tns, op_rr.responseType().id() ) ); addMessageType( op_rr.responseType(), outputPartName ); outputPart.setElementName( new QName( tnsSchema, outputPartName ) ); outputMessage.addPart( outputPart ); outputMessage.setUndefined( false ); localDef.addMessage( outputMessage ); } catch( Exception e ) { e.printStackTrace(); } return outputMessage; }
Example 4
Source File: WSDLDocCreator.java From jolie with GNU Lesser General Public License v2.1 | 5 votes |
private Message addFaultMessage( Definition localDef, TypeDefinition tp ) { Message faultMessage = localDef.createMessage(); faultMessage.setUndefined( false ); // set the fault message name as the name of the fault jolie message type faultMessage.setQName( new QName( tns, tp.id() ) ); Part faultPart = localDef.createPart(); faultPart.setName( "body" ); String faultPartName = tp.id(); try { // adding wsdl_types related to this message addMessageType( tp, faultPartName ); faultPart.setElementName( new QName( tnsSchema, faultPartName ) ); faultMessage.addPart( faultPart ); faultMessage.setUndefined( false ); localDef.addMessage( faultMessage ); } catch( Exception e ) { e.printStackTrace(); } return faultMessage; }
Example 5
Source File: XTeeWsdlDefinition.java From j-road with Apache License 2.0 | 5 votes |
private void addXRoadExtensions(Definition definition) throws WSDLException { definition.addNamespace(XROAD_PREFIX, XROAD_NAMESPACE); Message message = definition.createMessage(); message.setQName(new QName(definition.getTargetNamespace(), XROAD_HEADER)); addXroadHeaderPart(definition, message, XTeeHeader.CLIENT); addXroadHeaderPart(definition, message, XTeeHeader.SERVICE); addXroadHeaderPart(definition, message, XTeeHeader.ID); addXroadHeaderPart(definition, message, XTeeHeader.USER_ID); addXroadHeaderPart(definition, message, XTeeHeader.PROTOCOL_VERSION); message.setUndefined(false); definition.addMessage(message); // Add XRoad schema import to the first schema for (Object ex : definition.getTypes().getExtensibilityElements()) { if (ex instanceof Schema) { Schema schema = (Schema) ex; Element xRoadImport = schema.getElement().getOwnerDocument().createElement(schema.getElement().getPrefix() == null ? "import" : schema.getElement().getPrefix() + ":import"); xRoadImport.setAttribute("namespace", XROAD_NAMESPACE); xRoadImport.setAttribute("schemaLocation", XROAD_NAMESPACE); schema.getElement().insertBefore(xRoadImport, schema.getElement().getFirstChild()); break; } } }
Example 6
Source File: WSDLASTVisitor.java From cxf with Apache License 2.0 | 4 votes |
private Definition getLogicalDefinition(String schemaFilename, Writer schemaWriter) throws WSDLException, JAXBException, Exception { Definition def = manager.createWSDLDefinition(targetNamespace); // checks for -T option. if (schemaFilename != null) { writeSchemaDefinition(definition, schemaWriter); manager.addWSDLSchemaImport(def, schema.getTargetNamespace(), schemaFilename); } else { // checks for -n option if (importSchemaFilename == null) { Types types = definition.getTypes(); def.setTypes(types); } else { manager.addWSDLSchemaImport(def, schema.getTargetNamespace(), importSchemaFilename); } } Collection<PortType> portTypes = CastUtils.cast(definition.getAllPortTypes().values()); for (PortType port : portTypes) { def.addPortType(port); } Collection<Message> messages = CastUtils.cast(definition.getMessages().values()); for (Message msg : messages) { def.addMessage(msg); } Collection<String> namespaces = CastUtils.cast(definition.getNamespaces().values()); for (String namespace : namespaces) { String prefix = definition.getPrefix(namespace); if (!"corba".equals(prefix)) { def.addNamespace(prefix, namespace); } else { def.removeNamespace(prefix); } } Collection<Import> imports = CastUtils.cast(definition.getImports().values()); for (Import importType : imports) { def.addImport(importType); } def.setDocumentationElement(definition.getDocumentationElement()); def.setDocumentBaseURI(definition.getDocumentBaseURI()); return def; }
Example 7
Source File: ServiceWSDLBuilder.java From cxf with Apache License 2.0 | 4 votes |
protected void buildService(ServiceInfo serviceInfo, Definition definition) { Map<QName, MessageInfo> messages = serviceInfo.getMessages(); for (Map.Entry<QName, MessageInfo> mie : messages.entrySet()) { if (!mie.getKey().getNamespaceURI().equals(definition.getTargetNamespace())) { continue; } if (definition.getMessage(mie.getKey()) != null) { continue; } Message message = definition.createMessage(); addDocumentation(message, mie.getValue().getMessageDocumentation()); message.setUndefined(false); message.setQName(mie.getKey()); for (MessagePartInfo mpi : mie.getValue().getMessageParts()) { Part part = definition.createPart(); boolean elemental = mpi.isElement(); // RFSB will turn on isElement bogusly. if (elemental && null == serviceInfo.getXmlSchemaCollection(). getElementByQName(mpi.getElementQName())) { elemental = false; } if (elemental) { part.setElementName(mpi.getElementQName()); } else { part.setTypeName(mpi.getTypeQName()); } part.setName(mpi.getName().getLocalPart()); message.addPart(part); } definition.addMessage(message); } addDocumentation(definition, serviceInfo.getTopLevelDoc()); Service serv = definition.createService(); addDocumentation(serv, serviceInfo.getDocumentation()); serv.setQName(serviceInfo.getName()); addNamespace(serviceInfo.getName().getNamespaceURI(), definition); addExtensibilityElements(definition, serv, getWSDL11Extensors(serviceInfo)); definition.addService(serv); for (EndpointInfo ei : serviceInfo.getEndpoints()) { addNamespace(ei.getTransportId(), definition); Port port = definition.createPort(); addDocumentation(port, ei.getDocumentation()); port.setName(ei.getName().getLocalPart()); port.setBinding(definition.getBinding(ei.getBinding().getName())); addExtensibilityElements(definition, port, getWSDL11Extensors(ei)); serv.addPort(port); } }