当前位置: 首页>>代码示例>>Java>>正文


Java SOAPMessage.getSOAPBody方法代码示例

本文整理汇总了Java中javax.xml.soap.SOAPMessage.getSOAPBody方法的典型用法代码示例。如果您正苦于以下问题:Java SOAPMessage.getSOAPBody方法的具体用法?Java SOAPMessage.getSOAPBody怎么用?Java SOAPMessage.getSOAPBody使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.xml.soap.SOAPMessage的用法示例。


在下文中一共展示了SOAPMessage.getSOAPBody方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseSoapResponseForUrls

import javax.xml.soap.SOAPMessage; //导入方法依赖的package包/类
private void parseSoapResponseForUrls(byte[] data) {
//			System.out.println(new String(data));
			try {
				MessageFactory factory= MessageFactory.newInstance(WS_DISCOVERY_SOAP_VERSION);
				final MimeHeaders headers = new MimeHeaders();
//				headers.addHeader("Content-type", WS_DISCOVERY_CONTENT_TYPE);
				SOAPMessage message = factory.createMessage(headers, new ByteArrayInputStream(data));
				SOAPPart part=message.getSOAPPart();
				SOAPEnvelope env=part.getEnvelope();
				SOAPBody body=message.getSOAPBody();
				NodeList list=body.getElementsByTagNameNS("http://schemas.xmlsoap.org/ws/2005/04/discovery", "XAddrs");
				int items=list.getLength();
				if(items<1)return;
				for (int i = 0; i < items; i++) {
					Node n=list.item(i);
					String raw=n.getTextContent();
					//may contain several
					String []addrArray=raw.split(" ");
					for (String string : addrArray) {
						URL url=new URL(string);
						discovered.add(url);						
					}
				}
			} catch (Exception e) {
				System.out.println("Parse failed");
				e.printStackTrace();
			}

		}
 
开发者ID:D2Edev,项目名称:onvifjava,代码行数:30,代码来源:CameraDiscovery.java

示例2: xmlStrToSOAPElement

import javax.xml.soap.SOAPMessage; //导入方法依赖的package包/类
/**
 * Converts the given XML string to SOAPElement.
 *
 * @param xml XML string
 * @return given XML string as a SOAPElement or null if the conversion
 * failed
 */
public static SOAPElement xmlStrToSOAPElement(String xml) {
    LOGGER.debug("Convert XML string to SOAPElement. XML : \"{}\"", xml);
    // Try to conver XML string to XML Document
    Document doc = SOAPHelper.xmlStrToDoc(xml);
    if (doc == null) {
        LOGGER.warn("Convertin XML string to SOAP element failed.");
        return null;
    }

    try {
        // Use SAAJ to convert Document to SOAPElement
        // Create SoapMessage
        SOAPMessage message = createSOAPMessage();
        SOAPBody soapBody = message.getSOAPBody();
        // This returns the SOAPBodyElement
        // that contains ONLY the Payload
        SOAPElement payload = soapBody.addDocument(doc);
        if (payload == null) {
            LOGGER.warn("Converting XML string to SOAPElement failed.");
        } else {
            LOGGER.debug("Converting XML string to SOAPElement succeeded.");
        }
        return payload;
    } catch (Exception e) {
        LOGGER.error(e.getMessage(), e);
        LOGGER.warn("Converting XML document to SOAPElement failed.");
        return null;
    }
}
 
开发者ID:vrk-kpa,项目名称:xrd4j,代码行数:37,代码来源:SOAPHelper.java

示例3: getFaultActionFromSEIModel

import javax.xml.soap.SOAPMessage; //导入方法依赖的package包/类
String getFaultActionFromSEIModel(Packet requestPacket, Packet responsePacket) {
    String action = null;
    if (seiModel == null || wsdlPort == null) {
        return action;
    }

    try {
        SOAPMessage sm = responsePacket.getMessage().copy().readAsSOAPMessage();
        if (sm == null) {
            return action;
        }

        if (sm.getSOAPBody() == null) {
            return action;
        }

        if (sm.getSOAPBody().getFault() == null) {
            return action;
        }

        Detail detail = sm.getSOAPBody().getFault().getDetail();
        if (detail == null) {
            return action;
        }

        String ns = detail.getFirstChild().getNamespaceURI();
        String name = detail.getFirstChild().getLocalName();

        WSDLOperationMapping wsdlOp = requestPacket.getWSDLOperationMapping();
        JavaMethodImpl jm = (wsdlOp != null) ? (JavaMethodImpl)wsdlOp.getJavaMethod() : null;
        if (jm != null) {
          for (CheckedExceptionImpl ce : jm.getCheckedExceptions()) {
              if (ce.getDetailType().tagName.getLocalPart().equals(name) &&
                      ce.getDetailType().tagName.getNamespaceURI().equals(ns)) {
                  return ce.getFaultAction();
              }
          }
        }
        return action;
    } catch (SOAPException e) {
        throw new WebServiceException(e);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:44,代码来源:WsaTubeHelper.java

示例4: getFaultAction

import javax.xml.soap.SOAPMessage; //导入方法依赖的package包/类
String getFaultAction(@Nullable WSDLBoundOperation wbo, Packet responsePacket) {
    String action = AddressingUtils.getAction(responsePacket.getMessage().getHeaders(), addVer, soapVer);
    if (action != null) {
        return action;
    }

    action = addVer.getDefaultFaultAction();
    if (wbo == null) {
        return action;
    }

    try {
        SOAPMessage sm = responsePacket.getMessage().copy().readAsSOAPMessage();
        if (sm == null) {
            return action;
        }

        if (sm.getSOAPBody() == null) {
            return action;
        }

        if (sm.getSOAPBody().getFault() == null) {
            return action;
        }

        Detail detail = sm.getSOAPBody().getFault().getDetail();
        if (detail == null) {
            return action;
        }

        String ns = detail.getFirstChild().getNamespaceURI();
        String name = detail.getFirstChild().getLocalName();

        WSDLOperation o = wbo.getOperation();

        WSDLFault fault = o.getFault(new QName(ns, name));
        if (fault == null) {
            return action;
        }

        action = fault.getAction();

        return action;
    } catch (SOAPException e) {
        throw new WebServiceException(e);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:48,代码来源:WsaTubeHelper.java


注:本文中的javax.xml.soap.SOAPMessage.getSOAPBody方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。