Java源码示例:com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation

示例1
public String getOutputAction(Packet packet) {
    //String action = AddressingVersion.UNSET_OUTPUT_ACTION;
    String action = null;
    WSDLOperationMapping wsdlOp = packet.getWSDLOperationMapping();
    if (wsdlOp != null) {
        JavaMethod javaMethod = wsdlOp.getJavaMethod();
        if (javaMethod != null) {
            JavaMethodImpl jm = (JavaMethodImpl) javaMethod;
            if (jm != null && jm.getOutputAction() != null && !jm.getOutputAction().equals("")) {
                return jm.getOutputAction();
            }
        }
        WSDLBoundOperation wbo = wsdlOp.getWSDLBoundOperation();
        if (wbo != null) return getOutputAction(wbo);
    }
    return action;
}
 
示例2
@Override
protected void validateAction(Packet packet) {
    //There may not be a WSDL operation.  There may not even be a WSDL.
    //For instance this may be a RM CreateSequence message.
    WSDLBoundOperation wbo = getWSDLBoundOperation(packet);

    if (wbo == null)    return;

    String gotA = AddressingUtils.getAction(
            packet.getMessage().getHeaders(),
            addressingVersion, soapVersion);
    if (gotA == null)
        throw new WebServiceException(AddressingMessages.VALIDATION_CLIENT_NULL_ACTION());

    String expected = helper.getOutputAction(packet);

    if (expected != null && !gotA.equals(expected))
        throw new ActionNotSupportedException(gotA);
}
 
示例3
public String getSOAPAction(Packet packet) {
    String action = "";

    if (packet == null || packet.getMessage() == null) {
        return action;
    }

    if (wsdlPort == null) {
        return action;
    }

    WSDLOperationMapping wsdlOp = packet.getWSDLOperationMapping();
    if (wsdlOp == null) {
        return action;
    }

    WSDLBoundOperation op = wsdlOp.getWSDLBoundOperation();
    action = op.getSOAPAction();
    return action;
}
 
示例4
/**
 * This method gives the Input addressing Action for a message.
 * It gives the Action set in the wsdl operation for the corresponding payload.
 * If it is not explicitly set, it gives the soapAction
 * @param packet
 * @return input Action
 */
public String getEffectiveInputAction(Packet packet) {
    //non-default SOAPAction beomes wsa:action
    if(packet.soapAction != null && !packet.soapAction.equals("")) {
        return packet.soapAction;
    }
    String action;

    if (wsdlPort != null) {
        WSDLOperationMapping wsdlOp = packet.getWSDLOperationMapping();
        if (wsdlOp != null) {
            WSDLBoundOperation wbo = wsdlOp.getWSDLBoundOperation();
            WSDLOperation op = wbo.getOperation();
            action = op.getInput().getAction();
        } else {
            action = packet.soapAction;
        }
    } else {
        action = packet.soapAction;
    }
    return action;
}
 
示例5
@Override
protected void validateAction(Packet packet) {
    //There may not be a WSDL operation.  There may not even be a WSDL.
    //For instance this may be a RM CreateSequence message.
    WSDLBoundOperation wbo = getWSDLBoundOperation(packet);

    if (wbo == null)    return;

    String gotA = AddressingUtils.getAction(
            packet.getMessage().getHeaders(),
            addressingVersion, soapVersion);
    if (gotA == null)
        throw new WebServiceException(AddressingMessages.VALIDATION_CLIENT_NULL_ACTION());

    String expected = helper.getOutputAction(packet);

    if (expected != null && !gotA.equals(expected))
        throw new ActionNotSupportedException(gotA);
}
 
示例6
public String getFaultAction(Packet requestPacket, Packet responsePacket) {
    String action = null;
    if(seiModel != null) {
        action = getFaultActionFromSEIModel(requestPacket,responsePacket);
    }
    if (action != null) {
        return action;
    } else {
        action = addVer.getDefaultFaultAction();
    }
    if (wsdlPort != null) {
        WSDLOperationMapping wsdlOp = requestPacket.getWSDLOperationMapping();
        if (wsdlOp != null) {
            WSDLBoundOperation wbo = wsdlOp.getWSDLBoundOperation();
            return getFaultAction(wbo, responsePacket);
        }
    }
    return action;
}
 
