String input = null;
String output = null;
Binding fieldBinding = fieldPort.getBinding();
if (fieldBinding == null)
throw new WSIFException("Unable to locate Binding");
//Locate Service
Map sm = WSIFUtils.getAllItems( fieldDefinition, "Service" );
Iterator services = sm.values().iterator();
while (services.hasNext() && serviceName ==null) {
javax.wsdl.Service s = (javax.wsdl.Service)services.next();
for (Iterator ports = s.getPorts().values().iterator(); ports.hasNext();) {
javax.wsdl.Port p = (javax.wsdl.Port)ports.next();
if (p.getBinding() != null && p.getBinding().getQName().equals(fieldBinding.getQName())) {
// Binding found
serviceName = s.getQName();
break;
}
}
}
if (serviceName == null)
throw new WSIFException("Unable to locate Service");
// Find the operation, if the Port only contains 1 operation then use
// that one, otherwise use the one defined in the JMS message properties.
javax.wsdl.PortType portType = fieldBinding.getPortType();
if (portType!= null) {
List operations = portType.getOperations();
if (operations != null && operations.size() == 1 ) {
javax.wsdl.Operation o = (javax.wsdl.Operation)operations.get(0);
operationName = o.getName();
if (o.getInput() != null) {
input = o.getInput().getName();
}
if (o.getOutput() != null) {
output = o.getOutput().getName();
}
}
}
if (operationName == null) {
try {
operationName = msg.getStringProperty( WSIFConstants.JMS_PROP_OPERATION_NAME );
input = msg.getStringProperty( WSIFConstants.JMS_PROP_INPUT_NAME );
output = msg.getStringProperty( WSIFConstants.JMS_PROP_OUTPUT_NAME );
} catch (javax.jms.JMSException e) {
Trc.exception(e);
}
}
if (operationName == null)
throw new WSIFException( "Unable to determine Operation" );
WSIFRequest request = new WSIFRequest( serviceName );
request.setPortName( fieldPort.getName() );
request.setOperationName( operationName );