读书人

WebService有关问题求!

发布时间: 2013-07-09 09:50:48 作者: rapoo

WebService问题,急求!!!


客户端代码:


package org.lee;

import org.ws.HelloWorldInterface;
import org.ws.impls.HelloWorldImpls;

public class ClientMain {

public static void main(String[] args) {

HelloWorldImpls factory=new HelloWorldImpls();
//此处返回的是 远程WebService的代理.
HelloWorldInterface helloWorldInterface= factory .getHelloWorldImplsPort();
System.out.println(helloWorldInterface.sayHi("夏煜正"));
}

}


所报的异常:

Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Cannot create a secure XMLInputFactory
at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:171)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:94)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:240)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:210)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:103)
at $Proxy29.sayHi(Unknown Source)
at org.lee.ClientMain.main(ClientMain.java:13)


Java WebService 异常 XMLInputFactory
[解决办法]
可以看下你生成的几个类吗?你可能是调用的时候出错了!
[解决办法]
楼主是跟着视频做,然后遇到这个问题的吗?用的是cxf2.7的版本?我也遇到了,不知道怎么解决啊
[解决办法]
+    private static boolean setRestrictionProperties(XMLInputFactory factory) {
+ //For now, we can only support Woodstox 4.2.x and newer as none of the other
+ //stax parsers support these settings
+ if (setProperty(factory, "com.ctc.wstx.maxAttributesPerElement", maxAttributeCount)
+ && setProperty(factory, "com.ctc.wstx.maxAttributeSize", maxAttributeSize)
+ && setProperty(factory, "com.ctc.wstx.maxChildrenPerElement", innerElementCountThreshold)
+ && setProperty(factory, "com.ctc.wstx.maxElementCount", maxElementCount)
+ && setProperty(factory, "com.ctc.wstx.maxElementDepth", innerElementLevelThreshold)
+ && setProperty(factory, "com.ctc.wstx.maxCharacters", maxXMLCharacters)


+ && setProperty(factory, "com.ctc.wstx.maxTextLength", maxTextLength))
{
+ return true;
+ }
+ return false;
+ }



只知道这个错和其内部设置限制属性有关,要求是Woodstox 4.2.x及其之后版本,不过目测楼主貌似也已经到达这个要求了
[解决办法]
少一个jar包,

读书人网 >J2EE开发

热点推荐