JAX_WS:如何在 SOAP 消息上下文中获取服务器上的附件?
JAX_WS: How to get an attachment on server present in SOAP Message context?
我使用了下面的函数但出现错误:"loading constraint violation: loader "com/ibm/ws/classloader/CompoundClassLoader@72127212" previously initiated loading for a different type with name "org/w3c/dom/DOMConfiguration" defined by loader "com/ibm/oti/vm/BootstrapClassLoader@3d303d30""
import javax.xml.soap.SOAPMessage;
import org.apache.axis2.jaxws.core.MessageContext;
private void downloadAttachment() throws AddDocumentException,SOAPException
{
org.apache.axis2.context.MessageContext messagecontext = org.apache.axis2.context.MessageContext.getCurrentMessageContext();
log.info("1");
MessageContext mc=new MessageContext(messagecontext);
log.info("2");
SOAPMessage soapmessage = mc.getMessage().getAsSOAPMessage();
log.info("3");
log.info("SOAP header: "+soapmessage.getSOAPHeader());
log.info("4");
log.info("SOAP Body: "+soapmessage.getSOAPBody());
log.info("5");
log.info("SOAP Part:"+soapmessage.getSOAPPart());
log.info("6");
File fDumpFolder=new File(sDumpLoc);
if(!fDumpFolder.exists())
fDumpFolder.mkdir();
log.info("Count of attachments: "+soapmessage.countAttachments());
if(soapmessage.countAttachments()==0)
throw new AddDocumentException("-11011",pCodes.getString("-11011"),"");
else if(soapmessage.countAttachments()>1)
throw new AddDocumentException("-11012",pCodes.getString("-11012"),"");
else if(soapmessage.countAttachments()==1)
{
Iterator it = soapmessage.getAttachments();
AttachmentPart attachment=(AttachmentPart) it.next();
String sContentType=attachment.getContentType();
log.debug(attachment.getContentId()+", "+attachment.getContentType()+", "+attachment.getContentId());
}
}
它现在可以通过从 axis2
中删除 xmlbeans-2.3.0.jar 来工作
我使用了下面的函数但出现错误:"loading constraint violation: loader "com/ibm/ws/classloader/CompoundClassLoader@72127212" previously initiated loading for a different type with name "org/w3c/dom/DOMConfiguration" defined by loader "com/ibm/oti/vm/BootstrapClassLoader@3d303d30""
import javax.xml.soap.SOAPMessage;
import org.apache.axis2.jaxws.core.MessageContext;
private void downloadAttachment() throws AddDocumentException,SOAPException
{
org.apache.axis2.context.MessageContext messagecontext = org.apache.axis2.context.MessageContext.getCurrentMessageContext();
log.info("1");
MessageContext mc=new MessageContext(messagecontext);
log.info("2");
SOAPMessage soapmessage = mc.getMessage().getAsSOAPMessage();
log.info("3");
log.info("SOAP header: "+soapmessage.getSOAPHeader());
log.info("4");
log.info("SOAP Body: "+soapmessage.getSOAPBody());
log.info("5");
log.info("SOAP Part:"+soapmessage.getSOAPPart());
log.info("6");
File fDumpFolder=new File(sDumpLoc);
if(!fDumpFolder.exists())
fDumpFolder.mkdir();
log.info("Count of attachments: "+soapmessage.countAttachments());
if(soapmessage.countAttachments()==0)
throw new AddDocumentException("-11011",pCodes.getString("-11011"),"");
else if(soapmessage.countAttachments()>1)
throw new AddDocumentException("-11012",pCodes.getString("-11012"),"");
else if(soapmessage.countAttachments()==1)
{
Iterator it = soapmessage.getAttachments();
AttachmentPart attachment=(AttachmentPart) it.next();
String sContentType=attachment.getContentType();
log.debug(attachment.getContentId()+", "+attachment.getContentType()+", "+attachment.getContentId());
}
}
它现在可以通过从 axis2
中删除 xmlbeans-2.3.0.jar 来工作