com.sun.xml.internal.ws.addressing.model.InvalidAddressingHeaderException Java Examples

The following examples show how to use com.sun.xml.internal.ws.addressing.model.InvalidAddressingHeaderException. 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: WsaServerTube.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("ResultOfObjectAllocationIgnored")
private void checkNonAnonymousAddresses(WSEndpointReference replyTo, WSEndpointReference faultTo) {
    if (!replyTo.isAnonymous()) {
        try {
            new EndpointAddress(URI.create(replyTo.getAddress()));
        } catch (Exception e) {
            throw new InvalidAddressingHeaderException(addressingVersion.replyToTag, addressingVersion.invalidAddressTag);
        }
    }
    //for now only validate ReplyTo
    /*
    if (!faultTo.isAnonymous()) {
        try {
            new EndpointAddress(URI.create(faultTo.getAddress()));
        } catch (IllegalArgumentException e) {
            throw new InvalidAddressingHeaderException(addressingVersion.faultToTag, addressingVersion.invalidAddressTag);
        }
    }
    */

}
 
Example #2
Source File: WsaServerTube.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("ResultOfObjectAllocationIgnored")
private void checkNonAnonymousAddresses(WSEndpointReference replyTo, WSEndpointReference faultTo) {
    if (!replyTo.isAnonymous()) {
        try {
            new EndpointAddress(URI.create(replyTo.getAddress()));
        } catch (Exception e) {
            throw new InvalidAddressingHeaderException(addressingVersion.replyToTag, addressingVersion.invalidAddressTag);
        }
    }
    //for now only validate ReplyTo
    /*
    if (!faultTo.isAnonymous()) {
        try {
            new EndpointAddress(URI.create(faultTo.getAddress()));
        } catch (IllegalArgumentException e) {
            throw new InvalidAddressingHeaderException(addressingVersion.faultToTag, addressingVersion.invalidAddressTag);
        }
    }
    */

}
 
Example #3
Source File: WsaServerTube.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("ResultOfObjectAllocationIgnored")
private void checkNonAnonymousAddresses(WSEndpointReference replyTo, WSEndpointReference faultTo) {
    if (!replyTo.isAnonymous()) {
        try {
            new EndpointAddress(URI.create(replyTo.getAddress()));
        } catch (Exception e) {
            throw new InvalidAddressingHeaderException(addressingVersion.replyToTag, addressingVersion.invalidAddressTag);
        }
    }
    //for now only validate ReplyTo
    /*
    if (!faultTo.isAnonymous()) {
        try {
            new EndpointAddress(URI.create(faultTo.getAddress()));
        } catch (IllegalArgumentException e) {
            throw new InvalidAddressingHeaderException(addressingVersion.faultToTag, addressingVersion.invalidAddressTag);
        }
    }
    */

}
 
Example #4
Source File: WsaServerTube.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("ResultOfObjectAllocationIgnored")
private void checkNonAnonymousAddresses(WSEndpointReference replyTo, WSEndpointReference faultTo) {
    if (!replyTo.isAnonymous()) {
        try {
            new EndpointAddress(URI.create(replyTo.getAddress()));
        } catch (Exception e) {
            throw new InvalidAddressingHeaderException(addressingVersion.replyToTag, addressingVersion.invalidAddressTag);
        }
    }
    //for now only validate ReplyTo
    /*
    if (!faultTo.isAnonymous()) {
        try {
            new EndpointAddress(URI.create(faultTo.getAddress()));
        } catch (IllegalArgumentException e) {
            throw new InvalidAddressingHeaderException(addressingVersion.faultToTag, addressingVersion.invalidAddressTag);
        }
    }
    */

}
 
Example #5
Source File: WsaServerTube.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("ResultOfObjectAllocationIgnored")
private void checkNonAnonymousAddresses(WSEndpointReference replyTo, WSEndpointReference faultTo) {
    if (!replyTo.isAnonymous()) {
        try {
            new EndpointAddress(URI.create(replyTo.getAddress()));
        } catch (Exception e) {
            throw new InvalidAddressingHeaderException(addressingVersion.replyToTag, addressingVersion.invalidAddressTag);
        }
    }
    //for now only validate ReplyTo
    /*
    if (!faultTo.isAnonymous()) {
        try {
            new EndpointAddress(URI.create(faultTo.getAddress()));
        } catch (IllegalArgumentException e) {
            throw new InvalidAddressingHeaderException(addressingVersion.faultToTag, addressingVersion.invalidAddressTag);
        }
    }
    */

}
 
