| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3411 人关注过本帖
标题:demo运行时报错,单步调试时不报错,这是为啥啊,求解!
只看楼主 加入收藏
孤独与烈酒
Rank: 5Rank: 5
来 自:山西省运城市
等 级:贵宾
威 望:16
帖 子:47
专家分:310
注 册:2016-9-26
结帖率:50%
收藏
已结贴  问题点数:20 回复次数:2 
demo运行时报错,单步调试时不报错,这是为啥啊,求解!
程序代码:
package com.aisino.cxf;

import import org.import com.aisino.cxf.*;

public class TestCxf_kj {
    public static void main(String[] args) {
        try {
            //读取内层data报文
            String xml = FileUtils.readFileToString(new File("D:\\Desktop\\uu.txt"), "gbk");
            String resp=Commom.sendRequest(xml, Commom.FPKJCODE);
            int begin =resp.indexOf("<returnCode>");
            int end =resp.indexOf("</returnCode>");
            String content=resp.substring(begin+"<returnCode>".length(), end);
            int begin1 =resp.indexOf("<returnMessage>");
            int end1 =resp.indexOf("</returnMessage>");
            String content1=resp.substring(begin1+"<returnMessage>".length(), end1);
            if(content.equals("0000"))
            {
                System.out.println(resp);
                System.out.println(Base64Helper.decode(content1));
            }else
            {
                System.out.println(resp);
                System.out.println(Base64Helper.decode(content1));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}


程序代码:
package com.aisino.cxf;

import import javax.xml.namespace.QName;

import org.import org.apache.cxf.endpoint.Client;
import org.apache.cxf.endpoint.Endpoint;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
import org.apache.cxf.service.model.BindingInfo;
import org.apache.cxf.service.model.BindingOperationInfo;

import com.CaConstant;
import com.aisino.PKCS7;

public class Commom {
    
    public final static String FPKJCODE="ECXML.FPKJ.BC.E_INV";  //开具
    public final static String FPXZCODE="ECXML.FPXZ.CX.E_INV";  //下载
    public final static String FPQZCODE="ECXML.FPQZ.BC.E.INV";  //签章
    public final static String FPTSCODE="ECXML.FPKJJG.TS.E_INV";  //推送
    public final static String FPCXCODE="ECXML.FPCX.CX.E_INV";  //查询
    
    public static String sendRequest(String xml,String interfaceCode) throws Exception{
        //CA加密
    final String trustsBytes = CaConstant.getProperty("PUBLIC_TRUSTS");
    String decryptPFXBytes = CaConstant.getProperty("CLIENT_DECRYPTPFX");
    String decryptPFXKey = CaConstant.getProperty("CLIENT_DECRYPTPFX_KEY");
     final PKCS7 pkcs7Client = new PKCS7(FileUtils.readFileToByteArray(new File(trustsBytes)), FileUtils.readFileToByteArray(new File(decryptPFXBytes)), decryptPFXKey);
    final byte[] encodeData = pkcs7Client.pkcs7Encrypt(xml, FileUtils.readFileToByteArray(new File(CaConstant.getProperty("PLATFORM_DECRYPTCER"))));
    //base64加密
    final byte[] base64Date = Base64Helper.encode(encodeData);
    String aa= new String(base64Date);
  //    String aa=new String(Base64Helper.encode(xml));
      String s = "SJLY" + (char)2 + "09" + (char)3 + "FPLX" + (char)2 + "1";
      String globle = "<?xml version='1.0' encoding='utf-8' ?>"+
                 "<interface xmlns='' xmlns:xsi='http://www.' xsi:schemaLocation='http://www.chinatax.' version='DZFP1.0' >"+
                 "<globalInfo>"+
                 "<terminalCode>0</terminalCode>"+
                 "<appId>ZZS_PT_DZFP</appId>"+
                 "<version>2</version>"+
                "<interfaceCode>"+interfaceCode+"</interfaceCode>"+
                 "<requestCode>17109066</requestCode>"+
                 "<requestTime>2016-06-29 10:30:42 968</requestTime>"+
                 "<responseCode>144</responseCode>"+
                 "<dataExchangeId>1710906620160807eXl4EymmJ</dataExchangeId>"+
                 "<userName>17109066</userName>"+
                 "<passWord>0981202688M0E0Rjk2ODU1MTlENEE2Mg==</passWord>"+
                 "<taxpayerId>110101TRDX8RQU1</taxpayerId>"+
                 "<authorizationCode>11RDX8RQU1</authorizationCode>"+
                "</globalInfo>"+
                "<returnStateInfo>"+
                "<returnCode />"+
                 "<returnMessage />"+
                "</returnStateInfo>"+
                "<Data>"+
                 "<dataDescription>"+ 
                  " <zipCode>0</zipCode>"+
                  "<encryptCode>2</encryptCode>"+
                  "<codeType>0</codeType>"+
                 "</dataDescription>"+
                 "<content>" +aa+
                 "</content>"+
                "</Data>"+
                "</interface>";
                
//        globle=xml;
//        System.out.println(globle);
        //http://ei-test.:20080/51TransferServicePro_zzs/webservice/eInvWS?wsdl
        //http://ei-test.:20080/51TransferServiceUpPro/webservice/eInvWS?wsdl
        
//        String url = "http://ei-test.:28888/fpqz/webservice/eInvWS?wsdl";
        String url = "http://ei-test.//        String url = "http://ei-test.:28888/fpqz/webservice/eInvWS?wsdl";
//        String url = "http://192.168.15.125:8080/zzs_proxy/webservice/eInvWS?wsdl";
        String operation = "eiInterface";
        // String namespace = "http://ws.";

        JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance();
        Client client = factory.createClient(url);
        // QName opName = new QName(namespace, operation);

        // 不硬编码namespace
        Endpoint endpoint = client.getEndpoint();
        QName opName = new QName(endpoint.getService().getName().getNamespaceURI(), operation);
        BindingInfo bindingInfo = endpoint.getEndpointInfo().getBinding();
        if (bindingInfo.getOperation(opName) == null) {
            for (BindingOperationInfo operationInfo : bindingInfo.getOperations()) {
                if (operation.equals(operationInfo.getName().getLocalPart())) {
                    opName = operationInfo.getName();
                    break;
                }
            }
        }
//        System.out.println(globle);
        Object[] res = client.invoke(opName, globle);
        System.out.println(res[0].toString());
        return res[0].toString();
    }
}



程序代码:
2016-9-28 15:34:09 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
警告: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Marshalling Error: Socket Closed
    at org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:160)
    at org.apache.cxf.(DataWriterImpl.java:169)
    at org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:105)
    at org.apache.cxf.interceptor.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:478)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:308)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:260)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:280)
    at com.aisino.(Commom.java:97)
    at com.aisino.cxf.TestCxf_kj.main(TestCxf_kj.java:15)
