Java 类javax.xml.ws.WebServiceException 实例源码

项目:oscm    文件:WSPortConnector.java   
/**
     * Determines the reference to a web service provided by a technical
     * service.
     * 
     * @param <T>
     *            The type of service obtained.
     * @param localWsdlUrl
     *            The URL to a local service-related WSDL. The WSDL should be
     *            provided as file in a bundled .jar file.
     * @param serviceClass
     *            The service class implemented by the WSDL.
     * @return The web service reference.
     * @throws ParserConfigurationException
     * @throws WebServiceException
     *             Has to be caught by a caller, although it's a runtime
     *             exception
     */
    public <T> T getPort(URL localWsdlUrl, Class<T> serviceClass)
            throws ParserConfigurationException, WebServiceException {

        Service service = getService(localWsdlUrl, serviceClass);

        //EndpointReference epr = determineEndpointReference();
        T port = service.getPort(serviceClass);
        BindingProvider bindingProvider = (BindingProvider) port;
        Map<String, Object> clientRequestContext = bindingProvider
                .getRequestContext();
        clientRequestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, details.getEndpointURL());

        if (requiresUserAuthentication(userName, password)) {
//            BindingProvider bindingProvider = (BindingProvider) port;
//            Map<String, Object> clientRequestContext = bindingProvider
//                    .getRequestContext();
            clientRequestContext.put(BindingProvider.USERNAME_PROPERTY,
                    userName);
            clientRequestContext.put(BindingProvider.PASSWORD_PROPERTY,
                    password);
        }
        return port;
    }
项目:openjdk-jdk10    文件:DatabindingFactoryImpl.java   
Properties loadPropertiesFile(String fileName) {
        ClassLoader classLoader = classLoader();
        Properties p = new Properties();
        try {
                InputStream is = null;
                if (classLoader == null) {
                        is = ClassLoader.getSystemResourceAsStream(fileName);
                } else {
                        is = classLoader.getResourceAsStream(fileName);
                }
                if (is != null) {
                        p.load(is);
                }
        } catch (Exception e) {
                throw new WebServiceException(e);
        }
        return p;
}
项目:OpenJSharp    文件:WSServiceDelegate.java   
@Override
public <T> T getPort(Class<T> portInterface, WebServiceFeature... features) {
    //get the portType from SEI
    QName portTypeName = RuntimeModeler.getPortTypeName(portInterface, getMetadadaReader(new WebServiceFeatureList(features), portInterface.getClassLoader()));
    WSDLService tmpWsdlService = this.wsdlService;
    if (tmpWsdlService == null) {
        // assigning it to local variable and not setting it back to this.wsdlService intentionally
        // as we don't want to include the service instance with information gathered from sei
        tmpWsdlService = getWSDLModelfromSEI(portInterface);
        //still null? throw error need wsdl metadata to create a proxy
        if(tmpWsdlService == null) {
            throw new WebServiceException(ProviderApiMessages.NO_WSDL_NO_PORT(portInterface.getName()));
        }
    }
    //get the first port corresponding to the SEI
    WSDLPort port = tmpWsdlService.getMatchingPort(portTypeName);
    if (port == null) {
        throw new WebServiceException(ClientMessages.UNDEFINED_PORT_TYPE(portTypeName));
    }
    QName portName = port.getName();
    return getPort(portName, portInterface,features);
}
项目:OpenJSharp    文件:TubelineFeatureReader.java   
public TubelineFeature parse(XMLEventReader reader) throws WebServiceException {
    try {
        final StartElement element = reader.nextEvent().asStartElement();
        boolean attributeEnabled = true;
        final Iterator iterator = element.getAttributes();
        while (iterator.hasNext()) {
            final Attribute nextAttribute = (Attribute) iterator.next();
            final QName attributeName = nextAttribute.getName();
            if (ENABLED_ATTRIBUTE_NAME.equals(attributeName)) {
                attributeEnabled = ParserUtil.parseBooleanValue(nextAttribute.getValue());
            } else if (NAME_ATTRIBUTE_NAME.equals(attributeName)) {
                // TODO use name attribute
            } else {
                // TODO logging message
                throw LOGGER.logSevereException(new WebServiceException("Unexpected attribute"));
            }
        }
        return parseFactories(attributeEnabled, element, reader);
    } catch (XMLStreamException e) {
        throw LOGGER.logSevereException(new WebServiceException("Failed to unmarshal XML document", e));
    }
}
项目:openjdk-jdk10    文件:EndpointFactory.java   
/**
 * Verifies whether the given primaryWsdl contains the given serviceName.
 * If the WSDL doesn't have the service, it throws an WebServiceException.
 */