Example #6
Source File: WsaServerTube.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("ResultOfObjectAllocationIgnored")
private void checkNonAnonymousAddresses(WSEndpointReference replyTo, WSEndpointReference faultTo) {
    if (!replyTo.isAnonymous()) {
        try {
            new EndpointAddress(URI.create(replyTo.getAddress()));
        } catch (Exception e) {
            throw new InvalidAddressingHeaderException(addressingVersion.replyToTag, addressingVersion.invalidAddressTag);
        }
    }
    //for now only validate ReplyTo
    /*
    if (!faultTo.isAnonymous()) {
        try {
            new EndpointAddress(URI.create(faultTo.getAddress()));
        } catch (IllegalArgumentException e) {
            throw new InvalidAddressingHeaderException(addressingVersion.faultToTag, addressingVersion.invalidAddressTag);
        }
    }
    */

}
 
Example #7
Source File: WsaServerTube.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("ResultOfObjectAllocationIgnored")
private void checkNonAnonymousAddresses(WSEndpointReference replyTo, WSEndpointReference faultTo) {
    if (!replyTo.isAnonymous()) {
        try {
            new EndpointAddress(URI.create(replyTo.getAddress()));
        } catch (Exception e) {
            throw new InvalidAddressingHeaderException(addressingVersion.replyToTag, addressingVersion.invalidAddressTag);
        }
    }
    //for now only validate ReplyTo
    /*
    if (!faultTo.isAnonymous()) {
        try {
            new EndpointAddress(URI.create(faultTo.getAddress()));
        } catch (IllegalArgumentException e) {
            throw new InvalidAddressingHeaderException(addressingVersion.faultToTag, addressingVersion.invalidAddressTag);
        }
    }
    */

}
 
Example #8
Source File: WsaServerTube.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("ResultOfObjectAllocationIgnored")
private void checkNonAnonymousAddresses(WSEndpointReference replyTo, WSEndpointReference faultTo) {
    if (!replyTo.isAnonymous()) {
        try {
            new EndpointAddress(URI.create(replyTo.getAddress()));
        } catch (Exception e) {
            throw new InvalidAddressingHeaderException(addressingVersion.replyToTag, addressingVersion.invalidAddressTag);
        }
    }
    //for now only validate ReplyTo
    /*
    if (!faultTo.isAnonymous()) {
        try {
            new EndpointAddress(URI.create(faultTo.getAddress()));
        } catch (IllegalArgumentException e) {
            throw new InvalidAddressingHeaderException(addressingVersion.faultToTag, addressingVersion.invalidAddressTag);
        }
    }
    */

}
 
Example #9
Source File: WsaTube.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected void validateSOAPAction(Packet packet) {
    String gotA = AddressingUtils.getAction(
            packet.getMessage().getHeaders(),
            addressingVersion, soapVersion);
    if (gotA == null)
        throw new WebServiceException(AddressingMessages.VALIDATION_SERVER_NULL_ACTION());
    if(packet.soapAction != null && !packet.soapAction.equals("\"\"") && !packet.soapAction.equals("\""+gotA+"\"")) {
        throw new InvalidAddressingHeaderException(addressingVersion.actionTag, addressingVersion.actionMismatchTag);
    }
}
 
Example #10
Source File: WsaTubeHelper.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public SOAPFault createInvalidAddressingHeaderFault(InvalidAddressingHeaderException e, AddressingVersion av) {
    QName name = e.getProblemHeader();
    QName subsubcode = e.getSubsubcode();
    QName subcode = av.invalidMapTag;
    String faultstring = String.format(av.getInvalidMapText(), name, subsubcode);

    try {
        SOAPFactory factory;
        SOAPFault fault;
        if (soapVer == SOAPVersion.SOAP_12) {
            factory = SOAPVersion.SOAP_12.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
            fault.appendFaultSubcode(subcode);
            fault.appendFaultSubcode(subsubcode);
            getInvalidMapDetail(name, fault.addDetail());
        } else {
            factory = SOAPVersion.SOAP_11.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(subsubcode);
        }

        fault.setFaultString(faultstring);

        return fault;
    } catch (SOAPException se) {
        throw new WebServiceException(se);
    }
}
 
Example #11
Source File: W3CWsaServerTube.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@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
    }
}
 
Example #12
Source File: WsaTube.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
protected void validateSOAPAction(Packet packet) {
    String gotA = AddressingUtils.getAction(
            packet.getMessage().getHeaders(),
            addressingVersion, soapVersion);
    if (gotA == null)
        throw new WebServiceException(AddressingMessages.VALIDATION_SERVER_NULL_ACTION());
    if(packet.soapAction != null && !packet.soapAction.equals("\"\"") && !packet.soapAction.equals("\""+gotA+"\"")) {
        throw new InvalidAddressingHeaderException(addressingVersion.actionTag, addressingVersion.actionMismatchTag);
    }
}
 
