捕获InboundInterceptor的变量?

时间:2013-02-15 14:55:28

标签: java

当我从halfpenny服务器(String halfpennyurl)出来后尝试在类LabUtils中调用InboundIntercptors的变量(incomingResponseXml)时,我得到的值为null。

如何捕获该变量?

LabUtisl.java

class LabUtils{.........

    private void gotoOrderPage(String serviceType, String sessionId) throws IOException
    {
        HPPrepareOrderInput prepareOrderInput = new HPPrepareOrderInput();
        populateHPOrderServiceInput(serviceType, sessionId, prepareOrderInput);

        populatePatientData(prepareOrderInput);
        populateClinicianData(prepareOrderInput);

        long start = System.currentTimeMillis();
        String halfPennyUrl = HPOrderClient.getOrderPageUrl(LabRadiologyConstants.ORDER_WSDL_URL, prepareOrderInput);
        long end = System.currentTimeMillis();
        long time2 = end-start;
        RequestHandler.setStart1(System.currentTimeMillis());

        performRedirect(halfPennyUrl);

    }

InboundInterceptors.class

public class DFLoggingInInterceptor extends LoggingInInterceptor
{
    public String incomingResponseXml;


    public DFLoggingInInterceptor()
    {
        super(Phase.RECEIVE);
    }

    @Override
    public void handleMessage(Message message) throws Fault
    {
        InputStream is = message.getContent(InputStream.class);
        CachedOutputStream os = new CachedOutputStream();
        try
        {
            IOUtils.copy (is, os);
            os.flush();
            message.setContent(InputStream.class, os.getInputStream ());
            is.close();

            incomingResponseXml = IOUtils.toString(os.getInputStream());

            os.close();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }



    public String getIncomingResponseXml()
    {
        return incomingResponseXml;
    }
}

0 个答案:

没有答案