org.xml.sax.SAXParseException; lineNumber:1; columnNumber:1;序言中不能有内容

时间:2012-11-29 13:42:39

标签: axis invoke saxparseexception

这是我用来点击网络服务的Axis客户端代码 我得到org.xml.sax.SAXParseException; lineNumber:1; columnNumber:1;序言中不能有内容。这是我发送肥皂消息的时候 如果我发送带有UTF-8编码的XML

,我会得到一个Socket超时

两个例外都发生在调用

有没有办法可以忽略call.invoke上的BOM标记,这似乎是个问题。

快速帮助将不胜感激..谢谢

public class WSTestClient {public static void main(String [] args){      尝试{

    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());

        }}}

0 个答案:

没有答案