private static void verifyPrimaryWSDL(@NotNull SDDocumentSource primaryWsdl, @NotNull QName serviceName) {
    SDDocumentImpl primaryDoc = SDDocumentImpl.create(primaryWsdl,serviceName,null);
    if (!(primaryDoc instanceof SDDocument.WSDL)) {
        throw new WebServiceException(primaryWsdl.getSystemId()+
                " is not a WSDL. But it is passed as a primary WSDL");
    }
    SDDocument.WSDL wsdlDoc = (SDDocument.WSDL)primaryDoc;
    if (!wsdlDoc.hasService()) {
        if(wsdlDoc.getAllServices().isEmpty())
            throw new WebServiceException("Not a primary WSDL="+primaryWsdl.getSystemId()+
                    " since it doesn't have Service "+serviceName);
        else
            throw new WebServiceException("WSDL "+primaryDoc.getSystemId()
                    +" has the following services "+wsdlDoc.getAllServices()
                    +" but not "+serviceName+". Maybe you forgot to specify a serviceName and/or targetNamespace in @WebService/@WebServiceProvider?");
    }
}
项目:OpenJSharp    文件:DefaultPolicyResolver.java   
/**
 * Checks if the PolicyMap has only single alternative in the scope.
 *
 * @param policyMap
 *      PolicyMap that needs to be validated.
 */
private void validateServerPolicyMap(PolicyMap policyMap) {
    try {
        final ValidationProcessor validationProcessor = ValidationProcessor.getInstance();

        for (Policy policy : policyMap) {

            // TODO:  here is a good place to check if the actual policy has only one alternative...

            for (AssertionSet assertionSet : policy) {
                for (PolicyAssertion assertion : assertionSet) {
                    Fitness validationResult = validationProcessor.validateServerSide(assertion);
                    if (validationResult != Fitness.SUPPORTED) {
                        throw new PolicyException(PolicyMessages.WSP_1015_SERVER_SIDE_ASSERTION_VALIDATION_FAILED(
                                assertion.getName(),
                                validationResult));
                    }
                }
            }
        }
    } catch (PolicyException e) {
        throw new WebServiceException(e);
    }
}
项目:OperatieBRP    文件:SynchronisatieWebServiceImpl.java   
/**
 * Handelt het verzoek af.
 * @param request het verzoek
 * @return het response.
 */
@Bedrijfsregel(Regel.R1978)
@Bedrijfsregel(Regel.R1979)
@Override
public final DOMSource invoke(final DOMSource request) {
    Thread.currentThread().setName("Synchronisatie Service");
    LOGGER.debug("SynchronisatieService aangeroepen");
    try {
        schemaValidatorService.valideer(request, SCHEMA);
    } catch (SchemaValidatorService.SchemaValidatieException schemaValidatieException) {
        LOGGER.debug("SynchronisatieService aangeroepen met invalide xml", schemaValidatieException);
        throw new Fault(schemaValidatieException.getCause());
    }
    BrpNu.set(DatumUtil.nuAlsZonedDateTime());
    return AlgemeneFoutHandler
            .doeBijFout(e1 -> {
                LOGGER.error("Algemene fout", e1);
                throw new WebServiceException("Er is iets fout gegaan bij het verwerken van het verzoek.");
            }).voerUit(() -> maakResponse(request));
}
项目:OpenJSharp    文件:EndpointArgumentsBuilder.java   
protected void readWrappedRequest(Message msg, Object[] args) throws JAXBException, XMLStreamException {
    if (!msg.hasPayload()) {
        throw new WebServiceException("No payload. Expecting payload with "+wrapperName+" element");
    }
    XMLStreamReader reader = msg.readPayload();
    XMLStreamReaderUtil.verifyTag(reader,wrapperName);
    reader.nextTag();
    while(reader.getEventType()==XMLStreamReader.START_ELEMENT) {
        // TODO: QName has a performance issue
        QName name = reader.getName();
        WrappedPartBuilder part = wrappedParts.get(name);
        if(part==null) {
            // no corresponding part found. ignore
            XMLStreamReaderUtil.skipElement(reader);
            reader.nextTag();
        } else {
            part.readRequest(args,reader, msg.getAttachments());
        }
        XMLStreamReaderUtil.toNextTag(reader, name);
    }

    // we are done with the body
    reader.close();
    XMLStreamReaderFactory.recycle(reader);
}
项目:openjdk-jdk10    文件:LogicalMessageImpl.java   
public Object getPayload(JAXBContext context) {
    if (context == null) {
        return getPayload(defaultJaxbContext);
    }
    if (context == null)
        throw new WebServiceException("JAXBContext parameter cannot be null");

    Object o;
    if (lm == null) {
        try {
            o = packet.getMessage().copy().readPayloadAsJAXB(context.createUnmarshaller());
        } catch (JAXBException e) {
            throw new WebServiceException(e);
        }
    } else {
        o = lm.getPayload(context);
        lm = new JAXBLogicalMessageImpl(context, o);
    }
    return o;
}
项目:OpenJSharp    文件:AbstractSchemaValidationTube.java   
private Document createDOM(SDDocument doc) {
    // Get infoset
    ByteArrayBuffer bab = new ByteArrayBuffer();
    try {
        doc.writeTo(null, resolver, bab);
    } catch (IOException ioe) {
        throw new WebServiceException(ioe);
    }

    // Convert infoset to DOM
    Transformer trans = XmlUtil.newTransformer();
    Source source = new StreamSource(bab.newInputStream(), null); //doc.getURL().toExternalForm());
    DOMResult result = new DOMResult();
    try {
        trans.transform(source, result);
    } catch(TransformerException te) {
        throw new WebServiceException(te);
    }
    return (Document)result.getNode();
}
项目:OpenJSharp    文件:MUTube.java   
/**
 * This should be used only in ServerMUPipe
 *
 * @param notUnderstoodHeaders
 * @return Message representing a SOAPFault
 *         In SOAP 1.1, notUnderstoodHeaders are added in the fault Detail
 *         in SOAP 1.2, notUnderstoodHeaders are added as the SOAP Headers
 */

