Java 类javax.xml.soap.Name 实例源码

项目:openjdk-jdk10    文件:XmlTest.java   
private SOAPMessage createMessage(MessageFactory mf) throws SOAPException, IOException {
    SOAPMessage msg = mf.createMessage();
    SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
    Name name = envelope.createName("hello", "ex", "http://example.com");
    envelope.getBody().addChildElement(name).addTextNode("THERE!");

    String s = "<root><hello>THERE!</hello></root>";

    AttachmentPart ap = msg.createAttachmentPart(
            new StreamSource(new ByteArrayInputStream(s.getBytes())),
            "text/xml"
    );
    msg.addAttachmentPart(ap);
    msg.saveChanges();

    return msg;
}
项目:OpenJSharp    文件:Fault1_1Impl.java   
public Name getFaultCodeAsName() {

        String faultcodeString = getFaultCode();
        if (faultcodeString == null) {
            return null;
        }
        int prefixIndex = faultcodeString.indexOf(':');
        if (prefixIndex == -1) {
            // Not a valid SOAP message, but we return the unqualified name
            // anyway since some apps do not strictly conform to SOAP
            // specs.  A message that does not contain a <faultcode>
            // element itself is also not valid in which case we return
            // null instead of throwing an exception so this is consistent.
            return NameImpl.createFromUnqualifiedName(faultcodeString);
        }

        // Get the prefix and map it to a namespace name (AKA namespace URI)
        String prefix = faultcodeString.substring(0, prefixIndex);
        if (this.faultCodeElement == null)
            findFaultCodeElement();
        String nsName = this.faultCodeElement.getNamespaceURI(prefix);
        return NameImpl.createFromQualifiedName(faultcodeString, nsName);
    }
