List of usage examples for javax.xml.namespace QName getLocalPart
public String getLocalPart()
Get the local part of this QName
.
From source file:org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.java
public boolean hasFault() { QName payloadQName = this.getPayloadQName_Optimized(); if (payloadQName != null) { if (SOAPConstants.SOAPFAULT_LOCAL_NAME.equals(payloadQName.getLocalPart())) { String ns = payloadQName.getNamespaceURI(); return (ns != null && (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns) || SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns))); }//from w w w . j a v a 2 s . c om } // Fallback: Get the body and get the fault information from the body SOAPBody body = this.getBody(); return (body == null) ? false : body.hasFault(); }
From source file:org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.java
public String getSOAPBodyFirstElementLocalName() { QName payloadQName = this.getPayloadQName_Optimized(); if (payloadQName != null) { return payloadQName.getLocalPart(); }/*from w w w . ja va 2 s . c om*/ SOAPBody body = this.getBody(); return (body == null) ? null : body.getFirstElementLocalName(); }
From source file:org.apache.axis.AxisFault.java
/** * Create an element of the given qname and add it to the details. * * @param qname qname of the element// w ww .j ava2 s . c o m * @param body string to use as body */ public void addFaultDetail(QName qname, String body) { Element detail = XMLUtils.StringToElement(qname.getNamespaceURI(), qname.getLocalPart(), body); addFaultDetail(detail); }
From source file:org.apache.axis.AxisFault.java
/** * Find a fault detail element by its qname. * @param qname name of the node to look for * @return the matching element or null/*from w w w . j av a2s. c om*/ * @since axis1.1 */ public Element lookupFaultDetail(QName qname) { if (faultDetails != null) { //extract details from the qname. the empty namespace is represented //by the empty string String searchNamespace = qname.getNamespaceURI(); String searchLocalpart = qname.getLocalPart(); //now spin through the elements, seeking a match Iterator it = faultDetails.iterator(); while (it.hasNext()) { Element e = (Element) it.next(); String localpart = e.getLocalName(); if (localpart == null) { localpart = e.getNodeName(); } String namespace = e.getNamespaceURI(); if (namespace == null) { namespace = ""; } //we match on matching namespace and local part; empty namespace //in an element may be null, which matches QName's "" if (searchNamespace.equals(namespace) && searchLocalpart.equals(localpart)) { return e; } } } return null; }
From source file:org.apache.axis.client.Call.java
/** * Adds the specified parameter to the list of parameters for the * operation associated with this Call object. * * * Note: Not part of JAX-RPC specification. * * @param paramName Name that will be used for the parameter in the XML * @param xmlType XMLType of the parameter * @param javaType The Java class of the parameter * @param parameterMode one of IN, OUT or INOUT *//*from w ww . j av a 2s . c om*/ public void addParameter(QName paramName, QName xmlType, Class javaType, ParameterMode parameterMode) { if (operationSetManually) { throw new RuntimeException(Messages.getMessage("operationAlreadySet")); } if (operation == null) operation = new OperationDesc(); ParameterDesc param = new ParameterDesc(); byte mode = ParameterDesc.IN; if (parameterMode == ParameterMode.INOUT) { mode = ParameterDesc.INOUT; param.setIsReturn(true); } else if (parameterMode == ParameterMode.OUT) { mode = ParameterDesc.OUT; param.setIsReturn(true); } param.setMode(mode); param.setQName(new QName(paramName.getNamespaceURI(), Utils.getLastLocalPart(paramName.getLocalPart()))); param.setTypeQName(xmlType); param.setJavaType(javaType); operation.addParameter(param); parmAndRetReq = true; }
From source file:org.apache.axis.client.Call.java
/** /* ww w .ja v a 2 s . c o m*/ * Adds a parameter type as a soap:header. * @param paramName - Name of the parameter * @param xmlType - XML datatype of the parameter * @param javaType - The Java class of the parameter * @param parameterMode - Mode of the parameter-whether IN, OUT or INOUT * @param headerMode - Mode of the header. Even if this is an INOUT * parameter, it need not be in the header in both * directions. * @exception JAXRPCException - if isParameterAndReturnSpecRequired returns * false, then addParameter MAY throw * JAXRPCException....actually Axis allows * modification in such cases */ public void addParameterAsHeader(QName paramName, QName xmlType, Class javaType, ParameterMode parameterMode, ParameterMode headerMode) { if (operationSetManually) { throw new RuntimeException(Messages.getMessage("operationAlreadySet")); } if (operation == null) operation = new OperationDesc(); ParameterDesc param = new ParameterDesc(); param.setQName(new QName(paramName.getNamespaceURI(), Utils.getLastLocalPart(paramName.getLocalPart()))); param.setTypeQName(xmlType); param.setJavaType(javaType); if (parameterMode == ParameterMode.IN) { param.setMode(ParameterDesc.IN); } else if (parameterMode == ParameterMode.INOUT) { param.setMode(ParameterDesc.INOUT); } else if (parameterMode == ParameterMode.OUT) { param.setMode(ParameterDesc.OUT); } if (headerMode == ParameterMode.IN) { param.setInHeader(true); } else if (headerMode == ParameterMode.INOUT) { param.setInHeader(true); param.setOutHeader(true); } else if (headerMode == ParameterMode.OUT) { param.setOutHeader(true); } operation.addParameter(param); parmAndRetReq = true; }
From source file:org.apache.axis.client.Call.java
/** * prefill as much info from the WSDL as it can. * Right now it's target URL, SOAPAction, Parameter types, * and return type of the Web Service.//from ww w .j a v a 2 s . com * * If wsdl is not present, this function set port name and operation name * and does not modify target endpoint address. * * Note: Not part of JAX-RPC specification. * * @param portName PortName in the WSDL doc to search for * @param opName Operation(method) that's going to be invoked */ public void setOperation(QName portName, QName opName) { if (service == null) throw new JAXRPCException(Messages.getMessage("noService04")); // Make sure we're making a fresh start. this.setPortName(portName); this.setOperationName(opName); this.setReturnType(null); this.removeAllParameters(); javax.wsdl.Service wsdlService = service.getWSDLService(); // Nothing to do is the WSDL is not already set. if (wsdlService == null) { return; } // we reinitialize target endpoint only if we have wsdl this.setTargetEndpointAddress((URL) null); Port port = wsdlService.getPort(portName.getLocalPart()); if (port == null) { throw new JAXRPCException(Messages.getMessage("noPort00", "" + portName)); } // Get the URL //////////////////////////////////////////////////////////////////// List list = port.getExtensibilityElements(); for (int i = 0; list != null && i < list.size(); i++) { Object obj = list.get(i); if (obj instanceof SOAPAddress) { try { SOAPAddress addr = (SOAPAddress) obj; URL url = new URL(addr.getLocationURI()); this.setTargetEndpointAddress(url); } catch (Exception exp) { throw new JAXRPCException(Messages.getMessage("cantSetURI00", "" + exp)); } } } setOperation(opName.getLocalPart()); }
From source file:org.apache.axis.client.Call.java
/** * Convert the list of objects into RPCParam's based on the paramNames, * paramXMLTypes and paramModes variables. If those aren't set then just * return what was passed in./* www. ja v a 2 s . com*/ * * @param params Array of parameters to pass into the operation/method * @return Object[] Array of parameters to pass to invoke() */ private Object[] getParamList(Object[] params) { int numParams = 0; // If we never set-up any names... then just return what was passed in ////////////////////////////////////////////////////////////////////// if (log.isDebugEnabled()) { log.debug("operation=" + operation); if (operation != null) { log.debug("operation.getNumParams()=" + operation.getNumParams()); } } if (operation == null || operation.getNumParams() == 0) { return (params); } // Count the number of IN and INOUT params, this needs to match the // number of params passed in - if not throw an error ///////////////////////////////////////////////////////////////////// numParams = operation.getNumInParams(); if (params == null || numParams != params.length) { throw new JAXRPCException(Messages.getMessage("parmMismatch00", (params == null) ? "no params" : "" + params.length, "" + numParams)); } log.debug("getParamList number of params: " + params.length); // All ok - so now produce an array of RPCParams ////////////////////////////////////////////////// Vector result = new Vector(); int j = 0; ArrayList parameters = operation.getParameters(); for (int i = 0; i < parameters.size(); i++) { ParameterDesc param = (ParameterDesc) parameters.get(i); if (param.getMode() != ParameterDesc.OUT) { QName paramQName = param.getQName(); // Create an RPCParam if param isn't already an RPCParam. RPCParam rpcParam = null; Object p = params[j++]; if (p instanceof RPCParam) { rpcParam = (RPCParam) p; } else { rpcParam = new RPCParam(paramQName.getNamespaceURI(), paramQName.getLocalPart(), p); } // Attach the ParameterDescription to the RPCParam // so that the serializer can use the (javaType, xmlType) // information. rpcParam.setParamDesc(param); // Add the param to the header or vector depending // on whether it belongs in the header or body. if (param.isInHeader()) { addHeader(new RPCHeaderParam(rpcParam)); } else { result.add(rpcParam); } } } return (result.toArray()); }
From source file:org.apache.axis.deployment.wsdd.WSDDDeployableItem.java
/** * * @return XXX//from w w w. jav a2 s . c o m * @throws ClassNotFoundException XXX */ public Class getJavaClass() throws ClassNotFoundException { QName type = getType(); if (type != null && URI_WSDD_JAVA.equals(type.getNamespaceURI())) { return ClassUtils.forName(type.getLocalPart()); } return null; }
From source file:org.apache.axis.description.JavaServiceDesc.java
/** * Return all operations which match this QName (i.e. get all the * overloads)//from w w w . j a v a 2s. co m * @return null for no match */ public OperationDesc[] getOperationsByQName(QName qname) { // Look in our mapping of QNames -> operations. // But first, let's make sure we've initialized said mapping.... initQNameMap(); ArrayList overloads = (ArrayList) qname2OperationsMap.get(qname); if (overloads == null) { // Nothing specifically matching this QName. if (name2OperationsMap != null) { if ((isWrapped() || ((style == Style.MESSAGE) && (getDefaultNamespace() == null)))) { // Try ignoring the namespace....? overloads = (ArrayList) name2OperationsMap.get(qname.getLocalPart()); } else { // TODO the above code is weird: a JavaServiceDesc can be document or rpc and // still define a WSDL operation using a wrapper style mapping. // The following code handles this case. Object ops = name2OperationsMap.get(qname.getLocalPart()); if (ops != null) { overloads = new ArrayList((Collection) ops); for (Iterator iter = overloads.iterator(); iter.hasNext();) { OperationDesc operationDesc = (OperationDesc) iter.next(); if (Style.WRAPPED != operationDesc.getStyle()) { iter.remove(); } } } } } // Handle the case where a single Message-style operation wants // to accept anything. if ((style == Style.MESSAGE) && (messageServiceDefaultOp != null)) return new OperationDesc[] { messageServiceDefaultOp }; if (overloads == null) return null; } getSyncedOperationsForName(implClass, ((OperationDesc) overloads.get(0)).getName()); // Sort the overloads by number of arguments - prevents us calling methods // with more parameters than supplied in the request (with missing parameters // defaulted to null) when a perfectly good method exists with exactly the // supplied parameters. Collections.sort(overloads, new Comparator() { public int compare(Object o1, Object o2) { Method meth1 = ((OperationDesc) o1).getMethod(); Method meth2 = ((OperationDesc) o2).getMethod(); return (meth1.getParameterTypes().length - meth2.getParameterTypes().length); } }); OperationDesc[] array = new OperationDesc[overloads.size()]; return (OperationDesc[]) overloads.toArray(array); }