Package org.xmlsoap.schemas.soap.envelope

Examples of org.xmlsoap.schemas.soap.envelope.EnvelopeDocument



    public void testSetTerminationTime_SCENARIO_E_CONTINUED() throws IOException
    {
        String response = createJob();
        EnvelopeDocument responseEnvelope = loadResponseEnvelope(response);
        setJobURL(responseEnvelope);

        EnvelopeDocument envelopeDoc = null;
        envelopeDoc = loadDocument("SetTerminationTime.soap");
        addReferencePropsToEnvelope(envelopeDoc, getJobEndpointReference(responseEnvelope).getReferenceProperties());
        Calendar instance = Calendar.getInstance();
        instance.set(Calendar.MINUTE, instance.get(Calendar.MINUTE) + 5);

        Envelope requestEnvelope = envelopeDoc.getEnvelope();
        XmlObject[] childElements = XmlBeanUtils.getChildElements(requestEnvelope.getBody());
        SetTerminationTimeDocument.SetTerminationTime childElement = (SetTerminationTimeDocument.SetTerminationTime) childElements[0];
        childElement.setRequestedTerminationTime(instance);

        System.out.println("Setting termination time on JOB: ");
        System.out.println(envelopeDoc.toString());
        response = sendRequest(m_jobURL, envelopeDoc.newInputStream());
        assertTrue(response.indexOf("SetTerminationTimeResponse") > -1);

    }
View Full Code Here


    }

    public void testSendDocument_SCENARIO_E_CONTINUED() throws IOException
    {
        String response = createJob();
        EnvelopeDocument responseEnvelope = loadResponseEnvelope(response);
        setJobURL(responseEnvelope);

        EnvelopeDocument envelopeDocument = loadDocument("SendDocument.soap");
        addReferencePropsToEnvelope(envelopeDocument, getJobEndpointReference(responseEnvelope).getReferenceProperties());
        response = sendRequest(m_jobURL, envelopeDocument.newInputStream());
        assertTrue(response.indexOf("CreationResponse") > -1);
        assertTrue(response.indexOf("successful-ok") > -1);
    }
View Full Code Here

        createPrinter();//create printer
        testUpdateResourceProperties_SCENARIO_B1();//set accepting job state to true
        String response = sendPrinterRequest("Set_UpdateDocFormat.soap");
        response = createJob(); //create Job

        EnvelopeDocument responseEnvelope = loadResponseEnvelope(response);
        setJobURL(responseEnvelope);

        //set termination time
        /*   EnvelopeDocument getTermTime = loadDocument("GetTerminationTime.soap");
           addReferencePropsToEnvelope(getTermTime, getJobEndpointReference(responseEnvelope).getReferenceProperties() );
           response = sendRequest(m_jobURL, getTermTime.newInputStream());
           EnvelopeDocument getTermTimeEnvel = loadResponseEnvelope(response);
           XmlObject[] childElements = XmlBeanUtils.getChildElements(getTermTimeEnvel.getEnvelope().getBody());
           GetResourcePropertyResponseDocument.GetResourcePropertyResponse termTime =  (GetResourcePropertyResponseDocument.GetResourcePropertyResponse) childElements[0];
           childElements = XmlBeanUtils.getChildElements(termTime);
           XmlDateTimeImpl o = (XmlDateTimeImpl) childElements[0];
           Calendar terminationTime = o.getCalendarValue();
   */
        EnvelopeDocument setTerminationDoc = loadDocument("SetTerminationTime.soap");
        addReferencePropsToEnvelope(setTerminationDoc, getJobEndpointReference(responseEnvelope).getReferenceProperties());
        Calendar newTermTime = Calendar.getInstance();
        newTermTime.set(Calendar.MINUTE, newTermTime.get(Calendar.MINUTE) + 1);

        System.out.println("Setting termination time on JOB: ");
        Envelope requestEnvelope = setTerminationDoc.getEnvelope();
        XmlObject[] termElems = XmlBeanUtils.getChildElements(requestEnvelope.getBody());
        SetTerminationTimeDocument.SetTerminationTime childElement = (SetTerminationTimeDocument.SetTerminationTime) termElems[0];
        childElement.setRequestedTerminationTime(newTermTime);
        response = sendRequest(m_jobURL, setTerminationDoc.newInputStream());

        //send a document
        EnvelopeDocument envelopeDocument = loadDocument("SendDocument.soap");
        addReferencePropsToEnvelope(envelopeDocument, getJobEndpointReference(responseEnvelope).getReferenceProperties());
        response = sendRequest(m_jobURL, envelopeDocument.newInputStream());
        assertTrue(response.indexOf("Fault") == -1);

        try
        {
            Thread.sleep(120000L);
        }
        catch (InterruptedException e)
        {
            ;
        }

        //this request should be bad and return with a fault if the Job successfully timed out
        envelopeDocument = loadDocument("SendDocument.soap");
        addReferencePropsToEnvelope(envelopeDocument, getJobEndpointReference(responseEnvelope).getReferenceProperties());
        response = sendRequest(m_jobURL, envelopeDocument.newInputStream());
        assertTrue(response.indexOf("ResourceUnknownFault") > -1);

    }