final Message createMUSOAPFaultMessage(Set<QName> notUnderstoodHeaders) {
    try {
        String faultString = MUST_UNDERSTAND_FAULT_MESSAGE_STRING;
        if (soapVersion == SOAP_11) {
            faultString = "MustUnderstand headers:" + notUnderstoodHeaders + " are not understood";
        }
        Message  muFaultMessage = SOAPFaultBuilder.createSOAPFaultMessage(
                soapVersion,faultString,soapVersion.faultCodeMustUnderstand);

        if (soapVersion == SOAP_12) {
            addHeader(muFaultMessage, notUnderstoodHeaders);
        }
        return muFaultMessage;
    } catch (SOAPException e) {
        throw new WebServiceException(e);
    }
}
项目:openjdk-jdk10    文件:WebServiceFeatureList.java   
private static boolean skipDuringOrgJvnetWsToComOracleWebservicesPackageMove(
    final Method builderMethod,
    final Object annotationFieldValue)
{
    final Class<?> annotationFieldValueClass = annotationFieldValue.getClass();
    if (! annotationFieldValueClass.isEnum()) {
        return false;
    }
    final Class<?>[] builderMethodParameterTypes = builderMethod.getParameterTypes();
    if (builderMethodParameterTypes.length != 1) {
        throw new WebServiceException("expected only 1 parameter");
    }
    final String builderParameterTypeName = builderMethodParameterTypes[0].getName();
    if (! builderParameterTypeName.startsWith("com.oracle.webservices.internal.test.features_annotations_enums.apinew") &&
        ! builderParameterTypeName.startsWith("com.oracle.webservices.internal.api")) {
        return false;
    }
    return false;
}
项目:OpenJSharp    文件:AddressingUtils.java   
public static WSEndpointReference getReplyTo(@NotNull MessageHeaders headers, @NotNull AddressingVersion av, @NotNull SOAPVersion sv) {
    if (av == null) {
        throw new IllegalArgumentException(AddressingMessages.NULL_ADDRESSING_VERSION());
    }

    Header h = getFirstHeader(headers, av.replyToTag, true, sv);
    WSEndpointReference replyTo;
    if (h != null) {
        try {
            replyTo = h.readAsEPR(av);
        } catch (XMLStreamException e) {
            throw new WebServiceException(AddressingMessages.REPLY_TO_CANNOT_PARSE(), e);
        }
    } else {
        replyTo = av.anonymousEpr;
    }

    return replyTo;
}
项目:OperatieBRP    文件:OnderhoudAfnemerindicatiesWebServiceImpl.java   
/**
 * Voert het verzoek uit.
 * @param request de ingaande request
 * @return het response
 */
@Bedrijfsregel(Regel.R1978)
@Bedrijfsregel(Regel.R1979)
@Bedrijfsregel(Regel.R1984)
@Override
public final DOMSource invoke(final DOMSource request) {
    Thread.currentThread().setName("OnderhoudAfnemerindicatie");
    LOGGER.debug("AfnemerindicatiesService aangeroepen");
    try {
        schemaValidatorService.valideer(request, OnderhoudAfnemerindicatiesWebServiceImpl.SCHEMA);
    } catch (SchemaValidatorService.SchemaValidatieException schemaValidatieException) {
        LOGGER.debug("AfnemerindicatiesService aangeroepen met invalide xml", schemaValidatieException);
        throw new Fault(schemaValidatieException.getCause());
    }
    BrpNu.set(DatumUtil.nuAlsZonedDateTime());
    return AlgemeneFoutHandler.doeBijFout(
            e1 -> {
                LOGGER.error("Algemene fout", e1);
                throw new WebServiceException("Er is iets fout gegaan bij het verwerken van het verzoek.");
            }
    ).voerUit(() -> getDomSource(request));
}
项目:OpenJSharp    文件:Stubs.java   
/**
 * Creates a new {@link Dispatch} stub that connects to the given pipe.
 *
 * @param portName
 *      see {@link Service#createDispatch(QName, Class, Service.Mode)}.
 * @param owner
 *      see <a href="#param">common parameters</a>
 * @param binding
 *      see <a href="#param">common parameters</a>
 * @param clazz
 *      Type of the {@link Dispatch} to be created.
 *      See {@link Service#createDispatch(QName, Class, Service.Mode)}.
 * @param mode
 *      The mode of the dispatch.
 *      See {@link Service#createDispatch(QName, Class, Service.Mode)}.
 * @param next
 *      see <a href="#param">common parameters</a>
 * @param epr
 *      see <a href="#param">common parameters</a>
 * TODO: are these parameters making sense?
 */
@SuppressWarnings("unchecked")
    public static <T> Dispatch<T> createDispatch(QName portName,
                                             WSService owner,
                                             WSBinding binding,
                                             Class<T> clazz, Service.Mode mode, Tube next,
                                             @Nullable WSEndpointReference epr) {
    if (clazz == SOAPMessage.class) {
        return (Dispatch<T>) createSAAJDispatch(portName, owner, binding, mode, next, epr);
    } else if (clazz == Source.class) {
        return (Dispatch<T>) createSourceDispatch(portName, owner, binding, mode, next, epr);
    } else if (clazz == DataSource.class) {
        return (Dispatch<T>) createDataSourceDispatch(portName, owner, binding, mode, next, epr);
    } else if (clazz == Message.class) {
        if(mode==Mode.MESSAGE)
            return (Dispatch<T>) createMessageDispatch(portName, owner, binding, next, epr);
        else
            throw new WebServiceException(mode+" not supported with Dispatch<Message>");
    } else if (clazz == Packet.class) {
        return (Dispatch<T>) createPacketDispatch(portName, owner, binding, next, epr);
    } else
        throw new WebServiceException("Unknown class type " + clazz.getName());
}
项目:openjdk-jdk10    文件:EndpointArgumentsBuilder.java   
protected void readWrappedRequest(Message msg, Object[] args) throws JAXBException, XMLStreamException {
    if (!msg.hasPayload()) {
        throw new WebServiceException("No payload. Expecting payload with "+wrapperName+" element");
    }
    XMLStreamReader reader = msg.readPayload();
    XMLStreamReaderUtil.verifyTag(reader,wrapperName);
    reader.nextTag();
    while(reader.getEventType()==XMLStreamReader.START_ELEMENT) {
        // TODO: QName has a performance issue
        QName name = reader.getName();
        WrappedPartBuilder part = wrappedParts.get(name);
        if(part==null) {
            // no corresponding part found. ignore
            XMLStreamReaderUtil.skipElement(reader);
            reader.nextTag();
        } else {
            part.readRequest(args,reader, msg.getAttachments());
        }
        XMLStreamReaderUtil.toNextTag(reader, name);
    }

    // we are done with the body
    reader.close();
    XMLStreamReaderFactory.recycle(reader);
}
项目:openjdk-jdk10    文件:BindingID.java   
/**
 * Parses a binding ID string into a {@link BindingID} object.
 *
 * <p>
 * This method first checks for a few known values and then delegate
 * the parsing to {@link BindingIDFactory}.
 *
 * <p>
 * If parsing succeeds this method returns a value. Otherwise
 * throws {@link WebServiceException}.
 *
 * @throws WebServiceException
 *      If the binding ID is not understood.
 */