项目:OpenJSharp    文件:NameImpl.java   
public boolean equals(Object obj) {
    if (!(obj instanceof Name)) {
        return false;
    }

    Name otherName = (Name) obj;

    if (!uri.equals(otherName.getURI())) {
        return false;
    }

    if (!localName.equals(otherName.getLocalName())) {
        return false;
    }

    return true;
}
项目:openjdk-jdk10    文件:Fault1_1Impl.java   
@Override
public Name getFaultCodeAsName() {

    String faultcodeString = getFaultCode();
    if (faultcodeString == null) {
        return null;
    }
    int prefixIndex = faultcodeString.indexOf(':');
    if (prefixIndex == -1) {
        // Not a valid SOAP message, but we return the unqualified name
        // anyway since some apps do not strictly conform to SOAP
        // specs.  A message that does not contain a <faultcode>
        // element itself is also not valid in which case we return
        // null instead of throwing an exception so this is consistent.
        return NameImpl.createFromUnqualifiedName(faultcodeString);
    }

    // Get the prefix and map it to a namespace name (AKA namespace URI)
    String prefix = faultcodeString.substring(0, prefixIndex);
    if (this.faultCodeElement == null)
        findFaultCodeElement();
    String nsName = this.faultCodeElement.getNamespaceURI(prefix);
    return NameImpl.createFromQualifiedName(faultcodeString, nsName);
}
项目:openjdk-jdk10    文件:NameImpl.java   
@Override
public boolean equals(Object obj) {
    if (!(obj instanceof Name)) {
        return false;
    }

    Name otherName = (Name) obj;

    if (!uri.equals(otherName.getURI())) {
        return false;
    }

    if (!localName.equals(otherName.getLocalName())) {
        return false;
    }

    return true;
}
项目:openjdk-jdk10    文件:ElementImpl.java   
protected SOAPElement replaceElementWithSOAPElement(
    Element element,
    ElementImpl copy) {

    Iterator<Name> eachAttribute = getAllAttributesFrom(element);
    while (eachAttribute.hasNext()) {
        Name name = eachAttribute.next();
        copy.addAttributeBare(name, getAttributeValueFrom(element, name));
    }

    Iterator<Node> eachChild = getChildElementsFromDOM(element);
    while (eachChild.hasNext()) {
        Node nextChild = eachChild.next();
        copy.insertBefore(nextChild, null);
    }

    Node parent = soapDocument.find(element.getParentNode());
    if (parent != null) {
        parent.replaceChild(copy, element);
    } // XXX else throw an exception?

    return copy;
}
项目:openjdk-jdk10    文件:ElementImpl.java   
protected String getSOAPNamespace() {
    String soapNamespace = null;

    SOAPElement antecedent = this;
    while (antecedent != null) {
        Name antecedentName = antecedent.getElementName();
        String antecedentNamespace = antecedentName.getURI();

        if (NameImpl.SOAP11_NAMESPACE.equals(antecedentNamespace)
            || NameImpl.SOAP12_NAMESPACE.equals(antecedentNamespace)) {

            soapNamespace = antecedentNamespace;
            break;
        }

        antecedent = antecedent.getParentElement();
    }

    return soapNamespace;
}
项目:openjdk-jdk10    文件:HeaderImpl.java   
@Override
public SOAPHeaderElement addHeaderElement(Name name) throws SOAPException {
    SOAPElement newHeaderElement =
        ElementFactory.createNamedElement(
            ((SOAPDocument) getOwnerDocument()).getDocument(),
            name.getLocalName(),
            name.getPrefix(),
            name.getURI());
    if (newHeaderElement == null
        || !(newHeaderElement instanceof SOAPHeaderElement)) {
        newHeaderElement = createHeaderElement(name);
    }

    // header elements must be namespace qualified
    // check that URI is  not empty, ensuring that the element is NS qualified.
    String uri = newHeaderElement.getElementQName().getNamespaceURI();
    if ((uri == null) || ("").equals(uri)) {
        log.severe("SAAJ0131.impl.header.elems.ns.qualified");
        throw new SOAPExceptionImpl("HeaderElements must be namespace qualified");
    }
    addNode(newHeaderElement);
    return (SOAPHeaderElement) newHeaderElement;
}
项目:openjdk9    文件:XmlTest.java   
private SOAPMessage createMessage(MessageFactory mf) throws SOAPException, IOException {
    SOAPMessage msg = mf.createMessage();
    SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
    Name name = envelope.createName("hello", "ex", "http://example.com");
    envelope.getBody().addChildElement(name).addTextNode("THERE!");

    String s = "<root><hello>THERE!</hello></root>";

    AttachmentPart ap = msg.createAttachmentPart(
            new StreamSource(new ByteArrayInputStream(s.getBytes())),
            "text/xml"
    );
    msg.addAttachmentPart(ap);
    msg.saveChanges();

    return msg;
}
项目:openjdk9    文件:Fault1_1Impl.java   
public Name getFaultCodeAsName() {

        String faultcodeString = getFaultCode();
        if (faultcodeString == null) {
            return null;
        }
        int prefixIndex = faultcodeString.indexOf(':');
        if (prefixIndex == -1) {
            // Not a valid SOAP message, but we return the unqualified name
            // anyway since some apps do not strictly conform to SOAP
            // specs.  A message that does not contain a <faultcode>
            // element itself is also not valid in which case we return
            // null instead of throwing an exception so this is consistent.
            return NameImpl.createFromUnqualifiedName(faultcodeString);
        }

        // Get the prefix and map it to a namespace name (AKA namespace URI)
        String prefix = faultcodeString.substring(0, prefixIndex);
        if (this.faultCodeElement == null)
            findFaultCodeElement();
        String nsName = this.faultCodeElement.getNamespaceURI(prefix);
        return NameImpl.createFromQualifiedName(faultcodeString, nsName);
    }
项目:openjdk9    文件:NameImpl.java   
public boolean equals(Object obj) {
    if (!(obj instanceof Name)) {
        return false;
    }

    Name otherName = (Name) obj;

    if (!uri.equals(otherName.getURI())) {
        return false;
    }

    if (!localName.equals(otherName.getLocalName())) {
        return false;
    }

    return true;
}
项目:sam-elle    文件:EditTerminalClient.java   
/**
 * Gets the terminal response.
 * 
 * @param message
 * @throws SOAPException
 */
private void writeTerminalResponse(SOAPMessage message) throws SOAPException {
    SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
    Name terminalResponseName = envelope.createName("EditTerminalResponse", PREFIX, NAMESPACE_URI);
    SOAPBodyElement terminalResponseElement = (SOAPBodyElement) message.getSOAPBody().getChildElements(terminalResponseName).next();

    NodeList list = terminalResponseElement.getChildNodes();
    Node n = null;
    for (int i = 0; i < list.getLength(); i++) {
        n = list.item(i);
        if ("status".equalsIgnoreCase(n.getLocalName()))
            break;
    }

    logger.info("status of device = " + n.getNodeValue());

}
项目:sam-elle    文件:GetTerminalsByMsisdnClient.java   
/**
 * This method creates a Terminal Request and sends back the SOAPMessage.
 * MSISDN value is passed into this method
 * 
 * @param msisdn
 * @return
 * @throws SOAPException
 */