Caused by: javax.xml.bind.MarshalException

 - with linked exception:
[ Socket Closed]
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:328)
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:251)
    at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:75)
    at org.apache.cxf.jaxb.JAXBEncoderDecoder.writeObject(JAXBEncoderDecoder.java:445)
    at org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:139)
    ... 10 more
Caused by:  Socket Closed
    at (PlainSocketImpl.java:286)
    at (Socket.java:1032)
    at (HttpClient.java:356)
    at (HttpClient.java:273)
    at (HttpClient.java:310)
    at (HttpURLConnection.java:987)
    at (HttpURLConnection.java:923)
    at (HttpURLConnection.java:841)
    at (HttpURLConnection.java:1031)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1934)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWrite(HTTPConduit.java:1889)
    at org.apache.(AbstractWrappedOutputStream.java:42)
    at org.apache.(AbstractThresholdOutputStream.java:89)
    at org.apache.(AbstractThresholdOutputStream.java:63)
    at com.sun.xml.bind.v2.runtime.output.UTF8XmlOutput.write(UTF8XmlOutput.java:412)
    at com.sun.xml.bind.v2.runtime.output.Encoded.write(Encoded.java:167)
    at com.sun.xml.bind.v2.runtime.output.UTF8XmlOutput.doText(UTF8XmlOutput.java:323)
    at com.sun.xml.bind.v2.runtime.output.UTF8XmlOutput.text(UTF8XmlOutput.java:305)
    at com.sun.xml.bind.v2.runtime.XMLSerializer.leafElement(XMLSerializer.java:328)
    at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$StringImplImpl.writeLeafElement(RuntimeBuiltinLeafInfoImpl.java:1052)
    at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$StringImplImpl.writeLeafElement(RuntimeBuiltinLeafInfoImpl.java:1031)
    at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.writeLeafElement(TransducedAccessor.java:256)
    at com.sun.xml.bind.v2.runtime.property.SingleElementLeafProperty.serializeBody(SingleElementLeafProperty.java:130)
    at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:361)
    at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:696)
    at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:156)
    at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:131)
    at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(ElementBeanInfoImpl.java:333)
    at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:340)
    at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:76)
    at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:323)
    ... 14 more