public static @NotNull BindingID parse(String lexical) {
    if(lexical.equals(XML_HTTP.toString()))
        return XML_HTTP;
    if(lexical.equals(REST_HTTP.toString()))
        return REST_HTTP;
    if(belongsTo(lexical,SOAP11_HTTP.toString()))
        return customize(lexical,SOAP11_HTTP);
    if(belongsTo(lexical,SOAP12_HTTP.toString()))
        return customize(lexical,SOAP12_HTTP);
    if(belongsTo(lexical,SOAPBindingImpl.X_SOAP12HTTP_BINDING))
        return customize(lexical,X_SOAP12_HTTP);

    // OK, it's none of the values JAX-WS understands.
    for( BindingIDFactory f : ServiceFinder.find(BindingIDFactory.class) ) {
        BindingID r = f.parse(lexical);
        if(r!=null)
            return r;
    }

    // nobody understood this value
    throw new WebServiceException("Wrong binding ID: "+lexical);
}
项目:OpenJSharp    文件:W3CAddressingWSDLParserExtension.java   
protected static final String buildAction(String name, EditableWSDLOperation o, boolean isFault) {
    String tns = o.getName().getNamespaceURI();

    String delim = SLASH_DELIMITER;

    // TODO: is this the correct way to find the separator ?
    if (!tns.startsWith("http"))
        delim = COLON_DELIMITER;

    if (tns.endsWith(delim))
        tns = tns.substring(0, tns.length()-1);

    if (o.getPortTypeName() == null)
        throw new WebServiceException("\"" + o.getName() + "\" operation's owning portType name is null.");

    return tns +
        delim +
        o.getPortTypeName().getLocalPart() +
        delim +
        (isFault ? o.getName().getLocalPart() + delim + "Fault" + delim : "") +
        name;
}
项目:OpenJSharp    文件:BindingID.java   
/**
 * Parses a binding ID string into a {@link BindingID} object.
 *
 * <p>
 * This method first checks for a few known values and then delegate
 * the parsing to {@link BindingIDFactory}.
 *
 * <p>
 * If parsing succeeds this method returns a value. Otherwise
 * throws {@link WebServiceException}.
 *
 * @throws WebServiceException
 *      If the binding ID is not understood.
 */