private SOAPMessage createTerminalRequest(String msisdn) throws SOAPException {
    SOAPMessage message = messageFactory.createMessage();
    message.getMimeHeaders().addHeader("SOAPAction", "http://api.jasperwireless.com/ws/service/terminal/GetTerminalsByMsisdn");
    SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
    Name terminalRequestName = envelope.createName("GetTerminalsByMsisdnRequest", PREFIX, NAMESPACE_URI);
    SOAPBodyElement terminalRequestElement = message.getSOAPBody().addBodyElement(terminalRequestName);
    Name msgId = envelope.createName("messageId", PREFIX, NAMESPACE_URI);
    SOAPElement msgElement = terminalRequestElement.addChildElement(msgId);
    msgElement.setValue("TCE-100-ABC-34084");
    Name version = envelope.createName("version", PREFIX, NAMESPACE_URI);
    SOAPElement versionElement = terminalRequestElement.addChildElement(version);
    versionElement.setValue("1.0");
    Name license = envelope.createName("licenseKey", PREFIX, NAMESPACE_URI);
    SOAPElement licenseElement = terminalRequestElement.addChildElement(license);
    licenseElement.setValue(apiKey);
    Name msisdns = envelope.createName("msisdns", PREFIX, NAMESPACE_URI);
    SOAPElement msisdnsElement = terminalRequestElement.addChildElement(msisdns);
    Name msisdnName = envelope.createName("msisdn", PREFIX, NAMESPACE_URI);
    SOAPElement msisdnElement = msisdnsElement.addChildElement(msisdnName);
    msisdnElement.setValue(msisdn);
    return message;
}
项目:sam-elle    文件:GetTerminalsByMsisdnClient.java   
/**
 * Gets the terminal response.
 * 
 * @param message
 * @throws SOAPException
 */
private String writeTerminalResponse(SOAPMessage message) throws SOAPException {
    SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
    Name terminalResponseName = envelope.createName("GetTerminalsByMsisdnResponse", PREFIX, NAMESPACE_URI);
    SOAPBodyElement terminalResponseElement = (SOAPBodyElement) message.getSOAPBody().getChildElements(terminalResponseName).next();
    Name terminals = envelope.createName("terminals", PREFIX, NAMESPACE_URI);
    Name terminal = envelope.createName("terminal", PREFIX, NAMESPACE_URI);
    SOAPBodyElement terminalsElement = (SOAPBodyElement) terminalResponseElement.getChildElements(terminals).next();
    SOAPBodyElement terminalElement = (SOAPBodyElement) terminalsElement.getChildElements(terminal).next();
    NodeList list = terminalElement.getChildNodes();
    Node n = null, node = null;
    for (int i = 0; i < list.getLength(); i++) {
        node = list.item(i);
        logger.info(node.getLocalName() + ":" + node.getFirstChild().getNodeValue());
        if ("iccid".equalsIgnoreCase(node.getLocalName())) {
            n = node;
        }
    }

    return n.getFirstChild().getNodeValue();

}
项目:hermes    文件:SOAPUtilities.java   
/**
 * Create a SOAP Element with the specified parameters.<p>
 * 
 * Also it create the attributes set as the parameter properties.
 * 
 * @param tagName       the name of XML tag.
 * @param tagValue      the value of XML tag. 
 * @param nsPrefix      the namespace prefix.
 * @param nsURI         the namespace URL.
 * @param attrSet       the attributes set in the element.
 * 
 * @return              the new SOAP element created.
 */
