Package javax.xml.rpc.soap

Examples of javax.xml.rpc.soap.SOAPFaultException


   
    public void throwSOAPFaultException(String faultString,
                                        SOAPMessage soapMessage)
        throws SOAPFaultException {

        SOAPFaultException sfe = null;

        try {

            SOAPPart sp = soapMessage.getSOAPPart();
            SOAPEnvelope se = sp.getEnvelope();

            // Consume the request
            SOAPBody sb = se.getBody();

            // Access the child elements of body
            Iterator iter = sb.getChildElements();

            // Response should only include the fault, so remove
            // any request body nodes.
            if (iter.hasNext()) {
                SOAPBodyElement requestBody = (SOAPBodyElement)iter.next();
                // detach this node from the tree
                requestBody.detachNode();
            }


            SOAPFault soapFault = sb.addFault();

            se.setEncodingStyle(SOAPConstants.URI_ENCODING);

            String faultActor = "http://schemas.xmlsoap.org/soap/actor/next";
            QName faultCode = SOAPConstants.FAULT_CODE_SERVER;

            soapFault.setFaultCode("env:" + faultCode.getLocalPart());
            soapFault.setFaultString(faultString);
            soapFault.setFaultActor(faultActor);

            sfe = new SOAPFaultException(faultCode, faultActor, faultString,
                                         null);
        } catch(SOAPException se) {
            if (logger.isLoggable(Level.FINE)) {
                logger.log(Level.FINE, LogUtils.EXCEPTION_THROWN, se);
            }
View Full Code Here


    * @throws javax.xml.rpc.soap.SOAPFaultException
    */
   protected static void assertAddrProperties(AddressingProperties inProps) throws SOAPFaultException
   {
      if (null == inProps)
         throw new SOAPFaultException(Constants.SOAP11_FAULT_CODE_CLIENT, "Addressing headers missing from request", "wse:InvalidMessage", null);
      if(null == inProps.getTo())
         throw new SOAPFaultException(Constants.SOAP11_FAULT_CODE_CLIENT, "Event source URI missing from request (wsa:To)", "wse:InvalidMessage", null);
   }
View Full Code Here

   private void handleException(Exception ex) throws Throwable
   {
      Throwable th = ex;
      if (ex instanceof RemoteException && ex.getCause() instanceof SOAPFaultException)
      {
         SOAPFaultException faultEx = (SOAPFaultException)ex.getCause();
         if (faultEx.getCause() != null)
            th = faultEx.getCause();
      }
      throw th;
   }
View Full Code Here

/* 104 */       return res;
/*     */     }
/*     */     catch (SubscriptionError e)
/*     */     {
/*     */     }
/* 109 */     throw new SOAPFaultException(buildFaultQName(e.getSubcode()), e.getReason(), null, null);
/*     */   }
View Full Code Here

/*     */   }
/*     */
/*     */   private void assertSubscriberEndpoints(Subscribe request)
/*     */   {
/* 119 */     if ((null == request.getDelivery().getNotifyTo()) || (null == request.getEndTo()))
/* 120 */       throw new SOAPFaultException(buildFaultQName("InvalidMessage"), "Subcriber endpoint information missing from request", null, null);
/*     */   }
View Full Code Here

/*     */
/*  83 */       return response;
/*     */     }
/*     */     catch (SubscriptionError e) {
/*     */     }
/*  87 */     throw new SOAPFaultException(buildFaultQName(e.getSubcode()), e.getReason(), null, null);
/*     */   }
View Full Code Here

/*     */
/* 109 */       return response;
/*     */     }
/*     */     catch (SubscriptionError e) {
/*     */     }
/* 113 */     throw new SOAPFaultException(buildFaultQName(e.getSubcode()), e.getReason(), null, null);
/*     */   }
View Full Code Here

/*     */     {
/* 130 */       getSubscriptionManager().unsubscribe(identifier);
/*     */     }
/*     */     catch (SubscriptionError e)
/*     */     {
/* 134 */       throw new SOAPFaultException(buildFaultQName(e.getSubcode()), e.getReason(), null, null);
/*     */     }
/*     */   }
View Full Code Here

/* 142 */     CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
/* 143 */     AddressingProperties addrProps = (AddressingProperties)msgContext.get("javax.xml.ws.addressing.context.inbound");
/*     */
/* 145 */     if (null == addrProps)
/*     */     {
/* 147 */       throw new SOAPFaultException(Constants.SOAP11_FAULT_CODE_CLIENT, "The message is not valid and cannot be processed: Cannot obtain addressing properties.", null, null);
/*     */     }
/*     */
/* 155 */     ReferenceParameters refParams = addrProps.getReferenceParameters();
/*     */     Iterator i$;
/* 156 */     if (refParams != null)
/*     */     {
/* 158 */       for (i$ = refParams.getElements().iterator(); i$.hasNext(); ) { Object obj = i$.next();
/*     */
/* 160 */         if ((obj instanceof Element))
/*     */         {
/* 162 */           Element el = (Element)obj;
/* 163 */           QName qname = DOMUtils.getElementQName(el);
/* 164 */           if (qname.equals(IDQN))
/*     */           {
/*     */             try
/*     */             {
/* 168 */               subscriptionId = new URI(DOMUtils.getTextContent(el));
/*     */             }
/*     */             catch (URISyntaxException e)
/*     */             {
/* 173 */               throw new SOAPFaultException(Constants.SOAP11_FAULT_CODE_CLIENT, "The message is not valid and cannot be processed: Invalid subscription id.", null, null);
/*     */             }
/*     */
/*     */           }
/*     */
/*     */         }
/*     */
/*     */       }
/*     */
/*     */     }
/*     */
/* 185 */     if (null == subscriptionId)
/*     */     {
/* 187 */       throw new SOAPFaultException(buildFaultQName("InvalidMessage"), "The message is not valid and cannot be processed: Cannot obtain subscription id.", null, null);
/*     */     }
/*     */
/* 195 */     return subscriptionId;
/*     */   }
View Full Code Here

/*     */   private void handleException(Exception ex) throws Throwable
/*     */   {
/* 201 */     Throwable th = ex;
/* 202 */     if (((ex instanceof RemoteException)) && ((ex.getCause() instanceof SOAPFaultException)))
/*     */     {
/* 204 */       SOAPFaultException faultEx = (SOAPFaultException)ex.getCause();
/* 205 */       if (faultEx.getCause() != null)
/* 206 */         th = faultEx.getCause();
/*     */     }
/* 208 */     throw th;
/*     */   }
View Full Code Here

TOP

Related Classes of javax.xml.rpc.soap.SOAPFaultException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.