我安装了Axis2/Java(1.6.2)作为Tomcat(8.0.5)Webapp.
我开发了两个服务(HelloWorld和简单的计算器),它们工作正常.
现在,我尝试使用一种从外部XML读取信息的方法来开发服务.
该文件位于以下目录中:"$ CATALINA_HOME/webapps/axis2/myService /".
我使用Ant编译.aar存档.
当我通过url调用此方法时
http://127.0.0.1:8080/axis2/services/InventoryCheck/doCheck?args0=12&args1=9
Run Code Online (Sandbox Code Playgroud)
我收到:
<soapenv:Reason xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Text xml:lang="en-US">URI cannot be null</soapenv:Text>
</soapenv:Reason>
Run Code Online (Sandbox Code Playgroud)
我尝试与Tomcat 7相同的服务,它工作正常.
我怎么解决?
谢谢
这是服务java类:
public class InventoryCheckService {
private String path = "myService/products.xml";
public boolean doCheck(String sku, int quantity){
MessageContext msgContext = MessageContext.getCurrentMessageContext();
ServletContext servletContext = (ServletContext) msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT);
String realPath = servletContext.getRealPath(path);
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
Document doc = null;
try {
DocumentBuilder builder = factory.newDocumentBuilder();
doc = builder.parse(realPath);
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace(); …Run Code Online (Sandbox Code Playgroud)