public static @NotNull BindingID parse(String lexical) {
    if(lexical.equals(XML_HTTP.toString()))
        return XML_HTTP;
    if(lexical.equals(REST_HTTP.toString()))
        return REST_HTTP;
    if(belongsTo(lexical,SOAP11_HTTP.toString()))
        return customize(lexical,SOAP11_HTTP);
    if(belongsTo(lexical,SOAP12_HTTP.toString()))
        return customize(lexical,SOAP12_HTTP);
    if(belongsTo(lexical,SOAPBindingImpl.X_SOAP12HTTP_BINDING))
        return customize(lexical,X_SOAP12_HTTP);

    // OK, it's none of the values JAX-WS understands.
    for( BindingIDFactory f : ServiceFinder.find(BindingIDFactory.class) ) {
        BindingID r = f.parse(lexical);
        if(r!=null)
            return r;
    }

    // nobody understood this value
    throw new WebServiceException("Wrong binding ID: "+lexical);
}
项目:OpenJSharp    文件:XMLStreamWriterFactory.java   
@Override
public void doRecycle(XMLStreamWriter r) {
    if (r instanceof HasEncodingWriter) {
        r = ((HasEncodingWriter)r).getWriter();
    }
    if(zephyrClass.isInstance(r)) {
        // this flushes the underlying stream, so it might cause chunking issue
        try {
            r.close();
        } catch (XMLStreamException e) {
            throw new WebServiceException(e);
        }
        pool.set(r);
    }
    if(r instanceof RecycleAware)
        ((RecycleAware)r).onRecycled();
}
项目:OpenJSharp    文件:WebServiceFeatureList.java   
private static boolean skipDuringOrgJvnetWsToComOracleWebservicesPackageMove(
    final Method builderMethod,
    final Object annotationFieldValue)
{
    final Class<?> annotationFieldValueClass = annotationFieldValue.getClass();
    if (! annotationFieldValueClass.isEnum()) {
        return false;
    }
    final Class<?>[] builderMethodParameterTypes = builderMethod.getParameterTypes();
    if (builderMethodParameterTypes.length != 1) {
        throw new WebServiceException("expected only 1 parameter");
    }
    final String builderParameterTypeName = builderMethodParameterTypes[0].getName();
    if (! builderParameterTypeName.startsWith("com.oracle.webservices.internal.test.features_annotations_enums.apinew") &&
        ! builderParameterTypeName.startsWith("com.oracle.webservices.internal.api")) {
        return false;
    }
    return false;
}
项目:openjdk-jdk10    文件:JAXBDispatch.java   
Object toReturnValue(Packet response) {
    try {
        Unmarshaller unmarshaller = jaxbcontext.createUnmarshaller();
        Message msg = response.getMessage();
        switch (mode) {
            case PAYLOAD:
                return msg.<Object>readPayloadAsJAXB(unmarshaller);
            case MESSAGE:
                Source result = msg.readEnvelopeAsSource();
                return unmarshaller.unmarshal(result);
            default:
                throw new WebServiceException("Unrecognized dispatch mode");
        }
    } catch (JAXBException e) {
        throw new WebServiceException(e);
    }
}
项目:OpenJSharp    文件:ServerMessageHandlerTube.java   
void callHandlersOnResponse(MessageUpdatableContext context, boolean handleFault) {
    //Lets copy all the MessageContext.OUTBOUND_ATTACHMENT_PROPERTY to the message
    Map<String, DataHandler> atts = (Map<String, DataHandler>) context.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
    AttachmentSet attSet = context.packet.getMessage().getAttachments();
    for (Entry<String, DataHandler> entry : atts.entrySet()) {
        String cid = entry.getKey();
        if (attSet.get(cid) == null) { // Otherwise we would be adding attachments twice
            Attachment att = new DataHandlerAttachment(cid, atts.get(cid));
            attSet.add(att);
        }
    }

    try {
        //SERVER-SIDE
        processor.callHandlersResponse(HandlerProcessor.Direction.OUTBOUND, context, handleFault);

    } catch (WebServiceException wse) {
        //no rewrapping
        throw wse;
    } catch (RuntimeException re) {
        throw re;

    }
}
项目:openjdk-jdk10    文件:EndpointResponseMessageBuilder.java   
/**
 * Packs a bunch of arguments intoa {@link WrapperComposite}.
 */
WrapperComposite buildWrapperComposite(Object[] methodArgs, Object returnValue) {
    WrapperComposite cs = new WrapperComposite();
    cs.bridges = parameterBridges;
    cs.values = new Object[parameterBridges.length];

    // fill in wrapped parameters from methodArgs
    for( int i=indices.length-1; i>=0; i-- ) {
        Object v;
        if (indices[i] == -1) {
            v = getters[i].get(returnValue);
        } else {
            v = getters[i].get(methodArgs[indices[i]]);
        }
        if(v==null) {
            throw new WebServiceException("Method Parameter: "+
                children.get(i).getName() +" cannot be null. This is BP 1.1 R2211 violation.");
        }
        cs.values[i] = v;
    }

    return cs;
}
项目:openjdk-jdk10    文件:WSServiceDelegate.java   
private <T> T createEndpointIFBaseProxy(@Nullable WSEndpointReference epr, QName portName, Class<T> portInterface,
                                        WebServiceFeatureList webServiceFeatures, SEIPortInfo eif) {
    //fail if service doesnt have WSDL
    if (wsdlService == null) {
        throw new WebServiceException(ClientMessages.INVALID_SERVICE_NO_WSDL(serviceName));
    }

    if (wsdlService.get(portName)==null) {
        throw new WebServiceException(
            ClientMessages.INVALID_PORT_NAME(portName,buildWsdlPortNames()));
    }

    BindingImpl binding = eif.createBinding(webServiceFeatures, portInterface);
    InvocationHandler pis = getStubHandler(binding, eif, epr);

    T proxy = createProxy(portInterface, pis);

    if (serviceInterceptor != null) {
        serviceInterceptor.postCreateProxy((WSBindingProvider)proxy, portInterface);
    }
    return proxy;
}
项目:openjdk-jdk10    文件:WsaTubeHelperImpl.java   
@Override
public final void getProblemActionDetail(String action, Element element) {
    ProblemAction pa = new ProblemAction(action);
    try {
        createMarshaller().marshal(pa, element);
    } catch (JAXBException e) {
        throw new WebServiceException(e);
    }
}
项目:oscm    文件:ApplicationServiceBean.java   
/**
 * Convert a {@link WebServiceException} into a
 * {@link TechnicalServiceOperationException} and return it.
 * 
 * @param subscription
 *            the subscription of the technical product which was called
 * @param e
 *            the caught {@link WebServiceException}
 * @return the {@link TechnicalServiceOperationException} to throw
 */
