读书人

抛org.xml.sax.SAXNotRecognizedExcep

发布时间: 2014-01-26 14:37:02 作者: rapoo

代码:
String endpoint = "http://localhost/WebServiceTest/Service1.asmx ";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName(new QName( "http://tempuri.org/ ", "HelloWorld "));
call.setReturnType(XMLType.XSD_STRING);
String res = (String) call.invoke( new Object[] {} );
System.out.println( res );

异常:
Exception in thread "main " AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXNotRecognizedException: Feature: http://xml.org/sax/properties/lexical-handler
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace: org.xml.sax.SAXNotRecognizedException: Feature: http://xml.org/sax/properties/lexical-handler
at org.apache.xerces.jaxp.SAXParserImpl.setProperty(SAXParserImpl.java:155)
at org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:241)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:376)
at org.apache.axis.client.Call.invokeEngine(Call.java:2583)
at org.apache.axis.client.Call.invoke(Call.java:2553)
at org.apache.axis.client.Call.invoke(Call.java:2248)
at org.apache.axis.client.Call.invoke(Call.java:2171)
at org.apache.axis.client.Call.invoke(Call.java:1691)
at com.dawen.cooperate.TestClient.main(TestClient.java:25)


org.xml.sax.SAXNotRecognizedException: Feature: http://xml.org/sax/properties/lexical-handler
at org.apache.axis.AxisFault.makeFault(AxisFault.java:129)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:543)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:376)
at org.apache.axis.client.Call.invokeEngine(Call.java:2583)
at org.apache.axis.client.Call.invoke(Call.java:2553)
at org.apache.axis.client.Call.invoke(Call.java:2248)
at org.apache.axis.client.Call.invoke(Call.java:2171)
at org.apache.axis.client.Call.invoke(Call.java:1691)
at com.dawen.cooperate.TestClient.main(TestClient.java:25)
Caused by: org.xml.sax.SAXNotRecognizedException: Feature: http://xml.org/sax/properties/lexical-handler
at org.apache.xerces.jaxp.SAXParserImpl.setProperty(SAXParserImpl.java:155)
at org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:241)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)
... 7 more


------解决方法--------------------------------------------------------
import java.net.MalformedURLException;
import java.rmi.RemoteException;

import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceException;

你用这个看看。

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.ser.BeanDeserializerFactory;
import org.apache.axis.encoding.ser.BeanSerializerFactory;

public class AxisWSClient
{

private String endpoint;
private String qName;
private String operationName;


public AxisWSClient(String endpoint, String qName, String operationName)
{
this.endpoint = endpoint;
this.qName = qName;
this.operationName = operationName;
}

public Object getRemoteResult(Object[] inParam, Class outClazz) throws RemoteException         

读书人网 >Java Exception

热点推荐