org.apache.cxf.interceptor.Fault: Marshalling Error: Socket Closed
    at org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:160)
    at org.apache.cxf.(DataWriterImpl.java:169)
    at org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:105)
    at org.apache.cxf.interceptor.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:478)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:308)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:260)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:280)
    at com.aisino.(Commom.java:97)
    at com.aisino.cxf.TestCxf_kj.main(TestCxf_kj.java:15)
Caused by: javax.xml.bind.MarshalException

 - with linked exception:
[ Socket Closed]
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:328)
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:251)
    at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:75)
    at org.apache.cxf.jaxb.JAXBEncoderDecoder.writeObject(JAXBEncoderDecoder.java:445)
    at org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:139)
    ... 10 more
Caused by:  Socket Closed
    at (PlainSocketImpl.java:286)
    at (Socket.java:1032)
    at (HttpClient.java:356)
    at (HttpClient.java:273)
    at (HttpClient.java:310)
    at (HttpURLConnection.java:987)
    at (HttpURLConnection.java:923)
    at (HttpURLConnection.java:841)
    at (HttpURLConnection.java:1031)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1934)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWrite(HTTPConduit.java:1889)
    at org.apache.(AbstractWrappedOutputStream.java:42)
    at org.apache.(AbstractThresholdOutputStream.java:89)
    at org.apache.(AbstractThresholdOutputStream.java:63)
    at com.sun.xml.bind.v2.runtime.output.UTF8XmlOutput.write(UTF8XmlOutput.java:412)
    at com.sun.xml.bind.v2.runtime.output.Encoded.write(Encoded.java:167)
    at com.sun.xml.bind.v2.runtime.output.UTF8XmlOutput.doText(UTF8XmlOutput.java:323)
    at com.sun.xml.bind.v2.runtime.output.UTF8XmlOutput.text(UTF8XmlOutput.java:305)
    at com.sun.xml.bind.v2.runtime.XMLSerializer.leafElement(XMLSerializer.java:328)
    at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$StringImplImpl.writeLeafElement(RuntimeBuiltinLeafInfoImpl.java:1052)
    at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$StringImplImpl.writeLeafElement(RuntimeBuiltinLeafInfoImpl.java:1031)
    at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.writeLeafElement(TransducedAccessor.java:256)
    at com.sun.xml.bind.v2.runtime.property.SingleElementLeafProperty.serializeBody(SingleElementLeafProperty.java:130)
    at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:361)
    at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:696)
    at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:156)
    at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:131)
    at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(ElementBeanInfoImpl.java:333)
    at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:340)
    at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:76)
    at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:323)
    ... 14 more




[此贴子已经被作者于2016-9-28 15:56编辑过]

搜索更多相关主题的帖子: color 
2016-09-28 15:53
hhwz
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:贵宾
威 望:87
帖 子:687
专家分:4502
注 册:2011-5-22
收藏
得分:20 
异常不是 说了
Socket Closed  
2016-09-28 16:08
孤独与烈酒
Rank: 5Rank: 5
来 自:山西省运城市
等 级:贵宾
威 望:16
帖 子:47
专家分:310
注 册:2016-9-26
收藏
得分:0 
回复 2楼 hhwz
怎么解决... 之前没做过 不会弄啊
2016-09-28 16:14
快速回复:demo运行时报错,单步调试时不报错,这是为啥啊,求解!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.040899 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved