wunaigang 2004年12月23日
大伙帮我看个错误呢?在线等,十万火急
直接从网上下的处理附件的ws服务器端,调试通过但
http://localhost:8080/UniformInterface/services/DataHead?wsdl 时出错
wsdd节点内容
<service name="DataHead" provider="java:RPC">
<!-- 服务类名 -->
<parameter name="className" value="com.sisytech.sdc.uf.GetImageByAttachment"/>
<!-- 允许访问所有方法 -->
<parameter name="allowedMethods" value="*"/>
</service>
/*
* Created on 2004-12-22
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package com.sisytech.sdc.uf;

/**
* @author Administrator
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
//import org.apache.soap.util.mime.*;
import java.net.*;
import java.util.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.xml.soap.*;
import javax.activation.DataHandler;
import javax.xml.messaging.*;
import javax.xml.transform.stream.StreamSource;

public class GetImageByAttachment extends JAXMServlet implements ReqRespListener{
public SOAPMessage onMessage(SOAPMessage message){
try {
message.writeTo(System.out);
//以下部分创建SOAP消息
SOAPConnectionFactory soapConnectionFactory = javax.xml.soap.SOAPConnectionFactory.newInstance();
SOAPConnection soapConnection = soapConnectionFactory.createConnection();

MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage soapMessage = messageFactory.createMessage();
SOAPPart soapPart = soapMessage.getSOAPPart();
SOAPEnvelope requestEnvelope = soapPart.getEnvelope();
SOAPBody body = requestEnvelope.getBody();
SOAPBodyElement operation = body.addBodyElement(requestEnvelope.createName("image"));
//创建附件
URL url = new URL("http://localhost:8080/axis/test.jpg");//图像文件的储存的位置
DataHandler dh = new DataHandler(url);
AttachmentPart attachment2 = message.createAttachmentPart(dh);
attachment2.setContentId("myImage");//使用JAF来创建SOAP mime附件

soapMessage.addAttachmentPart(attachment2);
soapMessage.writeTo(System.out);
soapMessage.saveChanges();
return soapMessage;
} catch(Exception ex) {
System.out.println(ex.getMessage());
ex.printStackTrace();
return null;
}
}

}


AXIS error
Sorry, something seems to have gone wrong... here are the details:

Fault - ; nested exception is:
WSDLException: faultCode=OTHER_ERROR: Can't find prefix for 'http://soap.xml.javax'. Namespace prefixes must be set on the Definition object using the addNamespace(...) method.:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: WSDLException: faultCode=OTHER_ERROR: Can't find prefix for 'http://soap.xml.javax'. Namespace prefixes must be set on the Definition object using the addNamespace(...) method.:
faultActor:
faultNode:
faultDetail:

...全文
108 点赞 收藏 6
写回复
6 条回复

还没有回复,快来抢沙发~

发动态
发帖子
Java EE
创建于2007-09-28

3.7w+

社区成员

22.5w+

社区内容

J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区公告
暂无公告