private TechnicalServiceOperationException convertWebServiceException(
        Subscription subscription, WebServiceException e) {
    TechnicalServiceOperationException ex = new TechnicalServiceOperationException(
            ERROR_WS_CALL, new Object[] { subscription.getSubscriptionId(),
                    e.getMessage() });
    logger.logWarn(Log4jLogger.SYSTEM_LOG, ex,
            LogMessageIdentifier.WARN_TECH_SERVICE_WS_EXCEPTION,
            subscription.getSubscriptionId(),
            e.getClass().getName() + ": " + e.getMessage());
    return ex;
}
项目:oscm    文件:ProvisioningServicePortStub.java   
private <T extends BaseResult> T setRcAndDesc(T result)
        throws WebServiceException {
    result.setRc(returnCode);
    if (returnCode == RC_OK) {
        result.setDesc("Ok");
    } else if (returnCode == RC_NULL) {
        return null;
    } else if (returnCode == RC_EXCEPTION) {
        throw new WebServiceException("Test");
    } else {
        result.setDesc("Error");
    }
    return result;
}
项目:oscm    文件:ApplicationServiceBeanTest.java   
@Test(expected = TechnicalServiceOperationException.class)
public void getOperationParameterValues_WebServiceException()
        throws Exception {
    when(operationPort.getParameterValues(anyString(), anyString(),
            anyString())).thenThrow(new WebServiceException());
    TechnicalProductOperation tpo = createTechnicalProductOperation("op1",
            REQUEST_SELECT);
    Subscription sub = createSubscription(false);

    am.getOperationParameterValues(USER_ID, tpo, sub);
}
项目:oscm    文件:MockSTSWSTest.java   
@Test
public void testSecuredWS_Modify_DigestValue() throws Exception {
    idS = ServiceFactory.getSTSServiceFactory().getIdentityService(
            "MockSTSTest_DigestValue", "admin123");
    try {
        invokeWSMethod();
        fail();
    } catch (WebServiceException e) {
        assertThat(e.getMessage(), containsString(EXCEPTION_SUBSTRING));
    }
}
项目:openjdk-jdk10    文件:MemberSubmissionEndpointReference.java   
private static JAXBContext getMSJaxbContext() {
    try {
        return JAXBContext.newInstance(MemberSubmissionEndpointReference.class);
    } catch (JAXBException e) {
        throw new WebServiceException("Error creating JAXBContext for MemberSubmissionEndpointReference. ", e);
    }
}
项目:openjdk-jdk10    文件:ServerAdapter.java   
@Override
public @NotNull URI getAddress(String baseAddress) {
    String adrs = baseAddress+getValidPath();
    try {
        return new URI(adrs);
    } catch (URISyntaxException e) {
        // this is really a bug in the container implementation
        throw new WebServiceException("Unable to compute address for "+endpoint,e);
    }
}
项目:openjdk-jdk10    文件:ServerConnectionImpl.java   
public @NotNull String getEPRAddress(Packet request, WSEndpoint endpoint) {
    //return WSHttpHandler.getRequestAddress(httpExchange);

    PortAddressResolver resolver = adapter.owner.createPortAddressResolver(getBaseAddress(), endpoint.getImplementationClass());
    String address = resolver.getAddressFor(endpoint.getServiceName(), endpoint.getPortName().getLocalPart());
    if(address==null)
        throw new WebServiceException(WsservletMessages.SERVLET_NO_ADDRESS_AVAILABLE(endpoint.getPortName()));
    return address;

}
项目:OpenJSharp    文件:EndpointResponseMessageBuilder.java   
/**
 * Creates a {@link EndpointResponseMessageBuilder} from a {@link WrapperParameter}.
 */