示例7
public String getFaultAction(Packet requestPacket, Packet responsePacket) {
    String action = null;
    if(seiModel != null) {
        action = getFaultActionFromSEIModel(requestPacket,responsePacket);
    }
    if (action != null) {
        return action;
    } else {
        action = addVer.getDefaultFaultAction();
    }
    if (wsdlPort != null) {
        WSDLOperationMapping wsdlOp = requestPacket.getWSDLOperationMapping();
        if (wsdlOp != null) {
            WSDLBoundOperation wbo = wsdlOp.getWSDLBoundOperation();
            return getFaultAction(wbo, responsePacket);
        }
    }
    return action;
}
 
示例8
public String getFaultAction(Packet requestPacket, Packet responsePacket) {
    String action = null;
    if(seiModel != null) {
        action = getFaultActionFromSEIModel(requestPacket,responsePacket);
    }
    if (action != null) {
        return action;
    } else {
        action = addVer.getDefaultFaultAction();
    }
    if (wsdlPort != null) {
        WSDLOperationMapping wsdlOp = requestPacket.getWSDLOperationMapping();
        if (wsdlOp != null) {
            WSDLBoundOperation wbo = wsdlOp.getWSDLBoundOperation();
            return getFaultAction(wbo, responsePacket);
        }
    }
    return action;
}
 
示例9
public String getFaultAction(Packet requestPacket, Packet responsePacket) {
    String action = null;
    if(seiModel != null) {
        action = getFaultActionFromSEIModel(requestPacket,responsePacket);
    }
    if (action != null) {
        return action;
    } else {
        action = addVer.getDefaultFaultAction();
    }
    if (wsdlPort != null) {
        WSDLOperationMapping wsdlOp = requestPacket.getWSDLOperationMapping();
        if (wsdlOp != null) {
            WSDLBoundOperation wbo = wsdlOp.getWSDLBoundOperation();
            return getFaultAction(wbo, responsePacket);
        }
    }
    return action;
}
 
示例10
@Override
protected void checkMandatoryHeaders(
        Packet packet, boolean foundAction, boolean foundTo, boolean foundReplyTo,
        boolean foundFaultTo, boolean foundMessageId, boolean foundRelatesTo) {
    super.checkMandatoryHeaders(packet, foundAction, foundTo, foundReplyTo,
            foundFaultTo, foundMessageId, foundRelatesTo);

    // find Req/Response or Oneway using WSDLModel(if it is availabe)
    WSDLBoundOperation wbo = getWSDLBoundOperation(packet);
    // Taking care of protocol messages as they do not have any corresponding operations
    if (wbo != null) {
        // if two-way and no wsa:MessageID is found
        if (!wbo.getOperation().isOneWay() && !foundMessageId) {
            throw new MissingAddressingHeaderException(addressingVersion.messageIDTag,packet);
        }
    }

}
 
示例11
public String getSOAPAction(Packet packet) {
    String action = "";

    if (packet == null || packet.getMessage() == null) {
        return action;
    }

    if (wsdlPort == null) {
        return action;
    }

    WSDLOperationMapping wsdlOp = packet.getWSDLOperationMapping();
    if (wsdlOp == null) {
        return action;
    }

    WSDLBoundOperation op = wsdlOp.getWSDLBoundOperation();
    action = op.getSOAPAction();
    return action;
}
 
示例12
public String getOutputAction(Packet packet) {
    //String action = AddressingVersion.UNSET_OUTPUT_ACTION;
    String action = null;
    WSDLOperationMapping wsdlOp = packet.getWSDLOperationMapping();
    if (wsdlOp != null) {
        JavaMethod javaMethod = wsdlOp.getJavaMethod();
        if (javaMethod != null) {
            JavaMethodImpl jm = (JavaMethodImpl) javaMethod;
            if (jm != null && jm.getOutputAction() != null && !jm.getOutputAction().equals("")) {
                return jm.getOutputAction();
            }
        }
        WSDLBoundOperation wbo = wsdlOp.getWSDLBoundOperation();
        if (wbo != null) return getOutputAction(wbo);
    }
    return action;
}
 
