这是我用来访问我得到 org.xml.sax.SAXParseException 的 web 服务的 Axis 客户端代码;行号:1;列号:1;序言中不能有内容。这是当我发送一个肥皂消息时,如果我发送带有 UTF-8 编码的 XML,我会得到一个套接字超时
两个异常都发生在调用
有没有办法我可以忽略 call.invoke 上的 BOM 标记,这似乎是个问题。
快速帮助将不胜感激..谢谢
公共类 WSTestClient { public static void main(String [] args) { try{
String acordXMLUrl = "C:\\request.xml";
File xmlFile = new File(acordXMLUrl);
InputStream in = new FileInputStream(xmlFile);
Reader reader = new InputStreamReader(in, "UTF-8");
int c;
StringBuffer sb = new StringBuffer();
while ((c = in.read()) != -1)
sb.append((char) c);
String acordXML = sb.toString();
Message msg = new Message(acordXMLUrl);
SOAPEnvelope se;
String endpoint ="https://somewebservice/getme";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTimeout(5000);
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName(new QName("http://soapactionurl","getme"));
System.out.println("Calling into webservice" );
String ret="";
try{
//ret = (String) call.invoke( new Object[] {acordXML} );
se = call.invoke( msg);
}
catch (RemoteException e) {
System.err.println(e.toString());
}
System.out.println("Return is:"+ ret);
}
catch (Exception e) {
System.err.println(e.toString());
}}}