Example #13
Source File: WsaTubeHelper.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public SOAPFault createInvalidAddressingHeaderFault(InvalidAddressingHeaderException e, AddressingVersion av) {
    QName name = e.getProblemHeader();
    QName subsubcode = e.getSubsubcode();
    QName subcode = av.invalidMapTag;
    String faultstring = String.format(av.getInvalidMapText(), name, subsubcode);

    try {
        SOAPFactory factory;
        SOAPFault fault;
        if (soapVer == SOAPVersion.SOAP_12) {
            factory = SOAPVersion.SOAP_12.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
            fault.appendFaultSubcode(subcode);
            fault.appendFaultSubcode(subsubcode);
            getInvalidMapDetail(name, fault.addDetail());
        } else {
            factory = SOAPVersion.SOAP_11.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(subsubcode);
        }

        fault.setFaultString(faultstring);

        return fault;
    } catch (SOAPException se) {
        throw new WebServiceException(se);
    }
}
 
Example #14
Source File: W3CWsaServerTube.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@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
    }
}
 
Example #15
Source File: W3CWsaServerTube.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@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
    }
}
 
Example #16
Source File: WsaTubeHelper.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public SOAPFault createInvalidAddressingHeaderFault(InvalidAddressingHeaderException e, AddressingVersion av) {
    QName name = e.getProblemHeader();
    QName subsubcode = e.getSubsubcode();
    QName subcode = av.invalidMapTag;
    String faultstring = String.format(av.getInvalidMapText(), name, subsubcode);

    try {
        SOAPFactory factory;
        SOAPFault fault;
        if (soapVer == SOAPVersion.SOAP_12) {
            factory = SOAPVersion.SOAP_12.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
            fault.appendFaultSubcode(subcode);
            fault.appendFaultSubcode(subsubcode);
            getInvalidMapDetail(name, fault.addDetail());
        } else {
            factory = SOAPVersion.SOAP_11.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(subsubcode);
        }

        fault.setFaultString(faultstring);

        return fault;
    } catch (SOAPException se) {
        throw new WebServiceException(se);
    }
}
 
Example #17
Source File: W3CWsaServerTube.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@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
    }
}
 
Example #18
Source File: WsaTube.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected void validateSOAPAction(Packet packet) {
    String gotA = AddressingUtils.getAction(
            packet.getMessage().getHeaders(),
            addressingVersion, soapVersion);
    if (gotA == null)
        throw new WebServiceException(AddressingMessages.VALIDATION_SERVER_NULL_ACTION());
    if(packet.soapAction != null && !packet.soapAction.equals("\"\"") && !packet.soapAction.equals("\""+gotA+"\"")) {
        throw new InvalidAddressingHeaderException(addressingVersion.actionTag, addressingVersion.actionMismatchTag);
    }
}
 
Example #19
Source File: WsaTubeHelper.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public SOAPFault createInvalidAddressingHeaderFault(InvalidAddressingHeaderException e, AddressingVersion av) {
    QName name = e.getProblemHeader();
    QName subsubcode = e.getSubsubcode();
    QName subcode = av.invalidMapTag;
    String faultstring = String.format(av.getInvalidMapText(), name, subsubcode);

    try {
        SOAPFactory factory;
        SOAPFault fault;
        if (soapVer == SOAPVersion.SOAP_12) {
            factory = SOAPVersion.SOAP_12.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
            fault.appendFaultSubcode(subcode);
            fault.appendFaultSubcode(subsubcode);
            getInvalidMapDetail(name, fault.addDetail());
        } else {
            factory = SOAPVersion.SOAP_11.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(subsubcode);
        }

        fault.setFaultString(faultstring);

        return fault;
    } catch (SOAPException se) {
        throw new WebServiceException(se);
    }
}
 
Example #20
Source File: WsaTube.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected void validateSOAPAction(Packet packet) {
    String gotA = AddressingUtils.getAction(
            packet.getMessage().getHeaders(),
            addressingVersion, soapVersion);
    if (gotA == null)
        throw new WebServiceException(AddressingMessages.VALIDATION_SERVER_NULL_ACTION());
    if(packet.soapAction != null && !packet.soapAction.equals("\"\"") && !packet.soapAction.equals("\""+gotA+"\"")) {
        throw new InvalidAddressingHeaderException(addressingVersion.actionTag, addressingVersion.actionMismatchTag);
    }
}
 
Example #21
Source File: W3CWsaServerTube.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@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
    }
}
 