View Full Code Here

    //***** end tests ********

    private String sendPrinterRequest(String fileName) throws IOException
    {
        EnvelopeDocument envelopeDocument = loadDocument(fileName);
        addReferencePropsToEnvelope(envelopeDocument, m_printerReferenceProperties);
        return sendRequest(m_printerURL, envelopeDocument.newInputStream());
    }
View Full Code Here

    }


    private EnvelopeDocument loadResponseEnvelope(String response)
    {
        EnvelopeDocument envelope = null;
        try
        {
            envelope = EnvelopeDocument.Factory.parse(response);

        }
View Full Code Here

    }

    private EnvelopeDocument loadDocument(String requestFile)
            throws IOException
    {
        EnvelopeDocument envelopeDoc = null;
        try
        {
            envelopeDoc = (EnvelopeDocument) XmlObject.Factory.parse(new File(m_requestsDir, requestFile));
        }
        catch (XmlException e)
View Full Code Here

{


    public static EnvelopeDocument createEnvelope()
    {
        EnvelopeDocument envelopeDoc = EnvelopeDocument.Factory.newInstance();
        Envelope envelope = envelopeDoc.addNewEnvelope();
        envelope.addNewHeader();
        envelope.addNewBody();
        return envelopeDoc;
    }
View Full Code Here

        return envelopeDoc;
    }

    public static XmlObject sendRequest(XmlObject requestDoc, String action, EndpointReference epr)
    {
        EnvelopeDocument requestEnvelopeDoc = createEnvelope();
        Envelope requestEnvelope = requestEnvelopeDoc.getEnvelope();
        addAddressingHeaders(requestEnvelope.getHeader(), action, epr);
        XmlBeanUtils.addChildElement(requestEnvelope.getBody(), requestDoc);
        try
        {
            URL endpointURL = new URL(epr.getAddress());
            System.out.println("Sending Request to " + endpointURL.toString());
            URI actionURI = new URI(action);
            String response = SoapClient.sendRequest(endpointURL, requestEnvelopeDoc.newInputStream(), actionURI);
            EnvelopeDocument responseEnvelopeDoc = (EnvelopeDocument) XmlObject.Factory.parse(response);
            Envelope responseEnvelope = responseEnvelopeDoc.getEnvelope();
            XmlObject[] responseBodyElems = XmlBeanUtils.getChildElements(responseEnvelope.getBody());
            System.out.println("Recieved response from " + endpointURL.toString());
            if (responseBodyElems.length == 0)
            {
                return null;
View Full Code Here

        }
    }

    public static XmlObject sendRequest(XmlObject requestDoc, String action, String address)
    {
        EnvelopeDocument requestEnvelopeDoc = createEnvelope();
        Envelope requestEnvelope = requestEnvelopeDoc.getEnvelope();
        addAddressingHeaders(requestEnvelope.getHeader(), action, address);
        XmlBeanUtils.addChildElement(requestEnvelope.getBody(), requestDoc);
        try
        {
            System.out.println("Sending request to: " + address);
            URL endpointURL = new URL(address);
            URI actionURI = new URI(action);
            String response = SoapClient.sendRequest(endpointURL, requestEnvelopeDoc.newInputStream(), actionURI);
            EnvelopeDocument responseEnvelopeDoc = (EnvelopeDocument) XmlObject.Factory.parse(response);
            Envelope responseEnvelope = responseEnvelopeDoc.getEnvelope();
            XmlObject[] responseBodyElems = XmlBeanUtils.getChildElements(responseEnvelope.getBody());
            if (responseBodyElems.length == 0)
            {
                return null;
            }
View Full Code Here



    protected EnvelopeDocument createEnvelope()
    {
        EnvelopeDocument envelopeDoc = EnvelopeDocument.Factory.newInstance();
        Envelope envelope = envelopeDoc.addNewEnvelope();
        envelope.addNewHeader();
        envelope.addNewBody();
        return envelopeDoc;
    }
View Full Code Here

TOP

Related Classes of org.xmlsoap.schemas.soap.envelope.EnvelopeDocument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.