10.6. Message Content Type Names

Since transformations occur between named types (for example, from type A to type B), it is important to understand how the type names are derived. The type of the message is determined based on the service contract, which can be WSDL or Java.
  • WSDL
    For WSDL interfaces, the message name is determined based on the fully-qualified element name of a WSDL message. Here is an example of a WSDL definition:
    <definitions xmlns:tns="urn:switchyard-quickstart:bean-service:1.0">  
      <message name="submitOrder">
        <part name="parameters" element="tns:submitOrder"/>
      </message>
      <portType name="OrderService">
        <operation name="submitOrder">
          <input message="tns:submitOrder"/>
        </operation>
      </portType>
    </definitions>
    
    This yields the following message type name based on the message element name defined in the WSDL:
    {urn:switchyard-quickstart:bean-service:1.0}submitOrder
    
  • Java
    For Java interfaces, the message name consists of the full package name and the class name prefixed with "java:". Here is an example of a Java definition:
    package org.switchyard.example;
    public interface OrderService {
        void submitOrder(Order order);
    }
    
    This yields the following message type name:
    java:org.switchyard.example.Order
    
    You may override the default operation name generated for a Java interface. The @OperationTypes annotation provides this capability by allowing you to specify the input, output, and fault type names used for a Java service interface. For example, if you want to accept XML input content without any need for transformation to a Java object model, you can change the OrderService interface as shown below:
    package org.switchyard.example;
    public interface OrderService {
        @OperationTypes(in = "{urn:switchyard-quickstart:bean-service:1.0}submitOrder")
        void submitOrder(String orderXML);
    }
    This annotation can be useful if you want to maintain a tight control over the names used for message content.