Example #22
Source File: WsaTubeHelper.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public SOAPFault createInvalidAddressingHeaderFault(InvalidAddressingHeaderException e, AddressingVersion av) {
    QName name = e.getProblemHeader();
    QName subsubcode = e.getSubsubcode();
    QName subcode = av.invalidMapTag;
    String faultstring = String.format(av.getInvalidMapText(), name, subsubcode);

    try {
        SOAPFactory factory;
        SOAPFault fault;
        if (soapVer == SOAPVersion.SOAP_12) {
            factory = SOAPVersion.SOAP_12.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
            fault.appendFaultSubcode(subcode);
            fault.appendFaultSubcode(subsubcode);
            getInvalidMapDetail(name, fault.addDetail());
        } else {
            factory = SOAPVersion.SOAP_11.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(subsubcode);
        }

        fault.setFaultString(faultstring);

        return fault;
    } catch (SOAPException se) {
        throw new WebServiceException(se);
    }
}
 
Example #23
Source File: WsaTube.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected void validateSOAPAction(Packet packet) {
    String gotA = AddressingUtils.getAction(
            packet.getMessage().getHeaders(),
            addressingVersion, soapVersion);
    if (gotA == null)
        throw new WebServiceException(AddressingMessages.VALIDATION_SERVER_NULL_ACTION());
    if(packet.soapAction != null && !packet.soapAction.equals("\"\"") && !packet.soapAction.equals("\""+gotA+"\"")) {
        throw new InvalidAddressingHeaderException(addressingVersion.actionTag, addressingVersion.actionMismatchTag);
    }
}
 
Example #24
Source File: W3CWsaServerTube.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@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
    }
}
 
Example #25
Source File: WsaTubeHelper.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public SOAPFault createInvalidAddressingHeaderFault(InvalidAddressingHeaderException e, AddressingVersion av) {
    QName name = e.getProblemHeader();
    QName subsubcode = e.getSubsubcode();
    QName subcode = av.invalidMapTag;
    String faultstring = String.format(av.getInvalidMapText(), name, subsubcode);

    try {
        SOAPFactory factory;
        SOAPFault fault;
        if (soapVer == SOAPVersion.SOAP_12) {
            factory = SOAPVersion.SOAP_12.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
            fault.appendFaultSubcode(subcode);
            fault.appendFaultSubcode(subsubcode);
            getInvalidMapDetail(name, fault.addDetail());
        } else {
            factory = SOAPVersion.SOAP_11.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(subsubcode);
        }

        fault.setFaultString(faultstring);

        return fault;
    } catch (SOAPException se) {
        throw new WebServiceException(se);
    }
}
 
Example #26
Source File: WsaTube.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected void validateSOAPAction(Packet packet) {
    String gotA = AddressingUtils.getAction(
            packet.getMessage().getHeaders(),
            addressingVersion, soapVersion);
    if (gotA == null)
        throw new WebServiceException(AddressingMessages.VALIDATION_SERVER_NULL_ACTION());
    if(packet.soapAction != null && !packet.soapAction.equals("\"\"") && !packet.soapAction.equals("\""+gotA+"\"")) {
        throw new InvalidAddressingHeaderException(addressingVersion.actionTag, addressingVersion.actionMismatchTag);
    }
}
 
Example #27
Source File: W3CWsaServerTube.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@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
    }
}
 
Example #28
Source File: WsaTubeHelper.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public SOAPFault createInvalidAddressingHeaderFault(InvalidAddressingHeaderException e, AddressingVersion av) {
    QName name = e.getProblemHeader();
    QName subsubcode = e.getSubsubcode();
    QName subcode = av.invalidMapTag;
    String faultstring = String.format(av.getInvalidMapText(), name, subsubcode);

    try {
        SOAPFactory factory;
        SOAPFault fault;
        if (soapVer == SOAPVersion.SOAP_12) {
            factory = SOAPVersion.SOAP_12.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
            fault.appendFaultSubcode(subcode);
            fault.appendFaultSubcode(subsubcode);
            getInvalidMapDetail(name, fault.addDetail());
        } else {
            factory = SOAPVersion.SOAP_11.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(subsubcode);
        }

        fault.setFaultString(faultstring);

        return fault;
    } catch (SOAPException se) {
        throw new WebServiceException(se);
    }
}
 
Example #29
Source File: WsaTube.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
protected void validateSOAPAction(Packet packet) {
    String gotA = AddressingUtils.getAction(
            packet.getMessage().getHeaders(),
            addressingVersion, soapVersion);
    if (gotA == null)
        throw new WebServiceException(AddressingMessages.VALIDATION_SERVER_NULL_ACTION());
    if(packet.soapAction != null && !packet.soapAction.equals("\"\"") && !packet.soapAction.equals("\""+gotA+"\"")) {
        throw new InvalidAddressingHeaderException(addressingVersion.actionTag, addressingVersion.actionMismatchTag);
    }
}
 
Example #30
Source File: W3CWsaServerTube.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@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
    }
}