示例13
public String getOutputAction(Packet packet) {
    //String action = AddressingVersion.UNSET_OUTPUT_ACTION;
    String action = null;
    WSDLOperationMapping wsdlOp = packet.getWSDLOperationMapping();
    if (wsdlOp != null) {
        JavaMethod javaMethod = wsdlOp.getJavaMethod();
        if (javaMethod != null) {
            JavaMethodImpl jm = (JavaMethodImpl) javaMethod;
            if (jm != null && jm.getOutputAction() != null && !jm.getOutputAction().equals("")) {
                return jm.getOutputAction();
            }
        }
        WSDLBoundOperation wbo = wsdlOp.getWSDLBoundOperation();
        if (wbo != null) return getOutputAction(wbo);
    }
    return action;
}
 
示例14
@Override
protected void checkAnonymousSemantics(WSDLBoundOperation wbo, WSEndpointReference replyTo, WSEndpointReference faultTo) {
    String replyToValue = null;
    String faultToValue = null;

    if (replyTo != null)
        replyToValue = replyTo.getAddress();

    if (faultTo != null)
        faultToValue = faultTo.getAddress();
    WSDLBoundOperation.ANONYMOUS responseRequirement = getResponseRequirement(wbo);

    switch (responseRequirement) {
        case prohibited:
            if (replyToValue != null && replyToValue.equals(addressingVersion.anonymousUri))
                throw new InvalidAddressingHeaderException(addressingVersion.replyToTag, ONLY_NON_ANONYMOUS_ADDRESS_SUPPORTED);

            if (faultToValue != null && faultToValue.equals(addressingVersion.anonymousUri))
                throw new InvalidAddressingHeaderException(addressingVersion.faultToTag, ONLY_NON_ANONYMOUS_ADDRESS_SUPPORTED);
            break;
        case required:
            if (replyToValue != null && !replyToValue.equals(addressingVersion.anonymousUri))
                throw new InvalidAddressingHeaderException(addressingVersion.replyToTag, ONLY_ANONYMOUS_ADDRESS_SUPPORTED);

            if (faultToValue != null && !faultToValue.equals(addressingVersion.anonymousUri))
                throw new InvalidAddressingHeaderException(addressingVersion.faultToTag, ONLY_ANONYMOUS_ADDRESS_SUPPORTED);
            break;
        default:
            // ALL: no check
    }
}
 
示例15
@Override
protected void checkMandatoryHeaders(Packet packet, boolean foundAction, boolean foundTo, boolean foundReplyTo,
        boolean foundFaultTo, boolean foundMessageId, boolean foundRelatesTo) {

    super.checkMandatoryHeaders(packet, foundAction, foundTo, foundReplyTo,
            foundFaultTo, foundMessageId, foundRelatesTo);

    // if no wsa:To header is found
    if (!foundTo)
        throw new MissingAddressingHeaderException(addressingVersion.toTag,packet);

    //we can find Req/Response or Oneway only with WSDLModel
    if (wsdlPort != null) {
        WSDLBoundOperation wbo = getWSDLBoundOperation(packet);
        // if two-way, must contain wsa:ReplyTo
        // Unlike W3C version, we cannot assume default value as anonymous if not present.
        // For protocol messages, don't check as they do not have any corresponding wsdl operations
        if (wbo != null && !wbo.getOperation().isOneWay() && !foundReplyTo) {
            throw new MissingAddressingHeaderException(addressingVersion.replyToTag,packet);
        }
    }
    if (!validation.equals(MemberSubmissionAddressing.Validation.LAX)) {
        // wsa:MessageId is required if wsa:ReplyTo is present.
        if ((foundReplyTo || foundFaultTo) && !foundMessageId)
            throw new MissingAddressingHeaderException(addressingVersion.messageIDTag,packet);
    }
}
 