public DocLit(WrapperParameter wp, SOAPVersion soapVersion) {
    super(wp, soapVersion);
    bindingContext = wp.getOwner().getBindingContext();
    wrapper = (Class)wp.getXMLBridge().getTypeInfo().type;
    dynamicWrapper = WrapperComposite.class.equals(wrapper);
    children = wp.getWrapperChildren();
    parameterBridges = new XMLBridge[children.size()];
    accessors = new PropertyAccessor[children.size()];
    for( int i=0; i<accessors.length; i++ ) {
        ParameterImpl p = children.get(i);
        QName name = p.getName();
        if (dynamicWrapper) {
            parameterBridges[i] = children.get(i).getInlinedRepeatedElementBridge();
            if (parameterBridges[i] == null) parameterBridges[i] = children.get(i).getXMLBridge();
        } else {
            try {
                accessors[i] = (dynamicWrapper) ? null :
                    p.getOwner().getBindingContext().getElementPropertyAccessor(
                    wrapper, name.getNamespaceURI(), name.getLocalPart() );
            } catch (JAXBException e) {
                throw new WebServiceException(  // TODO: i18n
                    wrapper+" do not have a property of the name "+name,e);
            }
        }
    }

}
项目:OpenJSharp    文件:W3CAddressingWSDLParserExtension.java   
@Override
public boolean bindingOperationElements(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
    EditableWSDLBoundOperation edit = (EditableWSDLBoundOperation) operation;

    QName anon = reader.getName();
    if (anon.equals(AddressingVersion.W3C.wsdlAnonymousTag)) {
        try {
            String value = reader.getElementText();
            if (value == null || value.trim().equals("")) {
                throw new WebServiceException("Null values not permitted in wsaw:Anonymous.");
                // TODO: throw exception only if wsdl:required=true
                // TODO: is this the right exception ?
            } else if (value.equals("optional")) {
                edit.setAnonymous(ANONYMOUS.optional);
            } else if (value.equals("required")) {
                edit.setAnonymous(ANONYMOUS.required);
            } else if (value.equals("prohibited")) {
                edit.setAnonymous(ANONYMOUS.prohibited);
            } else {
                throw new WebServiceException("wsaw:Anonymous value \"" + value + "\" not understood.");
                // TODO: throw exception only if wsdl:required=true
                // TODO: is this the right exception ?
            }
        } catch (XMLStreamException e) {
            throw new WebServiceException(e);       // TODO: is this the correct behavior ?
        }

        return true;        // consumed the element
    }

    return false;
}
项目:openjdk-jdk10    文件:LogicalMessageImpl.java   
public Object getPayload(BindingContext context) {
    try {
        Source payloadSrc = getPayload();
        if (payloadSrc == null)
            return null;
        Unmarshaller unmarshaller = context.createUnmarshaller();
        return unmarshaller.unmarshal(payloadSrc);
    } catch (JAXBException e) {
        throw new WebServiceException(e);
    }

}
项目:openjdk-jdk10    文件:AbstractExtensibleImpl.java   
/**
 * This method should be called after freezing the WSDLModel
 * @return true if all wsdl required extensions on Port and Binding are understood
 */
public boolean areRequiredExtensionsUnderstood() {
    if (notUnderstoodExtensions.size() != 0) {
        StringBuilder buf = new StringBuilder("Unknown WSDL extensibility elements:");
        for (UnknownWSDLExtension extn : notUnderstoodExtensions)
            buf.append('\n').append(extn.toString());
        throw new WebServiceException(buf.toString());
    }
    return true;
}
项目:openjdk-jdk10    文件:TransportTubeFactory.java   
protected Tube createDefault(ClientTubeAssemblerContext context) {
    // default built-in transports
    String scheme = context.getAddress().getURI().getScheme();
    if (scheme != null) {
        if(scheme.equalsIgnoreCase("http") || scheme.equalsIgnoreCase("https"))
            return createHttpTransport(context);
    }
    throw new WebServiceException("Unsupported endpoint address: "+context.getAddress());    // TODO: i18n
}
项目:KernelHive    文件:ExecutionEngineService.java   
private ExecutionEngineService() throws ExecutionEngineServiceException {
    executorService = Executors.newFixedThreadPool(5);
    try {
        clientService = new WebServiceHelper().getClientService();
    } catch (WebServiceException e) {
        throw new ExecutionEngineServiceException(e);
    }
}
项目:OpenJSharp    文件:DOMMessage.java   
public void writePayloadTo(XMLStreamWriter sw) {
    try {
        if (payload != null)
            DOMUtil.serializeNode(payload, sw);
    } catch (XMLStreamException e) {
        throw new WebServiceException(e);
    }
}