/** * Constructor for JaxWsSoapFaultException. * @param original the original JAX-WS SOAPFaultException to wrap */ public JaxWsSoapFaultException(SOAPFaultException original) { super(original.getMessage(), original); }
/** * Return the wrapped JAX-WS SOAPFault. */ public final SOAPFault getFault() { return ((SOAPFaultException) getCause()).getFault(); }
@Test public void testJaxWsPortAccessWithFeature() throws Exception { doTestJaxWsPortAccess(new AddressingFeature()); }
features.add(new MTOMFeature(mtom.enabled(), mtom.threshold())); } else { && (SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(bt.value()) || SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(bt.value()))) { features.add(new MTOMFeature(true)); features.add(new AddressingFeature(addressing.enabled(), addressing.required(), addressing.responses()));
private RuntimeException mapException(Exception ex) { if (ex instanceof Fault && ex.getCause() instanceof IOException) { throw new WebServiceException(ex.getMessage(), ex.getCause()); } if (getBinding() instanceof HTTPBinding) { HTTPException exception = new HTTPException(HttpURLConnection.HTTP_INTERNAL_ERROR); exception.initCause(ex); return exception; } else if (getBinding() instanceof SOAPBinding) { SOAPFault soapFault = null; try { soapFault = JaxWsClientProxy.createSoapFault((SOAPBinding)getBinding(), ex); } catch (SOAPException e) { //ignore } if (soapFault == null) { return new WebServiceException(ex); } SOAPFaultException exception = new SOAPFaultException(soapFault); exception.initCause(ex); return exception; } return new WebServiceException(ex); }
final void createJaxwsBinding() { if (getBinding() instanceof SoapBinding) { jaxwsBinding = new SOAPBindingImpl(getEndpointInfo().getBinding(), this); MTOMFeature mtomFeature = getMTOMFeature(); if (mtomFeature != null && mtomFeature.isEnabled()) { ((SOAPBinding)jaxwsBinding).setMTOMEnabled(true); } } else if (getBinding() instanceof XMLBinding) { jaxwsBinding = new HTTPBindingImpl(getEndpointInfo().getBinding(), this); } else { //REVISIT: Should not get here, though some bindings like JBI //did not implement their own Binding type. jaxwsBinding = new DefaultBindingImpl(this); } }
@Override public Object call() throws Exception { Service service = Service.create( url, new QName( NAMESPACE_URI, serviceName ) ); T port = service.getPort( clazz ); // add TRUST_USER if necessary if ( StringUtils.isNotBlank( System.getProperty( "pentaho.repository.client.attemptTrust" ) ) ) { ( (BindingProvider) port ).getRequestContext().put( MessageContext.HTTP_REQUEST_HEADERS, Collections.singletonMap( TRUST_USER, Collections.singletonList( username ) ) ); } else { // http basic authentication ( (BindingProvider) port ).getRequestContext().put( BindingProvider.USERNAME_PROPERTY, username ); ( (BindingProvider) port ).getRequestContext().put( BindingProvider.PASSWORD_PROPERTY, password ); } // accept cookies to maintain session on server ( (BindingProvider) port ).getRequestContext().put( BindingProvider.SESSION_MAINTAIN_PROPERTY, true ); // support streaming binary data // TODO mlowery this is not portable between JAX-WS implementations (uses com.sun) ( (BindingProvider) port ).getRequestContext().put( JAXWSProperties.HTTP_CLIENT_STREAMING_CHUNK_SIZE, 8192 ); SOAPBinding binding = (SOAPBinding) ( (BindingProvider) port ).getBinding(); binding.setMTOMEnabled( true ); return port; } } );
private void checkError() { if (error != null) { if (getBinding() instanceof SOAPBinding) { SOAPFault soapFault = null; try { soapFault = JaxWsClientProxy.createSoapFault((SOAPBinding)getBinding(), new Exception(error.toString())); } catch (SOAPException e) { //ignore } if (soapFault != null) { throw new SOAPFaultException(soapFault); } } else if (getBinding() instanceof HTTPBinding) { HTTPException exception = new HTTPException(HttpURLConnection.HTTP_INTERNAL_ERROR); exception.initCause(new Exception(error.toString())); throw exception; } throw new WebServiceException(error.toString()); } } private RuntimeException mapException(Exception ex) {
public final void resolveFeatures() { AddressingFeature addressing = getAddressingFeature(); if (addressing == null) { return; } if (addressing.isEnabled()) { WSAddressingFeature feature = getWSAddressingFeature(); if (feature == null) { feature = new WSAddressingFeature(); addAddressingFeature(feature); } feature.setAddressingRequired(addressing.isRequired()); feature.setResponses(addressing.getResponses().toString()); } else { removeAddressingFeature(); getEndpointInfo().setProperty("org.apache.cxf.ws.addressing.MAPAggregator.addressingDisabled", Boolean.TRUE); } }
JAXWSAConstants. WSAW_USINGADDRESSING_QNAME); el.setRequired(addressing.required()); bindingInfo.addExtensor(el); "Id", polRefId.toString()); writer.writeStartElement("wsam", "Addressing", JAXWSAConstants.NS_WSAM); if (!addressing.required()) { writer.writeAttribute("wsp", URI_POLICY_NS, "Optional", "true");
private void setMTOMFeatures(DataBinding databinding) { if (this.wsFeatures != null) { for (WebServiceFeature wsf : this.wsFeatures) { if (wsf instanceof MTOMFeature) { databinding.setMtomEnabled(true); MTOMFeature f = (MTOMFeature) wsf; if (f.getThreshold() > 0) { databinding.setMtomThreshold(((MTOMFeature)wsf).getThreshold()); } } } } }
static SOAPFault createSoapFault(SOAPBinding binding, Exception ex) throws SOAPException { SOAPFault soapFault; try { soapFault = binding.getSOAPFactory().createFault(); } catch (Throwable t) { soapFault = binding.getMessageFactory().createMessage() .getSOAPPart().getEnvelope().getBody().addFault(); } catch (Throwable t2) {
/** * Return the wrapped JAX-WS SOAPFault. */ public final SOAPFault getFault() { return ((SOAPFaultException) getCause()).getFault(); }
throw new WebServiceException(ex); SOAPFaultException exception = new SOAPFaultException(soapFault); if (ex instanceof Fault && ex.getCause() != null) { exception.initCause(ex.getCause()); } else { exception.initCause(ex);
/** * Constructor for JaxWsSoapFaultException. * @param original the original JAX-WS SOAPFaultException to wrap */ public JaxWsSoapFaultException(SOAPFaultException original) { super(original.getMessage(), original); }
versionComment ); } catch ( SOAPFaultException e ) { if ( e.getMessage().contains( UnifiedRepositoryUpdateFileException.PREFIX ) ) { throw new KettleException( BaseMessages.getString( PKG, "PurRepository.fileUpdateException", file.getName() ) ); new NodeRepositoryFileData( objectTransformer.elementToDataNode( element ) ), versionComment ); } catch ( SOAPFaultException e ) { if ( e.getMessage().contains( UnifiedRepositoryCreateFileException.PREFIX ) ) { throw new KettleException( BaseMessages.getString( PKG, "PurRepository.fileCreateException", file.getName() ) );
@Override protected Fault createFault(Throwable ex, Method m, List<Object> params, boolean checked) { //map the JAX-WS faults SOAPFaultException sfe = findSoapFaultException(ex); if (sfe != null) { SoapFault fault = new SoapFault(sfe.getFault().getFaultString(), ex, sfe.getFault().getFaultCodeAsQName()); fault.setRole(sfe.getFault().getFaultActor()); if (sfe.getFault().hasDetail()) { fault.setDetail(sfe.getFault().getDetail()); } return fault; } return super.createFault(ex, m, params, checked); }
soapFault.setFaultString(sf.getFault().getFaultString()); SAAJUtils.setFaultCode(soapFault, sf.getFault().getFaultCodeAsQName()); soapFault.setFaultActor(sf.getFault().getFaultActor()); if (sf.getFault().hasDetail()) { Node nd = soapMessage.getSOAPPart().importNode(sf.getFault().getDetail(), true); nd = nd.getFirstChild();
soapFault.setFaultString(sf.getFault().getFaultString()); SAAJUtils.setFaultCode(soapFault, sf.getFault().getFaultCodeAsQName()); soapFault.setFaultActor(sf.getFault().getFaultActor()); if (sf.getFault().hasDetail()) { Node nd = originalMsg.getSOAPPart().importNode( sf.getFault().getDetail() .getFirstChild(), true); soapFault.addDetail().appendChild(nd);