本文整理汇总了Java中javax.xml.soap.SOAPFactory类的典型用法代码示例。如果您正苦于以下问题:Java SOAPFactory类的具体用法?Java SOAPFactory怎么用?Java SOAPFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SOAPFactory类属于javax.xml.soap包,在下文中一共展示了SOAPFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newSOAPFactory
import javax.xml.soap.SOAPFactory; //导入依赖的package包/类
protected SOAPFactory newSOAPFactory(String protocol)
throws SOAPException {
if (SOAPConstants.SOAP_1_1_PROTOCOL.equals(protocol)) {
return new com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl();
} else if (SOAPConstants.SOAP_1_2_PROTOCOL.equals(protocol)) {
return new com.sun.xml.internal.messaging.saaj.soap.ver1_2.SOAPFactory1_2Impl();
} else if (SOAPConstants.DYNAMIC_SOAP_PROTOCOL.equals(protocol)) {
return new com.sun.xml.internal.messaging.saaj.soap.dynamic.SOAPFactoryDynamicImpl();
} else {
log.log(
Level.SEVERE,
"SAAJ0569.soap.unknown.protocol",
new Object[] {protocol, "SOAPFactory"});
throw new SOAPException("Unknown Protocol: " + protocol +
" specified for creating SOAPFactory");
}
}
示例2: newSOAPFactory
import javax.xml.soap.SOAPFactory; //导入依赖的package包/类
@Override
protected SOAPFactory newSOAPFactory(String protocol)
throws SOAPException {
if (SOAPConstants.SOAP_1_1_PROTOCOL.equals(protocol)) {
return new com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl();
} else if (SOAPConstants.SOAP_1_2_PROTOCOL.equals(protocol)) {
return new com.sun.xml.internal.messaging.saaj.soap.ver1_2.SOAPFactory1_2Impl();
} else if (SOAPConstants.DYNAMIC_SOAP_PROTOCOL.equals(protocol)) {
return new com.sun.xml.internal.messaging.saaj.soap.dynamic.SOAPFactoryDynamicImpl();
} else {
log.log(
Level.SEVERE,
"SAAJ0569.soap.unknown.protocol",
new Object[] {protocol, "SOAPFactory"});
throw new SOAPException("Unknown Protocol: " + protocol +
" specified for creating SOAPFactory");
}
}
示例3: getSOAPElement
import javax.xml.soap.SOAPFactory; //导入依赖的package包/类
/**
* Get a SOAP document fragment representing this object.
*
* @return A SOAPElement representing this object.
* @throws SOAPException
* If an error occurred when trying to construct this element.
*/
public SOAPElement getSOAPElement() throws SOAPException {
// Create the parent node
SOAPElement answer = SOAPFactory.newInstance()
.createElement("SetPatientImmediate3")
.addAttribute(new QName("xmlns"), "http://www.zoommed.com/");
// Add all the data we need
answer.addChildElement(this.transaction.getSOAPElement());
answer.addChildElement(this.patient.getSOAPElement());
answer.addChildElement("username").addTextNode(this.username);
answer.addChildElement("password").addTextNode(this.password);
answer.addChildElement("localeId").addTextNode(this.localeId);
answer.addChildElement("clientNumber").addTextNode(this.clientNumber);
answer.addChildElement("isTraining").addTextNode(
this.isTraining ? "1" : "0");
// Return the finished body
return answer;
}
示例4: getSOAPElement
import javax.xml.soap.SOAPFactory; //导入依赖的package包/类
/**
* Get a SOAP document fragment representing this object.
*
* @return A SOAPElement representing this transaction.
* @throws SOAPException
* If an error occurred when trying to construct the element.
*/
public SOAPElement getSOAPElement() throws SOAPException {
SOAPElement answer = SOAPFactory.newInstance().createElement(
"transaction");
String transId = "";
if (this.transactionId >= Integer.MAX_VALUE) {
//bit shift to get the right most 32 bit values
transId = Integer.toString((int) (this.transactionId << 32));
}
else {
transId = Integer.toString((int) this.transactionId);
}
answer.addChildElement("TransactionId").addTextNode(transId);
answer.addChildElement("Engine").addTextNode(this.engine);
answer.addChildElement("Sender").addTextNode(this.sender);
answer.addChildElement("Version").addTextNode(this.version);
answer.addChildElement("PMISLastUpdate").addTextNode(
Transaction3.formatDateTime(this.pmisLastUpdate));
return answer;
}
示例5: createElement
import javax.xml.soap.SOAPFactory; //导入依赖的package包/类
/**
* Create a SOAP Element with the specified parameters.<p>
*
* @param tagName the name of XML tag.
* @param tagValue the value of XML tag.
* @param nsPrefix the namespace prefix.
* @param nsURI the namespace URL.
*
* @return the new SOAP element created.
*/
public static SOAPElement createElement(String tagName
,String tagValue
,String nsPrefix
,String nsURI) throws SOAPException {
// Create a new SOAP Element according to tagname, prefix, uri
// and the text value.
SOAPElement soapElement = null;
if (nsURI != null)
soapElement = SOAPFactory.newInstance().createElement(tagName, nsPrefix, nsURI);
else
soapElement = SOAPFactory.newInstance().createElement(tagName);
if (tagValue == null)
tagValue = "";
soapElement.addTextNode(tagValue);
return soapElement;
}
示例6: invoke
import javax.xml.soap.SOAPFactory; //导入依赖的package包/类
@Override
public DOMSource invoke(DOMSource request) {
try {
return invokeAllowingFaults(request);
} catch (FaultMessage faultMessage) {
try {
SOAPFactory factory = SOAPFactory.newInstance();
SOAPFault soapFault = factory.createFault();
soapFault.setFaultCode(SOAP11_FAULTCODE_SERVER); // todo here is a constant until we have a mechanism to determine the correct value (client / server)
soapFault.setFaultString(faultMessage.getMessage());
Detail detail = soapFault.addDetail();
serializeFaultMessage(detail, faultMessage);
// fault actor?
// stack trace of the outer exception (FaultMessage) is unimportant, because it is always created at one place
// todo consider providing stack trace of the inner exception
//Detail detail = soapFault.addDetail();
//detail.setTextContent(getStackTraceAsString(faultMessage));
throw new SOAPFaultException(soapFault);
} catch (SOAPException e) {
throw new RuntimeException("SOAP Exception: " + e.getMessage(), e);
}
}
}
示例7: createBody
import javax.xml.soap.SOAPFactory; //导入依赖的package包/类
protected void createBody(SOAPBodyElement body, SOAPFactory spf) throws SOAPException {
SOAPElement elm = body.addChildElement(spf.createName("ParameterList"));
elm.setAttribute(SOAP_ARRAY_TYPE, "cwmp:SetParameterAttributesStruct[" + String.valueOf(attrs.size()) + "]");
int c = attrs.size();
for (int i = 0; i < c; i++) {
SOAPElement param = elm.addChildElement("SetParameterAttributesStruct");
param.addChildElement("Name").setValue(attrs.get(i).Name);
param.addChildElement("NotificationChange").setValue(b2s(attrs.get(i).NotificationChange));
param.addChildElement("Notification").setValue(String.valueOf(attrs.get(i).Notification));
param.addChildElement("AccessListChange").setValue(b2s(attrs.get(i).AccessListChange));
SOAPElement al = param.addChildElement(spf.createName("AccessList"));
String acl[] = attrs.get(i).AccessList;
int ca = acl.length;
al.setAttribute(SOAP_ARRAY_TYPE, "xsd:string[" + String.valueOf(ca) + "]");
for (int i2 = 0; i2 < ca; i2++) {
SOAPElement acle = al.addChildElement("string");
acle.setValue(acl[i2]);
acle.setAttribute(XSI_TYPE, XSD_STRING);
}
}
}
示例8: parseBody
import javax.xml.soap.SOAPFactory; //导入依赖的package包/类
@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);
}
}
示例9: initialValue
import javax.xml.soap.SOAPFactory; //导入依赖的package包/类
@Override
protected SOAPFactory initialValue() {
try {
return SOAPFactory.newInstance();
} catch (SOAPException e) {
e.printStackTrace();
return null;
}
}
示例10: createInvalidAddressingHeaderFault
import javax.xml.soap.SOAPFactory; //导入依赖的package包/类
public SOAPFault createInvalidAddressingHeaderFault(InvalidAddressingHeaderException e, AddressingVersion av) {
QName name = e.getProblemHeader();
QName subsubcode = e.getSubsubcode();
QName subcode = av.invalidMapTag;
String faultstring = String.format(av.getInvalidMapText(), name, subsubcode);
try {
SOAPFactory factory;
SOAPFault fault;
if (soapVer == SOAPVersion.SOAP_12) {
factory = SOAPVersion.SOAP_12.getSOAPFactory();
fault = factory.createFault();
fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
fault.appendFaultSubcode(subcode);
fault.appendFaultSubcode(subsubcode);
getInvalidMapDetail(name, fault.addDetail());
} else {
factory = SOAPVersion.SOAP_11.getSOAPFactory();
fault = factory.createFault();
fault.setFaultCode(subsubcode);
}
fault.setFaultString(faultstring);
return fault;
} catch (SOAPException se) {
throw new WebServiceException(se);
}
}
示例11: newMapRequiredFault
import javax.xml.soap.SOAPFactory; //导入依赖的package包/类
public SOAPFault newMapRequiredFault(MissingAddressingHeaderException e) {
QName subcode = addVer.mapRequiredTag;
QName subsubcode = addVer.mapRequiredTag;
String faultstring = addVer.getMapRequiredText();
try {
SOAPFactory factory;
SOAPFault fault;
if (soapVer == SOAPVersion.SOAP_12) {
factory = SOAPVersion.SOAP_12.getSOAPFactory();
fault = factory.createFault();
fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
fault.appendFaultSubcode(subcode);
fault.appendFaultSubcode(subsubcode);
getMapRequiredDetail(e.getMissingHeaderQName(), fault.addDetail());
} else {
factory = SOAPVersion.SOAP_11.getSOAPFactory();
fault = factory.createFault();
fault.setFaultCode(subsubcode);
}
fault.setFaultString(faultstring);
return fault;
} catch (SOAPException se) {
throw new WebServiceException(se);
}
}
示例12: listenerCreated
import javax.xml.soap.SOAPFactory; //导入依赖的package包/类
/**
* Creates a new instance of MessageFactory.
*
* @throws RequestListenerException if unable to create MessageFactory.
* @see hk.hku.cecid.piazza.commons.servlet.RequestListener#listenerCreated()
*/
public void listenerCreated() throws RequestListenerException {
try {
msgFactory = MessageFactory.newInstance();
soapFactory = SOAPFactory.newInstance();
}
catch (Exception e) {
throw new RequestListenerException(
"Unable to create SOAP factories", e);
}
}
示例13: parseBody
import javax.xml.soap.SOAPFactory; //导入依赖的package包/类
@Override
protected void parseBody(SOAPBodyElement body, SOAPFactory spf) throws SOAPException {
SOAPElement ml = getRequestChildElement(spf, body, "MethodList");
int i = getArrayCount(spf, ml);
// Iterator mlist = ml.getChildElements(spf.createName("string"));
Iterator mlist = ml.getChildElements();
//methods = new String [i];
ArrayList<String> m = new ArrayList<String>();
i = 0;
while (mlist.hasNext()) {
Object e = mlist.next();
if (e instanceof SOAPElement) {
SOAPElement el = (SOAPElement) e;
if (el.getElementQName().getLocalPart().equals("string")) {
// methods[i++] = el.getValue();
m.add(el.getValue());
}
}
}
methods = m.toArray(new String[1]);
/*
mlist = ml.getChildElements(type.getType(body,spf));
while (mlist.hasNext()) {
methods[i++] = ((SOAPElement)mlist.next()).getValue();
}
*/
}
示例14: createBody
import javax.xml.soap.SOAPFactory; //导入依赖的package包/类
protected void createBody(SOAPBodyElement body, SOAPFactory spf) throws SOAPException {
body.addChildElement(COMMAND_KEY).setValue(CommandKey);
body.addChildElement("FileType").setValue(FileType);
body.addChildElement("URL").setValue(url);
body.addChildElement("Username").setValue(UserName);
body.addChildElement("Password").setValue(Password);
body.addChildElement("FileSize").setValue(String.valueOf(FileSize));
body.addChildElement("TargetFileName").setValue(TargetFileName);
body.addChildElement("DelaySeconds").setValue(String.valueOf(DelaySeconds));
body.addChildElement("SuccessURL").setValue(SuccessUrl);
body.addChildElement("FailureURL").setValue(FailureUrl);
}
示例15: createBody
import javax.xml.soap.SOAPFactory; //导入依赖的package包/类
protected void createBody(SOAPBodyElement body, SOAPFactory spf) throws SOAPException {
body.addChildElement(COMMAND_KEY).setValue(CommandKey);
body.addChildElement("FileType").setValue(FileType);
body.addChildElement("URL").setValue(URL);
body.addChildElement("Username").setValue(Username);
body.addChildElement("Password").setValue(Password);
body.addChildElement("DelaySeconds").setValue(String.valueOf(DelaySeconds));
}