示例16
@Override
protected void validateAction(Packet packet) {
    //There may not be a WSDL operation.  There may not even be a WSDL.
    //For instance this may be a RM CreateSequence message.
    WSDLBoundOperation wsdlBoundOperation = getWSDLBoundOperation(packet);

    if (wsdlBoundOperation == null) {
        return;
    }

    String gotA = AddressingUtils.getAction(
            packet.getMessage().getHeaders(),
            addressingVersion, soapVersion);

    if (gotA == null) {
        throw new WebServiceException(AddressingMessages.VALIDATION_SERVER_NULL_ACTION());
    }

    String expected = helper.getInputAction(packet);
    String soapAction = helper.getSOAPAction(packet);
    if (helper.isInputActionDefault(packet) && (soapAction != null && !soapAction.equals(""))) {
        expected = soapAction;
    }

    if (expected != null && !gotA.equals(expected)) {
        throw new ActionNotSupportedException(gotA);
    }
}
 
示例17
@Override
protected void checkMessageAddressingProperties(Packet packet) {
    super.checkMessageAddressingProperties(packet);

    // wsaw:Anonymous validation
    WSDLBoundOperation wsdlBoundOperation = getWSDLBoundOperation(packet);
    checkAnonymousSemantics(wsdlBoundOperation, replyTo, faultTo);
     // check if addresses are valid
    checkNonAnonymousAddresses(replyTo,faultTo);
}
 
示例18
public String getInputAction(Packet packet) {
    String action = null;

    if (wsdlPort != null) {
        WSDLOperationMapping wsdlOp = packet.getWSDLOperationMapping();
        if (wsdlOp != null) {
            WSDLBoundOperation wbo = wsdlOp.getWSDLBoundOperation();
            WSDLOperation op = wbo.getOperation();
            action = op.getInput().getAction();
        }
    }

    return action;
}
 
示例19
private WSDLBoundOperation.ANONYMOUS getResponseRequirement(@Nullable WSDLBoundOperation wbo) {
    try {
        if (af.getResponses() == AddressingFeature.Responses.ANONYMOUS) {
            return WSDLBoundOperation.ANONYMOUS.required;
        } else if (af.getResponses() == AddressingFeature.Responses.NON_ANONYMOUS) {
            return WSDLBoundOperation.ANONYMOUS.prohibited;
        }
    } catch (NoSuchMethodError e) {
        //Ignore error, defaut to optional
    }
    //wsaw wsdl binding case will have some value set on wbo
    return wbo != null ? wbo.getAnonymous() : WSDLBoundOperation.ANONYMOUS.optional;
}
 
示例20
@Override
protected void checkAnonymousSemantics(WSDLBoundOperation wbo, WSEndpointReference replyTo, WSEndpointReference faultTo) {
    String replyToValue = null;
    String faultToValue = null;

    if (replyTo != null)
        replyToValue = replyTo.getAddress();

    if (faultTo != null)
        faultToValue = faultTo.getAddress();
    WSDLBoundOperation.ANONYMOUS responseRequirement = getResponseRequirement(wbo);

    switch (responseRequirement) {
        case prohibited:
            if (replyToValue != null && replyToValue.equals(addressingVersion.anonymousUri))
                throw new InvalidAddressingHeaderException(addressingVersion.replyToTag, ONLY_NON_ANONYMOUS_ADDRESS_SUPPORTED);

            if (faultToValue != null && faultToValue.equals(addressingVersion.anonymousUri))
                throw new InvalidAddressingHeaderException(addressingVersion.faultToTag, ONLY_NON_ANONYMOUS_ADDRESS_SUPPORTED);
            break;
        case required:
            if (replyToValue != null && !replyToValue.equals(addressingVersion.anonymousUri))
                throw new InvalidAddressingHeaderException(addressingVersion.replyToTag, ONLY_ANONYMOUS_ADDRESS_SUPPORTED);

            if (faultToValue != null && !faultToValue.equals(addressingVersion.anonymousUri))
                throw new InvalidAddressingHeaderException(addressingVersion.faultToTag, ONLY_ANONYMOUS_ADDRESS_SUPPORTED);
            break;
        default:
            // ALL: no check
    }
}
 