public static SOAPElement createElement(String tagName
                                       ,String tagValue
                                       ,String nsPrefix
                                       ,String nsURI
                                       ,Hashtable attrSet) throws SOAPException {
    SOAPElement newElem = 
        SOAPUtilities.createElement(tagName, tagValue, nsPrefix, nsURI);

    if (newElem == null || attrSet.size() == 0)
        return newElem;     

    // Iterate all attributes in the set.
    Enumeration keys = attrSet.keys();
    while (keys.hasMoreElements()){                             
        Object key      = keys.nextElement();
        Object value    = attrSet.get(key);
        // Create SOAP Name for the tag.
        Name   attrName = SOAPFactory.newInstance().createName(key.toString(), null, null);
        newElem.addAttribute(attrName, value.toString());
    }
    return newElem;
}
项目:hermes    文件:ExtensionElementImpl.java   
private static Iterator getChildElements(SOAPElement parent, Name name) {
    final ArrayList childElements = new ArrayList();

    for (Iterator i=parent.getChildElements() ; i.hasNext() ; ) {
        final Object object = i.next();
        if ((object instanceof SOAPElement) == false)
            continue;

        final SOAPElement child = (SOAPElement) object;
        final Name childName = child.getElementName();
        if (childName.getLocalName().equals(name.getLocalName()) &&
            childName.getURI().equals(name.getURI())) {
            childElements.add(child);
            continue;
        }

        for (Iterator j=getChildElements(child, name) ; j.hasNext() ; ) {
            final SOAPElement grandChild = (SOAPElement) j.next();
            childElements.add(grandChild);
        }
    }

    return childElements.iterator();
}
项目:jasperreports    文件:JRXmlaQueryExecuter.java   
protected void addParameterList(SOAPEnvelope envelope, SOAPElement eParent, String typeName, String listName, Map<String, String> params) throws SOAPException
{
    Name nPara = envelope.createName(typeName, "", XMLA_URI);
    SOAPElement eType = eParent.addChildElement(nPara);
    nPara = envelope.createName(listName, "", XMLA_URI);
    SOAPElement eList = eType.addChildElement(nPara);
    if (params == null)
    {
        return;
    }
    for (Iterator<Map.Entry<String, String>> entryIt = params.entrySet().iterator(); entryIt.hasNext();)
    {
        Map.Entry<String, String> entry = entryIt.next();
        String tag = entry.getKey();
        String value = entry.getValue();
        nPara = envelope.createName(tag, "", XMLA_URI);
        SOAPElement eTag = eList.addChildElement(nPara);
        eTag.addTextNode(value);
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:Fault1_1Impl.java   
public Name getFaultCodeAsName() {

        String faultcodeString = getFaultCode();
        if (faultcodeString == null) {
            return null;
        }
        int prefixIndex = faultcodeString.indexOf(':');
        if (prefixIndex == -1) {
            // Not a valid SOAP message, but we return the unqualified name
            // anyway since some apps do not strictly conform to SOAP
            // specs.  A message that does not contain a <faultcode>
            // element itself is also not valid in which case we return
            // null instead of throwing an exception so this is consistent.
            return NameImpl.createFromUnqualifiedName(faultcodeString);
        }

        // Get the prefix and map it to a namespace name (AKA namespace URI)
        String prefix = faultcodeString.substring(0, prefixIndex);
        if (this.faultCodeElement == null)
            findFaultCodeElement();
        String nsName = this.faultCodeElement.getNamespaceURI(prefix);
        return NameImpl.createFromQualifiedName(faultcodeString, nsName);
    }
项目:lookaside_java-1.8.0-openjdk    文件:NameImpl.java   
public boolean equals(Object obj) {
    if (!(obj instanceof Name)) {
        return false;
    }

    Name otherName = (Name) obj;

    if (!uri.equals(otherName.getURI())) {
        return false;
    }

    if (!localName.equals(otherName.getLocalName())) {
        return false;
    }

    return true;
}
项目:libreacs    文件:X_00000C_ShowStatusResponse.java   
@Override
protected void parseBody(SOAPBodyElement body, SOAPFactory spf) throws SOAPException {
    Iterator pi = getRequestChildElement(spf, body, "ExecResponseList").getChildElements(spf.createName("ExecResponseStruct"));
    Name nameKey = spf.createName("Command");
    Name nameValue = spf.createName("Response");
    while (pi.hasNext()) {
        SOAPElement param = (SOAPElement) pi.next();
        String key = getRequestElement(param, nameKey);
        String value = getRequestElement(param, nameValue);
        if (value == null) {
            value = "";
        }
        System.out.append(key + "->" + value);
        response.put(key, value);
    }
}
项目:sam-elle    文件:EditTerminalClient.java   
/**
 * Gets the terminal response.
 * 
 * @param message
 * @throws SOAPException
 */
private void writeTerminalResponse(SOAPMessage message) throws SOAPException {
    SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
    Name terminalResponseName = envelope.createName("EditTerminalResponse", PREFIX, NAMESPACE_URI);
    SOAPBodyElement terminalResponseElement = (SOAPBodyElement) message.getSOAPBody().getChildElements(terminalResponseName).next();

    NodeList list = terminalResponseElement.getChildNodes();
    Node n = null;
    for (int i = 0; i < list.getLength(); i++) {
        n = list.item(i);
        if ("status".equalsIgnoreCase(n.getLocalName()))
            break;
    }

    logger.info("status of device = " + n.getNodeValue());

}
项目:sam-elle    文件:GetTerminalsByMsisdnClient.java   
/**
 * This method creates a Terminal Request and sends back the SOAPMessage.
 * MSISDN value is passed into this method
 * 
 * @param msisdn
 * @return
 * @throws SOAPException
 */
private SOAPMessage createTerminalRequest(String msisdn) throws SOAPException {
    SOAPMessage message = messageFactory.createMessage();
    message.getMimeHeaders().addHeader("SOAPAction", "http://api.jasperwireless.com/ws/service/terminal/GetTerminalsByMsisdn");
    SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
    Name terminalRequestName = envelope.createName("GetTerminalsByMsisdnRequest", PREFIX, NAMESPACE_URI);
    SOAPBodyElement terminalRequestElement = message.getSOAPBody().addBodyElement(terminalRequestName);
    Name msgId = envelope.createName("messageId", PREFIX, NAMESPACE_URI);
    SOAPElement msgElement = terminalRequestElement.addChildElement(msgId);
    msgElement.setValue("TCE-100-ABC-34084");
    Name version = envelope.createName("version", PREFIX, NAMESPACE_URI);
    SOAPElement versionElement = terminalRequestElement.addChildElement(version);
    versionElement.setValue("1.0");
    Name license = envelope.createName("licenseKey", PREFIX, NAMESPACE_URI);
    SOAPElement licenseElement = terminalRequestElement.addChildElement(license);
    licenseElement.setValue(apiKey);
    Name msisdns = envelope.createName("msisdns", PREFIX, NAMESPACE_URI);
    SOAPElement msisdnsElement = terminalRequestElement.addChildElement(msisdns);
    Name msisdnName = envelope.createName("msisdn", PREFIX, NAMESPACE_URI);
    SOAPElement msisdnElement = msisdnsElement.addChildElement(msisdnName);
    msisdnElement.setValue(msisdn);
    return message;
}
项目:sam-elle    文件:GetTerminalsByMsisdnClient.java   
/**
 * Gets the terminal response.
 * 
 * @param message
 * @throws SOAPException
 */
private String writeTerminalResponse(SOAPMessage message) throws SOAPException {
    SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
    Name terminalResponseName = envelope.createName("GetTerminalsByMsisdnResponse", PREFIX, NAMESPACE_URI);
    SOAPBodyElement terminalResponseElement = (SOAPBodyElement) message.getSOAPBody().getChildElements(terminalResponseName).next();
    Name terminals = envelope.createName("terminals", PREFIX, NAMESPACE_URI);
    Name terminal = envelope.createName("terminal", PREFIX, NAMESPACE_URI);
    SOAPBodyElement terminalsElement = (SOAPBodyElement) terminalResponseElement.getChildElements(terminals).next();
    SOAPBodyElement terminalElement = (SOAPBodyElement) terminalsElement.getChildElements(terminal).next();
    NodeList list = terminalElement.getChildNodes();
    Node n = null, node = null;
    for (int i = 0; i < list.getLength(); i++) {
        node = list.item(i);
        logger.info(node.getLocalName() + ":" + node.getFirstChild().getNodeValue());
        if ("iccid".equalsIgnoreCase(node.getLocalName())) {
            n = node;
        }
    }

    return n.getFirstChild().getNodeValue();

}
项目:openxds    文件:SoapRequestBean.java   
public SOAPMessage onMessage(SOAPMessage msg){
    //handles the response back from the registry
    PrintStream orig = System.out;

    try {
        SOAPEnvelope env = msg.getSOAPPart().getEnvelope();
        Name response = env.createName("response");
        env.getBody().getChildElements(response);

    } catch (SOAPException ex) {
        ByteArrayOutputStream logarray = new ByteArrayOutputStream();
        ex.printStackTrace(writeErrorlog(logarray));
        logstring = logarray.toString();
        setlogmsg(logstring);  
    }

    return msg;
}
项目:PDFReporter-Studio    文件:MetadataDiscover.java   
/**
 * Add the all the specified parameters to the discover request message
 *   
 * @param envelope the envelope of the message 
 * @param eParent the discover query content
 * @param typeName the type of the parameter list (essentially can be or Properties or Restrictions)
 * @param listName the name of the list parameter tag (essentially can be or PropertyList or RestrictionList)
 * @param params parameters map where the key is the name of the parameter and the value is the value of the parameter
 * @throws SOAPException
 */
protected void addParameterList(SOAPEnvelope envelope, SOAPElement eParent, String typeName, String listName, Map<String, String> params) throws SOAPException
{
    Name nPara = envelope.createName(typeName, "", XMLA_URI);
    SOAPElement eType = eParent.addChildElement(nPara);
    nPara = envelope.createName(listName, "", XMLA_URI);
    SOAPElement eList = eType.addChildElement(nPara);
    if (params == null)
        return;

    Iterator<String> it = params.keySet().iterator();
    while (it.hasNext())
    {
        String tag = (String) it.next();
        String value = (String) params.get(tag);
        nPara = envelope.createName(tag, "", XMLA_URI);
        SOAPElement eTag = eList.addChildElement(nPara);
        eTag.addTextNode(value);
    }
}
项目:PDFReporter-Studio    文件:MetadataDiscover.java   
/**
 * Return an array of the datasources in the server, could be null
 * @return array of datasources
 */
public DataSourceTreeElement[] getDatasources() {
    setRequestType("DISCOVER_DATASOURCES");
    SOAPMessage response = executeDiscover(new HashMap<String, String>());
    SOAPPart soapPart = response.getSOAPPart();
    SOAPEnvelope soapEnvelope;
    try {            
        soapEnvelope = soapPart.getEnvelope();
        SOAPElement rowSet = getRowsSet(response, soapEnvelope);
        List<DataSourceTreeElement> result = new ArrayList<DataSourceTreeElement>();
        Name rowElement = soapEnvelope.createName("row", "", ROW_URI);
        Iterator<?> rowValuesElement = rowSet.getChildElements(rowElement);
        while (rowValuesElement.hasNext())
        {
            SOAPElement cellElement = (SOAPElement)rowValuesElement.next();
            result.add(new DataSourceElement(this, cellElement));
        }
        return result.toArray(new DataSourceTreeElement[result.size()]);
    } catch (SOAPException e) {
        e.printStackTrace();
    }
    return null;
}
项目:PDFReporter-Studio    文件:MetadataDiscover.java   
/**
 * Return an array of the catalogs in the server for a specific datasource, could be null
 * @param datasourceName the name of the datasource
 * @return array of catalogs
 */
public DataSourceTreeElement[] getCatalogList(String datasourceName) {
    setRequestType("DBSCHEMA_CATALOGS");
    HashMap<String, String> param = new HashMap<String, String>();
    param.put("DataSourceInfo", datasourceName);
    SOAPMessage response = executeDiscover(param);
    SOAPPart soapPart = response.getSOAPPart();
    SOAPEnvelope soapEnvelope;
    try {
        soapEnvelope = soapPart.getEnvelope();
        SOAPElement rowSet = getRowsSet(response, soapEnvelope);
        List<DataSourceTreeElement> result = new ArrayList<DataSourceTreeElement>();
        Name rowElement = soapEnvelope.createName("row", "", ROW_URI);
        Iterator<?> rowValuesElement = rowSet.getChildElements(rowElement);
        while (rowValuesElement.hasNext())
        {
            SOAPElement cellElement = (SOAPElement)rowValuesElement.next();
            result.add(new CatalogElement(this, cellElement, datasourceName));
        }
        return result.toArray(new DataSourceTreeElement[result.size()]);
    } catch (SOAPException e) {
        e.printStackTrace();
    }
    return null;
}
项目:PDFReporter-Studio    文件:MetadataDiscover.java   
/**
 * Return an array of the cubes in the server for a specific datasource and catalog, could be null
 * @param datasourceName the name of the datasource
 * @param catalogName the name of the catalog
 * @return array of cubes
 */
public DataSourceTreeElement[] getCubeList(String datasourceName, String catalogName) {
    setRequestType("MDSCHEMA_CUBES");
    HashMap<String, String> param = new HashMap<String, String>();
    param.put("DataSourceInfo", datasourceName);
    param.put("Catalog", catalogName);
    SOAPMessage response = executeDiscover(param);
    SOAPPart soapPart = response.getSOAPPart();
    SOAPEnvelope soapEnvelope;
    try {
        soapEnvelope = soapPart.getEnvelope();
        SOAPElement rowSet = getRowsSet(response, soapEnvelope);
        List<DataSourceTreeElement> result = new ArrayList<DataSourceTreeElement>();
        Name rowElement = soapEnvelope.createName("row", "", ROW_URI);
        Iterator<?> rowValuesElement = rowSet.getChildElements(rowElement);
        while (rowValuesElement.hasNext())
        {
            SOAPElement cellElement = (SOAPElement)rowValuesElement.next();
            result.add(new CubeElement(this, cellElement, datasourceName));
        }
        return result.toArray(new DataSourceTreeElement[result.size()]);
    } catch (SOAPException e) {
        e.printStackTrace();
    }
    return null;
}
项目:infobip-open-jdk-8    文件:Fault1_1Impl.java   
public Name getFaultCodeAsName() {

        String faultcodeString = getFaultCode();
        if (faultcodeString == null) {
            return null;
        }
        int prefixIndex = faultcodeString.indexOf(':');
        if (prefixIndex == -1) {
            // Not a valid SOAP message, but we return the unqualified name
            // anyway since some apps do not strictly conform to SOAP
            // specs.  A message that does not contain a <faultcode>
            // element itself is also not valid in which case we return
            // null instead of throwing an exception so this is consistent.
            return NameImpl.createFromUnqualifiedName(faultcodeString);
        }

        // Get the prefix and map it to a namespace name (AKA namespace URI)
        String prefix = faultcodeString.substring(0, prefixIndex);
        if (this.faultCodeElement == null)
            findFaultCodeElement();
        String nsName = this.faultCodeElement.getNamespaceURI(prefix);
        return NameImpl.createFromQualifiedName(faultcodeString, nsName);
    }
项目:infobip-open-jdk-8    文件:NameImpl.java   
public boolean equals(Object obj) {
    if (!(obj instanceof Name)) {
        return false;
    }

    Name otherName = (Name) obj;

    if (!uri.equals(otherName.getURI())) {
        return false;
    }

    if (!localName.equals(otherName.getLocalName())) {
        return false;
    }

    return true;
}
项目:wso2-axis2    文件:SOAPFaultTest.java   
@Validated @Test
public void testSetGetFaultCodeAsQName2() throws Exception {
    QName name = SOAPConstants.SOAP_SENDER_FAULT;
    SOAPFactory fac = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
    SOAPFault sf = fac.createFault();
    sf.setFaultCode(name);

    QName name2 = sf.getFaultCodeAsQName();
    assertNotNull(name2);
    assertEquals(name.getLocalPart(), name2.getLocalPart());
    assertEquals(name.getPrefix(), name2.getPrefix());
    assertEquals(name.getNamespaceURI(), name2.getNamespaceURI());

    Name name3 = sf.getFaultCodeAsName();
    assertNotNull(name3);
    assertEquals(name.getLocalPart(), name3.getLocalName());
    assertEquals(name.getPrefix(), name3.getPrefix());
    assertEquals(name.getNamespaceURI(), name3.getURI());
}
项目:wso2-axis2    文件:SOAPFaultTest.java   
@Validated @Test
public void testSetGetFaultCodeAsName2() throws Exception {
    QName qname = SOAPConstants.SOAP_SENDER_FAULT;
    SOAPFactory fac = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
    Name name = fac.createName(qname.getLocalPart(),
                               qname.getPrefix(), qname.getNamespaceURI());
    SOAPFault sf = fac.createFault();
    sf.setFaultCode(name);

    Name name2 = sf.getFaultCodeAsName();            
    assertNotNull(name2);
    assertEquals(name.getLocalName(), name2.getLocalName());
    assertEquals(name.getPrefix(), name2.getPrefix());
    assertEquals(name.getURI(), name2.getURI());

    QName name3 = sf.getFaultCodeAsQName();            
    assertNotNull(name3);
    assertEquals(name.getLocalName(), name3.getLocalPart());
    assertEquals(name.getPrefix(), name3.getPrefix());
    assertEquals(name.getURI(), name3.getNamespaceURI());
}
项目:wso2-axis2    文件:SOAPElementTest.java   
@Validated @Test
public void testRemoveAttributeName() throws Exception {
    SOAPMessage msg = MessageFactory.newInstance().createMessage();
    SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
    SOAPBody body = envelope.getBody();

    Name name = envelope.createName("MyAttr1");
    String value = "MyValue1";
    body.addAttribute(name, value);
    boolean b = body.removeAttribute(name);
    assertTrue(b);

    b = body.removeAttribute(name);
    assertTrue(!b);

    String s = body.getAttributeValue(name);
    assertNull(s);
}
项目:juddi-scout    文件:SaajTransport.java   
private SOAPMessage createSOAPMessage(Element elem) throws Exception {
    String prefix = "";
    MessageFactory msgFactory = MessageFactory.newInstance();
    SOAPFactory factory = SOAPFactory.newInstance();

    SOAPMessage message = msgFactory.createMessage();
    message.getSOAPHeader().detachNode();
    SOAPPart soapPart = message.getSOAPPart();
    SOAPBody soapBody = soapPart.getEnvelope().getBody();
    //Create the outer body element
    Name bodyName = factory.createName(elem.getNodeName(), prefix, UDDI_V2_NAMESPACE);
    SOAPBodyElement bodyElement = soapBody.addBodyElement(bodyName);
    bodyElement.addNamespaceDeclaration(prefix, UDDI_V2_NAMESPACE);
    appendAttributes(bodyElement, elem.getAttributes(), factory);
    appendElements(bodyElement, elem.getChildNodes(), factory);
    return message;
}
项目:ireport-fork    文件:OLAPQueryExecuter.java   
protected void addParameterList(SOAPEnvelope envelope, SOAPElement eParent, String typeName, String listName, Map params) throws SOAPException
{
    Name nPara = envelope.createName(typeName, "", XMLA_URI);
    SOAPElement eType = eParent.addChildElement(nPara);
    nPara = envelope.createName(listName, "", XMLA_URI);
    SOAPElement eList = eType.addChildElement(nPara);
    if (params == null)
        return;

    Iterator it = params.keySet().iterator();
    while (it.hasNext())
    {
        String tag = (String) it.next();
        String value = (String) params.get(tag);
        nPara = envelope.createName(tag, "", XMLA_URI);
        SOAPElement eTag = eList.addChildElement(nPara);
        eTag.addTextNode(value);
    }
}
项目:wso2-axis2    文件:SOAPFaultTest.java   
@Validated @Test
public void testSetGetFaultCodeAsQName1() throws Exception {
    SOAPFactory fac = SOAPFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
    SOAPFault sf = fac.createFault();

    QName name = new QName("http://example.com", "myfault", "flt");
    sf.setFaultCode(name);

    QName name2 = sf.getFaultCodeAsQName();
    assertNotNull(name2);
    assertEquals(name.getLocalPart(), name2.getLocalPart());
    assertEquals(name.getPrefix(), name2.getPrefix());
    assertEquals(name.getNamespaceURI(), name2.getNamespaceURI());

    Name name3 = sf.getFaultCodeAsName();
    assertNotNull(name3);
    assertEquals(name.getLocalPart(), name3.getLocalName());
    assertEquals(name.getPrefix(), name3.getPrefix());
    assertEquals(name.getNamespaceURI(), name3.getURI());
}
项目:OLD-OpenJDK8    文件:NameImpl.java   
public boolean equals(Object obj) {
    if (!(obj instanceof Name)) {
        return false;
    }

    Name otherName = (Name) obj;

    if (!uri.equals(otherName.getURI())) {
        return false;
    }

    if (!localName.equals(otherName.getLocalName())) {
        return false;
    }

    return true;
}
项目:wso2-axis2    文件:SOAPElementTest.java   
@Validated @Test
public void testGetChildElements2() throws Exception {
    MessageFactory fact = MessageFactory.newInstance();
    SOAPMessage message = fact.createMessage();
    SOAPPart soapPart = message.getSOAPPart();
    SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
    SOAPBody soapBody = soapEnvelope.getBody();

    Name name = soapEnvelope.createName("MyChild1");
    SOAPElement se = soapBody.addChildElement(name);
    Iterator childElementsCount = soapBody.getChildElements();
    Iterator childElements = soapBody.getChildElements();

    int childCount = 0;
    while (childElementsCount.hasNext()) {
        Node node = (Node)childElementsCount.next();
        childCount++;
    }
    assertEquals(childCount, 1);
    SOAPElement se2 = (SOAPElement)childElements.next();
    if (!se.equals(se2)) {
        fail();
    } else {
        System.out.println("SOAPElement se = se2 (expected)");
    }

    Name n = se.getElementName();
    assertEquals(n, name);
}
项目:openacs    文件:X_00000C_ShowStatusResponse.java   
@Override
protected void parseBody(SOAPBodyElement body, SOAPFactory spf) throws SOAPException {
    Iterator pi = getRequestChildElement(spf, body, "ExecResponseList").getChildElements(spf.createName("ExecResponseStruct"));
    Name nameKey = spf.createName("Command");
    Name nameValue = spf.createName("Response");
    while (pi.hasNext()) {
        SOAPElement param = (SOAPElement) pi.next();
        String key = getRequestElement(param, nameKey);
        String value = getRequestElement(param, nameValue);
        if (value == null) {
            value = "";
        }
        System.out.append(key + "->" + value);
        response.put(key, value);
    }
}
项目:wso2-axis2    文件:SOAPHeaderTest.java   
@Validated @Test
public void testAddUpgradeHeaderElement() throws Exception {
    javax.xml.soap.SOAPMessage soapMessage =
            javax.xml.soap.MessageFactory.newInstance(
                    SOAPConstants.SOAP_1_2_PROTOCOL).createMessage();

    javax.xml.soap.SOAPEnvelope soapEnv =
            soapMessage.getSOAPPart().getEnvelope();
    javax.xml.soap.SOAPHeader header = soapEnv.getHeader();

    // create a list of supported URIs.
    ArrayList supported = new ArrayList();
    supported.add(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE);
    supported.add(SOAPConstants.URI_NS_SOAP_ENVELOPE);

    SOAPElement soapElement = header.addUpgradeHeaderElement(supported.iterator());
    assertNotNull(soapElement);
    Name name = soapElement.getElementName();
    String uri = name.getURI();
    String localName = name.getLocalName();

    //Validate the URI which must be SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE);
    assertTrue(uri.equals(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE));
    assertTrue(localName.equals("Upgrade"));
}