本文整理汇总了Java中javax.wsdl.extensions.soap.SOAPBody类的典型用法代码示例。如果您正苦于以下问题:Java SOAPBody类的具体用法?Java SOAPBody怎么用?Java SOAPBody使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SOAPBody类属于javax.wsdl.extensions.soap包,在下文中一共展示了SOAPBody类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSoapBody
import javax.wsdl.extensions.soap.SOAPBody; //导入依赖的package包/类
public void createSoapBody(org.apache.axiom.soap.SOAPBody sb, SOAPBody soapBody, Message msgDef,
Element message, String rpcWrapper) throws AxisFault {
OMElement partHolder = isRPC ? soapFactory
.createOMElement(new QName(soapBody.getNamespaceURI(), rpcWrapper, "odens"), sb) : sb;
List<Part> parts = msgDef.getOrderedParts(soapBody.getParts());
for (Part part : parts) {
Element srcPartEl = DOMUtils.findChildByName(message, new QName(null, part.getName()));
if (srcPartEl == null) {
throw new AxisFault("Missing required part in ODE Message");
}
OMElement omPart = OMUtils.toOM(srcPartEl, soapFactory);
if (isRPC) {
partHolder.addChild(omPart);
} else {
for (Iterator<OMNode> i = omPart.getChildren(); i.hasNext(); ) {
partHolder.addChild(i.next());
}
}
}
}
示例2: getOutputParts
import javax.wsdl.extensions.soap.SOAPBody; //导入依赖的package包/类
private List<Part> getOutputParts(String portName, String operationName) throws UnknownOperationException {
List<Part> parts = new ArrayList<Part>();
BindingOperation bindingOperation = getBindingOperation(portName, operationName);
Operation operation = bindingOperation.getOperation();
Output output = operation.getOutput();
if (output != null) {
Message outputMessage = output.getMessage();
List<ExtensibilityElement> extensibilityElements = bindingOperation.getBindingOutput().getExtensibilityElements();
for (ExtensibilityElement extensibilityElement : extensibilityElements) {
if (extensibilityElement instanceof SOAPBody) {
SOAPBody soapBody = (SOAPBody) extensibilityElement;
Collection<String> partNames = soapBody.getParts();
if (partNames == null) {
partNames = outputMessage.getParts().keySet();
}
for (String partName : partNames) {
Part part = outputMessage.getPart(partName);
parts.add(part);
}
}
}
}
return parts;
}
示例3: parseResponseFeedback
import javax.wsdl.extensions.soap.SOAPBody; //导入依赖的package包/类
public static String parseResponseFeedback(org.apache.axiom.soap.SOAPBody soapBody) throws FaultException {
/* Sample feedback response
* <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body><part><axis2ns3:correlation xmlns:axis2ns3="http://wso2.org/humantask/feedback">
<axis2ns3:taskid>10001</axis2ns3:taskid></axis2ns3:correlation></part></soapenv:Body></soapenv:Envelope>
* */
Iterator<OMElement> srcParts = soapBody.getChildElements();
if (srcParts.hasNext()) {
OMElement srcPart = srcParts.next();
if (!srcPart.getQName().equals(new QName(null, "part"))) {
throw new FaultException(BPEL4PeopleConstants.B4P_FAULT,
"Unexpected element in SOAP body: " + srcPart.toString());
}
OMElement hifb = srcPart.getFirstChildWithName(
new QName(BPEL4PeopleConstants.B4P_NAMESPACE,
BPEL4PeopleConstants.B4P_CORRELATION_HEADER));
if (hifb == null) {
throw new FaultException(BPEL4PeopleConstants.B4P_FAULT,
"Unexpected element in SOAP body: " + srcPart.toString());
}
OMElement taskIDele = hifb.getFirstChildWithName(
new QName(BPEL4PeopleConstants.B4P_NAMESPACE,
BPEL4PeopleConstants.B4P_CORRELATION_HEADER_ATTRIBUTE));
if (taskIDele == null) {
throw new FaultException(BPEL4PeopleConstants.B4P_FAULT,
"Unexpected element in SOAP body: " + srcPart.toString());
}
return taskIDele.getText();
// Document doc = DOMUtils.newDocument();
// Element destPart = doc.createElementNS(null, "part");
// destPart.appendChild(doc.importNode(OMUtils.toDOM(srcPart), true));
// message.setPart("part", destPart);
}
throw new FaultException(BPEL4PeopleConstants.B4P_FAULT,
"TaskID not found in the feedback message");
}
示例4: createSoapRequest
import javax.wsdl.extensions.soap.SOAPBody; //导入依赖的package包/类
public void createSoapRequest(MessageContext msgCtx, Element message, Operation op)
throws AxisFault {
if (op == null) {
throw new NullPointerException("Null operation");
}
// The message can be null if the input message has no part
if (op.getInput().getMessage().getParts().size() > 0 && message == null) {
throw new NullPointerException("Null message.");
}
if (msgCtx == null) {
throw new NullPointerException("Null msgCtx");
}
BindingOperation bop = binding.getBindingOperation(op.getName(), null, null);
if (bop == null) {
throw new OdeFault("BindingOperation not found.");
}
BindingInput bi = bop.getBindingInput();
if (bi == null) {
throw new OdeFault("BindingInput not found.");
}
SOAPEnvelope soapEnv = msgCtx.getEnvelope();
if (soapEnv == null) {
soapEnv = soapFactory.getDefaultEnvelope();
msgCtx.setEnvelope(soapEnv);
}
// createSoapHeaders(soapEnv, getSOAPHeaders(bi), op.getInput().getMessage(), message);
SOAPBody soapBody = getSOAPBody(bi);
if (soapBody != null) {
org.apache.axiom.soap.SOAPBody sb = soapEnv.getBody() == null ?
soapFactory.createSOAPBody(soapEnv) : soapEnv.getBody();
createSoapBody(sb, soapBody, op.getInput().getMessage(), message, op.getName());
}
}
示例5: populateSoapBody
import javax.wsdl.extensions.soap.SOAPBody; //导入依赖的package包/类
@Override
protected void populateSoapBody(SOAPBody soapBody) throws WSDLException {
if (use.equalsIgnoreCase(LITERAL)) {
soapBody.setUse(LITERAL);
} else {
soapBody.setUse(ENCODED);
List<String> encStyles = new ArrayList<String>(1);
encStyles.add(ENCODING);
soapBody.setEncodingStyles(encStyles);
}
}
示例6: getStyle
import javax.wsdl.extensions.soap.SOAPBody; //导入依赖的package包/类
private BindingStyle getStyle(Binding binding) throws OpenEJBException {
SOAPBinding soapBinding = getExtensibilityElement(SOAPBinding.class, binding.getExtensibilityElements());
String styleString = soapBinding.getStyle();
BindingInput bindingInput = ((BindingOperation) binding.getBindingOperations().get(0)).getBindingInput();
SOAPBody soapBody = getExtensibilityElement(SOAPBody.class, bindingInput.getExtensibilityElements());
String useString = soapBody.getUse();
BindingStyle bindingStyle = BindingStyle.getBindingStyle(styleString, useString);
return bindingStyle;
}
示例7: visit
import javax.wsdl.extensions.soap.SOAPBody; //导入依赖的package包/类
protected void visit(BindingInput bindingInput) {
SOAPBody body = getSOAPBody(bindingInput.getExtensibilityElements());
String encoding = body.getUse();
if (encoding == null || !encoding.equals("encoded")) {
context.addFailure(new ValidationFailure("The use attribute of the binding input operation must be 'encoded': " + bindingInput.getName()));
}
}
示例8: addOperationSOAPBinding
import javax.wsdl.extensions.soap.SOAPBody; //导入依赖的package包/类
private void addOperationSOAPBinding(Definition localDef, PortType portType, Operation wsdlOp, Binding bind) {
try {
// creating operation binding
BindingOperation bindOp = localDef.createBindingOperation();
bindOp.setName(wsdlOp.getName());
// adding soap extensibility elements
SOAPOperation soapOperation = (SOAPOperation) extensionRegistry.createExtension(BindingOperation.class, new QName(NameSpacesEnum.SOAP.getNameSpaceURI(), "operation"));
soapOperation.setStyle("document");
//NOTA-BENE: Come settare SOAPACTION? jolie usa SOAP1.1 o 1.2? COme usa la SoapAction?
soapOperation.setSoapActionURI(wsdlOp.getName());
bindOp.addExtensibilityElement(soapOperation);
bindOp.setOperation(wsdlOp);
// adding input
BindingInput bindingInput = localDef.createBindingInput();
SOAPBody body = (SOAPBody) extensionRegistry.createExtension(BindingInput.class, new QName(NameSpacesEnum.SOAP.getNameSpaceURI(), "body"));
body.setUse("literal");
bindingInput.addExtensibilityElement(body);
bindOp.setBindingInput(bindingInput);
// adding output
BindingOutput bindingOutput = localDef.createBindingOutput();
bindingOutput.addExtensibilityElement(body);
bindOp.setBindingOutput(bindingOutput);
// adding fault
if (!wsdlOp.getFaults().isEmpty()) {
Iterator it = wsdlOp.getFaults().entrySet().iterator();
while (it.hasNext()) {
BindingFault bindingFault = localDef.createBindingFault();
SOAPFault soapFault = (SOAPFault) extensionRegistry.createExtension(BindingFault.class, new QName(NameSpacesEnum.SOAP.getNameSpaceURI(), "fault"));
soapFault.setUse("literal");
String faultName = ((Entry) it.next()).getKey().toString();
bindingFault.setName(faultName);
soapFault.setName(faultName);
bindingFault.addExtensibilityElement(soapFault);
bindOp.addBindingFault(bindingFault);
}
}
bind.addBindingOperation(bindOp);
} catch (WSDLException ex) {
ex.printStackTrace();
}
}
示例9: getSOAPBody
import javax.wsdl.extensions.soap.SOAPBody; //导入依赖的package包/类
public static SOAPBody getSOAPBody(ElementExtensible ee) {
return getFirstExtensibilityElement(ee, SOAPBody.class);
}
示例10: getWSDLBindingOperation
import javax.wsdl.extensions.soap.SOAPBody; //导入依赖的package包/类
/**
* generates the soap11 binding operation for the soap 11 binding.
*
* @param definition
* @param wsdlOperation
* @param operation
* @return
* @throws SchemaGenerationException
*/
public BindingOperation getWSDLBindingOperation(Definition definition,
javax.wsdl.Operation wsdlOperation,
Operation operation)
throws SchemaGenerationException {
BindingOperation bindingOperation = definition.createBindingOperation();
bindingOperation.setName(operation.getName());
bindingOperation.setOperation(wsdlOperation);
BindingInput bindingInput = definition.createBindingInput();
bindingOperation.setBindingInput(bindingInput);
BindingOutput bindingOutput = definition.createBindingOutput();
bindingOperation.setBindingOutput(bindingOutput);
ExtensionRegistry extensionRegistry = null;
try {
extensionRegistry = WSDLFactory.newInstance().newPopulatedExtensionRegistry();
SOAPOperation soapOperation = (SOAPOperation) extensionRegistry.createExtension(
BindingOperation.class, new QName("http://schemas.xmlsoap.org/wsdl/soap/", "operation"));
soapOperation.setSoapActionURI("urn:" + operation.getName());
soapOperation.setStyle("document");
bindingOperation.addExtensibilityElement(soapOperation);
SOAPBody inputSoapBody = (SOAPBody) extensionRegistry.createExtension(
BindingInput.class, new QName("http://schemas.xmlsoap.org/wsdl/soap/", "body"));
inputSoapBody.setUse("literal");
bindingInput.addExtensibilityElement(inputSoapBody);
SOAPBody outputSoapBody = (SOAPBody) extensionRegistry.createExtension(
BindingOutput.class, new QName("http://schemas.xmlsoap.org/wsdl/soap/", "body"));
outputSoapBody.setUse("literal");
bindingOutput.addExtensibilityElement(outputSoapBody);
// adding fault messages
Class[] exceptionClasses = operation.getJavaMethod().getExceptionTypes();
BindingFault bindingFault;
String faultName;
for (int i = 0; i < exceptionClasses.length; i++) {
faultName = exceptionClasses[i].getName();
faultName = faultName.substring(faultName.lastIndexOf(".") + 1);
bindingFault = definition.createBindingFault();
bindingFault.setName("fault" + faultName);
bindingOperation.addBindingFault(bindingFault);
SOAPFault soapFault = (SOAPFault) extensionRegistry.createExtension(
BindingFault.class, new QName("http://schemas.xmlsoap.org/wsdl/soap/", "fault"));
soapFault.setUse("literal");
soapFault.setName("fault" + faultName);
bindingFault.addExtensibilityElement(soapFault);
}
} catch (WSDLException e) {
throw new SchemaGenerationException("Can not crete a wsdl factory");
}
return bindingOperation;
}
示例11: getNamespaceFromSOAPElement
import javax.wsdl.extensions.soap.SOAPBody; //导入依赖的package包/类
/**
* This method will loop through a list of extensibility elements looking for one
* of four objects: SOAPBody, SOAP12Body, SOAPHeader, SOAP12Header. If any of these
* objects are found the namespace URI from this object will be returned.
*/
public static String getNamespaceFromSOAPElement(List extElements) {
Iterator extIter = extElements.iterator();
while (extIter.hasNext()) {
Object extObj = extIter.next();
if (extObj instanceof SOAPBody) {
if (log.isDebugEnabled()) {
log.debug("Returning SOAPBody namespace: "
+ ((SOAPBody) extObj).getNamespaceURI());
}
return ((SOAPBody) extObj).getNamespaceURI();
} else if (extObj instanceof SOAP12Body) {
if (log.isDebugEnabled()) {
log.debug("Returning SOAP12Body namespace: "
+ ((SOAP12Body) extObj).getNamespaceURI());
}
return ((SOAP12Body) extObj).getNamespaceURI();
} else if (extObj instanceof SOAPHeader) {
if (log.isDebugEnabled()) {
log.debug("Returning SOAPHeader namespace: "
+ ((SOAPHeader) extObj).getNamespaceURI());
}
return ((SOAPHeader) extObj).getNamespaceURI();
} else if (extObj instanceof SOAP12Header) {
if (log.isDebugEnabled()) {
log.debug("Returning SOAP12Header namespace: "
+ ((SOAP12Header) extObj).getNamespaceURI());
}
return ((SOAP12Header) extObj).getNamespaceURI();
}
else if (extObj instanceof MIMEMultipartRelated) {
if (log.isDebugEnabled()) {
log.debug("Found a MIMEMultipartRelated element. Unwrapping to get SOAP binding.");
}
MIMEMultipartRelated mime = (MIMEMultipartRelated) extObj;
List mimeParts = mime.getMIMEParts();
Iterator itr = mimeParts.iterator();
while (itr.hasNext()) {
MIMEPart mimePart = (MIMEPart) itr.next();
List elements = mimePart.getExtensibilityElements();
String ns = getNamespaceFromSOAPElement(elements);
return ns;
}
}
}
return null;
}
示例12: processBindingForMIME
import javax.wsdl.extensions.soap.SOAPBody; //导入依赖的package包/类
/**
* This method will loop through the extensibility elements for a given BindingInput or
* BindingOutput element and determine if it has any MIMEMultipartRelated content. If it
* does it will build up the appropriate AttachmentDescription objects.
*/
private static void processBindingForMIME(List extensibilityElements,
OperationDescriptionImpl opDesc,
Operation operation,
boolean isRequest) {
Iterator extensibilityIter = extensibilityElements.iterator();
while (extensibilityIter.hasNext()) {
Object obj = extensibilityIter.next();
if (obj instanceof MIMEMultipartRelated) {
if (log.isDebugEnabled()) {
log.debug("Found a mime:multipartRelated extensiblity element.");
}
// Found mime information now process it and determine if we need to
// create an AttachmentDescription
MIMEMultipartRelated mime = (MIMEMultipartRelated) obj;
Iterator partIter = mime.getMIMEParts().iterator();
while (partIter.hasNext()) {
if (log.isDebugEnabled()) {
log.debug("Found a mime:part child element.");
}
MIMEPart mimePart = (MIMEPart) partIter.next();
Iterator mExtIter = mimePart.getExtensibilityElements().iterator();
// Process each mime part to determine if there is mime content
while (mExtIter.hasNext()) {
Object obj2 = mExtIter.next();
// For mime content we need to potentially create an AttachmentDescription
if (obj2 instanceof MIMEContent) {
MIMEContent mimeContent = (MIMEContent) obj2;
String part = mimeContent.getPart();
String type = mimeContent.getType();
// if we have not already processed this part for the operation
if (opDesc.getPartAttachmentDescription(part) == null) {
if (log.isDebugEnabled()) {
log.debug("Adding new AttachmentDescription for part: " + part
+ " on operation: " + opDesc.getOperationName());
}
AttachmentDescription attachmentDesc =
new AttachmentDescriptionImpl(AttachmentType.SWA,
new String[] { type });
opDesc.addPartAttachmentDescription(part, attachmentDesc);
} else {
if (log.isDebugEnabled()) {
log.debug("Already created AttachmentDescription for part: "
+ part + " of type: " + type);
}
}
}
else if (obj2 instanceof SOAPBody || obj2 instanceof SOAP12Body) {
if (log.isDebugEnabled()) {
log.debug("Found a body element with potential nested mime content");
}
// Flag whether there's a potential nested attachment.
if (isRequest) {
opDesc.setHasRequestSwaRefAttachments(true);
}
else {
opDesc.setHasResponseSwaRefAttachments(true);
}
}
}
}
}
}
}
示例13: buildOperation
import javax.wsdl.extensions.soap.SOAPBody; //导入依赖的package包/类
private OperationInfo buildOperation(OperationInfo operationInfo,
BindingOperation bindingOper) {
System.out.println("从一个BindingOperation对象(<wsdl:operation>)构建OperationInfo对象");
Operation oper = bindingOper.getOperation();
operationInfo.setTargetMethodName(oper.getName());
Vector operElems = findExtensibilityElement(bindingOper
.getExtensibilityElements(), "operation");
ExtensibilityElement operElem = (ExtensibilityElement) operElems
.elementAt(0);
if (operElem != null && operElem instanceof SOAPOperation) {
SOAPOperation soapOperation = (SOAPOperation) operElem;
operationInfo.setSoapActionURI(soapOperation.getSoapActionURI());
}
BindingInput bindingInput = bindingOper.getBindingInput();
BindingOutput bindingOutput = bindingOper.getBindingOutput();
Vector bodyElems = findExtensibilityElement(bindingInput
.getExtensibilityElements(), "body");
ExtensibilityElement bodyElem = (ExtensibilityElement) bodyElems
.elementAt(0);
if (bodyElem != null && bodyElem instanceof SOAPBody) {
SOAPBody soapBody = (SOAPBody) bodyElem;
List styles = soapBody.getEncodingStyles();
String encodingStyle = null;
if (styles != null) {
encodingStyle = styles.get(0).toString();
}
if (encodingStyle == null) {
encodingStyle = DEFAULT_SOAP_ENCODING_STYLE;
}
operationInfo.setEncodingStyle(encodingStyle.toString());
operationInfo.setTargetObjectURI(soapBody.getNamespaceURI());
}
Input inDef = oper.getInput();
System.out.println("开始转移到了<wsdl:portTyp>结点下的<wsdl:input>");
if (inDef != null) {
Message inMsg = inDef.getMessage();
if (inMsg != null) {
operationInfo.setInputMessageName(inMsg.getQName().getLocalPart());
//输入消息的参数构建
getParameterFromMessage(operationInfo, inMsg, 1);
System.out.println("***操作:"+operationInfo.getTargetMethodName()+"的所有输入参数已经构建完毕***");
System.out.println("");
operationInfo.setInmessage(inMsg);
}
}
Output outDef = oper.getOutput();
if (outDef != null) {
Message outMsg = outDef.getMessage();
if (outMsg != null) {
operationInfo.setOutputMessageName(outMsg.getQName()
.getLocalPart());
//输出消息的参数构建
getParameterFromMessage(operationInfo, outMsg, 2);
System.out.println("***操作:"+operationInfo.getTargetMethodName()+"的所有输出参数已经构建完毕***");
System.out.println("");
operationInfo.setOutmessage(outMsg);
}
}
return operationInfo;
}
示例14: HeavyweightOperationInfoBuilder
import javax.wsdl.extensions.soap.SOAPBody; //导入依赖的package包/类
public HeavyweightOperationInfoBuilder(BindingOperation bindingOperation, ServiceEndpointMethodMapping methodMapping, JavaWsdlMapping mapping, XmlSchemaInfo schemaInfo) throws OpenEJBException {
Operation operation = bindingOperation.getOperation();
this.operationName = operation.getName();
this.operationStyle = JaxRpcOperationInfo.OperationStyle.valueOf(operation.getStyle().toString());
this.outputMessage = operation.getOutput() == null ? null : operation.getOutput().getMessage();
this.inputMessage = operation.getInput().getMessage();
// faults
for (Object o : operation.getFaults().values()) {
faults.add((Fault) o);
}
this.mapping = mapping;
this.methodMapping = methodMapping;
this.schemaInfo = schemaInfo;
// index types - used to process build exception class constructor args
for (JavaXmlTypeMapping javaXmlTypeMapping : mapping.getJavaXmlTypeMapping()) {
String javaClassName = javaXmlTypeMapping.getJavaType();
if (javaXmlTypeMapping.getAnonymousTypeQname() != null) {
String anonymousTypeQName = javaXmlTypeMapping.getAnonymousTypeQname();
anonymousTypes.put(anonymousTypeQName, javaClassName);
} else if (javaXmlTypeMapping.getRootTypeQname() != null) {
QName qname = javaXmlTypeMapping.getRootTypeQname();
publicTypes.put(qname, javaClassName);
}
}
// BindingStyle
if (methodMapping.getWrappedElement() != null) {
bindingStyle = BindingStyle.DOCUMENT_LITERAL_WRAPPED;
} else {
BindingInput bindingInput = bindingOperation.getBindingInput();
SOAPOperation soapOperation = JaxRpcServiceInfoBuilder.getExtensibilityElement(SOAPOperation.class, bindingOperation.getExtensibilityElements());
String styleString = soapOperation.getStyle();
if (styleString == null) {
SOAPBinding soapBinding = JaxRpcServiceInfoBuilder.getExtensibilityElement(SOAPBinding.class, bindingInput.getExtensibilityElements());
styleString = soapBinding.getStyle();
}
SOAPBody soapBody = JaxRpcServiceInfoBuilder.getExtensibilityElement(SOAPBody.class, bindingInput.getExtensibilityElements());
String useString = soapBody.getUse();
bindingStyle = BindingStyle.getBindingStyle(styleString, useString);
}
}