示例21
@Override
protected void checkMessageAddressingProperties(Packet packet) {
    super.checkMessageAddressingProperties(packet);

    // wsaw:Anonymous validation
    WSDLBoundOperation wsdlBoundOperation = getWSDLBoundOperation(packet);
    checkAnonymousSemantics(wsdlBoundOperation, replyTo, faultTo);
     // check if addresses are valid
    checkNonAnonymousAddresses(replyTo,faultTo);
}
 
示例22
private WSDLBoundOperation.ANONYMOUS getResponseRequirement(@Nullable WSDLBoundOperation wbo) {
    try {
        if (af.getResponses() == AddressingFeature.Responses.ANONYMOUS) {
            return WSDLBoundOperation.ANONYMOUS.required;
        } else if (af.getResponses() == AddressingFeature.Responses.NON_ANONYMOUS) {
            return WSDLBoundOperation.ANONYMOUS.prohibited;
        }
    } catch (NoSuchMethodError e) {
        //Ignore error, defaut to optional
    }
    //wsaw wsdl binding case will have some value set on wbo
    return wbo != null ? wbo.getAnonymous() : WSDLBoundOperation.ANONYMOUS.optional;
}
 
示例23
@Override
public void addBindingOperationInputExtension(final TypedXmlWriter input, final JavaMethod method) {
    LOGGER.entering();
    final QName operationName = new QName(method.getOwner().getTargetNamespace(), method.getOperationName());
    selectAndProcessBindingSubject(input, WSDLBoundOperation.class, ScopeType.INPUT_MESSAGE, operationName);
    LOGGER.exiting();
}
 
示例24
@Override
public void addBindingOperationInputExtension(final TypedXmlWriter input, final JavaMethod method) {
    LOGGER.entering();
    final QName operationName = new QName(method.getOwner().getTargetNamespace(), method.getOperationName());
    selectAndProcessBindingSubject(input, WSDLBoundOperation.class, ScopeType.INPUT_MESSAGE, operationName);
    LOGGER.exiting();
}
 
示例25
@Override
protected void checkMessageAddressingProperties(Packet packet) {
    super.checkMessageAddressingProperties(packet);

    // wsaw:Anonymous validation
    WSDLBoundOperation wsdlBoundOperation = getWSDLBoundOperation(packet);
    checkAnonymousSemantics(wsdlBoundOperation, replyTo, faultTo);
     // check if addresses are valid
    checkNonAnonymousAddresses(replyTo,faultTo);
}
 
示例26
@Override
protected void checkMandatoryHeaders(Packet packet, boolean foundAction, boolean foundTo, boolean foundReplyTo,
        boolean foundFaultTo, boolean foundMessageId, boolean foundRelatesTo) {

    super.checkMandatoryHeaders(packet, foundAction, foundTo, foundReplyTo,
            foundFaultTo, foundMessageId, foundRelatesTo);

    // if no wsa:To header is found
    if (!foundTo)
        throw new MissingAddressingHeaderException(addressingVersion.toTag,packet);

    //we can find Req/Response or Oneway only with WSDLModel
    if (wsdlPort != null) {
        WSDLBoundOperation wbo = getWSDLBoundOperation(packet);
        // if two-way, must contain wsa:ReplyTo
        // Unlike W3C version, we cannot assume default value as anonymous if not present.
        // For protocol messages, don't check as they do not have any corresponding wsdl operations
        if (wbo != null && !wbo.getOperation().isOneWay() && !foundReplyTo) {
            throw new MissingAddressingHeaderException(addressingVersion.replyToTag,packet);
        }
    }
    if (!validation.equals(MemberSubmissionAddressing.Validation.LAX)) {
        // wsa:MessageId is required if wsa:ReplyTo is present.
        if ((foundReplyTo || foundFaultTo) && !foundMessageId)
            throw new MissingAddressingHeaderException(addressingVersion.messageIDTag,packet);
    }
}
 
示例27
private WSDLBoundOperation.ANONYMOUS getResponseRequirement(@Nullable WSDLBoundOperation wbo) {
    try {
        if (af.getResponses() == AddressingFeature.Responses.ANONYMOUS) {
            return WSDLBoundOperation.ANONYMOUS.required;
        } else if (af.getResponses() == AddressingFeature.Responses.NON_ANONYMOUS) {
            return WSDLBoundOperation.ANONYMOUS.prohibited;
        }
    } catch (NoSuchMethodError e) {
        //Ignore error, defaut to optional
    }
    //wsaw wsdl binding case will have some value set on wbo
    return wbo != null ? wbo.getAnonymous() : WSDLBoundOperation.ANONYMOUS.optional;
}
 
示例28
@Override
protected void checkAnonymousSemantics(WSDLBoundOperation wbo, WSEndpointReference replyTo, WSEndpointReference faultTo) {
    String replyToValue = null;
    String faultToValue = null;

    if (replyTo != null)
        replyToValue = replyTo.getAddress();

    if (faultTo != null)
        faultToValue = faultTo.getAddress();
    WSDLBoundOperation.ANONYMOUS responseRequirement = getResponseRequirement(wbo);

    switch (responseRequirement) {
        case prohibited:
            if (replyToValue != null && replyToValue.equals(addressingVersion.anonymousUri))
                throw new InvalidAddressingHeaderException(addressingVersion.replyToTag, ONLY_NON_ANONYMOUS_ADDRESS_SUPPORTED);

            if (faultToValue != null && faultToValue.equals(addressingVersion.anonymousUri))
                throw new InvalidAddressingHeaderException(addressingVersion.faultToTag, ONLY_NON_ANONYMOUS_ADDRESS_SUPPORTED);
            break;
        case required:
            if (replyToValue != null && !replyToValue.equals(addressingVersion.anonymousUri))
                throw new InvalidAddressingHeaderException(addressingVersion.replyToTag, ONLY_ANONYMOUS_ADDRESS_SUPPORTED);

            if (faultToValue != null && !faultToValue.equals(addressingVersion.anonymousUri))
                throw new InvalidAddressingHeaderException(addressingVersion.faultToTag, ONLY_ANONYMOUS_ADDRESS_SUPPORTED);
            break;
        default:
            // ALL: no check
    }
}
 
示例29
protected final WSDLBoundOperation getWSDLBoundOperation(Packet packet) {
    //we can find Req/Response or Oneway only with WSDLModel
    if(wsdlPort == null)
        return null;
    QName opName = packet.getWSDLOperation();
    if(opName != null)
        return wsdlPort.getBinding().get(opName);
    return null;
}
 
示例30
@Override
protected void checkAnonymousSemantics(WSDLBoundOperation wbo, WSEndpointReference replyTo, WSEndpointReference faultTo) {
    String replyToValue = null;
    String faultToValue = null;

    if (replyTo != null)
        replyToValue = replyTo.getAddress();

    if (faultTo != null)
        faultToValue = faultTo.getAddress();
    WSDLBoundOperation.ANONYMOUS responseRequirement = getResponseRequirement(wbo);

    switch (responseRequirement) {
        case prohibited:
            if (replyToValue != null && replyToValue.equals(addressingVersion.anonymousUri))
                throw new InvalidAddressingHeaderException(addressingVersion.replyToTag, ONLY_NON_ANONYMOUS_ADDRESS_SUPPORTED);

            if (faultToValue != null && faultToValue.equals(addressingVersion.anonymousUri))
                throw new InvalidAddressingHeaderException(addressingVersion.faultToTag, ONLY_NON_ANONYMOUS_ADDRESS_SUPPORTED);
            break;
        case required:
            if (replyToValue != null && !replyToValue.equals(addressingVersion.anonymousUri))
                throw new InvalidAddressingHeaderException(addressingVersion.replyToTag, ONLY_ANONYMOUS_ADDRESS_SUPPORTED);

            if (faultToValue != null && !faultToValue.equals(addressingVersion.anonymousUri))
                throw new InvalidAddressingHeaderException(addressingVersion.faultToTag, ONLY_ANONYMOUS_ADDRESS_SUPPORTED);
            break;
        default:
            // ALL: no check
    }
}