Java Code Examples for javax.wsdl.Message#setUndefined()

The following examples show how to use javax.wsdl.Message#setUndefined() . 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: WSDLDocCreator.java    From jolie with GNU Lesser General Public License v2.1 6 votes vote down vote up
private Operation addOWOperation2PT( Definition def, PortType pt, OneWayOperationDeclaration op ) {
	Operation wsdlOp = def.createOperation();

	wsdlOp.setName( op.id() );
	wsdlOp.setStyle( OperationType.ONE_WAY );
	wsdlOp.setUndefined( false );

	Input in = def.createInput();
	Message msg_req = addRequestMessage( localDef, op );
	msg_req.setUndefined( false );
	in.setMessage( msg_req );
	wsdlOp.setInput( in );
	wsdlOp.setUndefined( false );

	pt.addOperation( wsdlOp );

	return wsdlOp;
}
 
Example 2
Source File: ExceptionVisitor.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void createFaultMessage(QName qname) {
    String exceptionName = qname.getLocalPart();
    // messages
    Message faultMsg = definition.createMessage();

    faultMsg.setQName(new QName(definition.getTargetNamespace(), exceptionName));
    faultMsg.setUndefined(false);
    // message - part
    Part part = definition.createPart();
    part.setName("exception");
    part.setElementName(qname);
    faultMsg.addPart(part);

    //add the fault element namespace to the definition
    String nsURI = qname.getNamespaceURI();
    manager.addWSDLDefinitionNamespace(definition, mapper.mapNSToPrefix(nsURI), nsURI);

    definition.addMessage(faultMsg);
}
 
Example 3
Source File: AttributeVisitor.java    From cxf with Apache License 2.0 6 votes vote down vote up
private Message generateMessage(XmlSchemaElement element, String name) {
    Part part = definition.createPart();
    part.setName(PART_NAME);
    part.setElementName(element.getQName());

    Message result = definition.createMessage();

    QName qName = new QName(definition.getTargetNamespace(), name);
    if (definition.getMessage(qName) != null) {
        String newName = getScope().toString() + "." + name;
        qName = new QName(definition.getTargetNamespace(), newName);
    }


    result.setQName(qName);
    result.addPart(part);
    result.setUndefined(false);
    definition.addMessage(result);

    return result;
}
 
Example 4
Source File: ServiceWSDLBuilder.java    From cxf with Apache License 2.0 6 votes vote down vote up
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 5
Source File: WSDLDocCreator.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
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 6
Source File: WSDLDocCreator.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
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 7
Source File: WSDLDocCreator.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
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 8
Source File: XTeeWsdlDefinition.java    From j-road with Apache License 2.0 5 votes vote down vote up
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 9
Source File: OperationVisitor.java    From cxf with Apache License 2.0 5 votes vote down vote up
public Message generateInputMessage(Operation operation, BindingOperation bindingOperation) {
    Message msg = definition.createMessage();
    QName msgName;
    if (!mapper.isDefaultMapping()) {
        //mangle the message name
        //REVISIT, do we put in the entire scope for mangling
        msgName = new QName(definition.getTargetNamespace(),
                            getScope().tail() + "." + operation.getName());
    } else {
        msgName = new QName(definition.getTargetNamespace(), operation.getName());
    }
    msg.setQName(msgName);
    msg.setUndefined(false);

    String inputName = operation.getName() + REQUEST_SUFFIX;
    Input input = definition.createInput();
    input.setName(inputName);
    input.setMessage(msg);

    BindingInput bindingInput = definition.createBindingInput();
    bindingInput.setName(inputName);

    bindingOperation.setBindingInput(bindingInput);
    operation.setInput(input);

    definition.addMessage(msg);

    return msg;
}
 
Example 10
Source File: OperationVisitor.java    From cxf with Apache License 2.0 5 votes vote down vote up
public Message generateOutputMessage(Operation operation, BindingOperation bindingOperation) {
    Message msg = definition.createMessage();
    QName msgName;
    if (!mapper.isDefaultMapping()) {
        //mangle the message name
        //REVISIT, do we put in the entire scope for mangling
        msgName = new QName(definition.getTargetNamespace(),
                            getScope().tail() + "." + operation.getName() + RESPONSE_SUFFIX);
    } else {
        msgName = new QName(definition.getTargetNamespace(),
                            operation.getName() + RESPONSE_SUFFIX);
    }
    msg.setQName(msgName);
    msg.setUndefined(false);

    String outputName = operation.getName() + RESPONSE_SUFFIX;
    Output output = definition.createOutput();
    output.setName(outputName);
    output.setMessage(msg);

    BindingOutput bindingOutput = definition.createBindingOutput();
    bindingOutput.setName(outputName);

    bindingOperation.setBindingOutput(bindingOutput);
    operation.setOutput(output);

    definition.addMessage(msg);

    return msg;
}
 
Example 11
Source File: ServiceWSDLBuilder.java    From cxf with Apache License 2.0 4 votes vote down vote up
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);
        }
    }