Package org.apache.soap

Examples of org.apache.soap.Envelope


            result.setDataEncoding(ENCODING);
            result.setContentType("text/xml"); // $NON-NLS-1$
            result.setDataType(SampleResult.TEXT);
            result.setSamplerData(fileContents);// WARNING - could be large

            Envelope msgEnv = Envelope.unmarshall(rdoc);
            // create a new message
            Message msg = new Message();
            result.sampleStart();
            SOAPHTTPConnection spconn = null;
            // if a blank HeaderManager exists, try to
View Full Code Here


    public void sampleWithApache()
    {
        try
        {
      org.w3c.dom.Element rdoc = createDocument();
            Envelope msgEnv = Envelope.unmarshall(rdoc);
            // create a new message
            Message msg = new Message();
            RESULT.sampleStart();
      SOAPHTTPConnection spconn = null;
      // if a blank HeaderManager exists, try to
View Full Code Here

        throws WSIFException {
        Trc.entry(this, input, output, fault);

        if (!prepared)
            prepare(input, output);
        Envelope msgEnv = new Envelope();
        Body msgBody = new Body();
        Vector vect = new Vector();

        Iterator iterator =
            operation.getInput().getMessage().getParts().keySet().iterator();
        while (iterator.hasNext()) {
            String partName = (String) iterator.next();
            Object part = input.getObjectPart(partName);
            String encoding = null;
            if ("literal".equals(inputUse)) {
                // Should also include namespace
                encoding = "literal";
            } else {
                encoding = this.inputEncodingStyle;
            }

            PartSerializer partSerializer = null;
            Object o =
                portInstance.getSOAPMappingRegistry().querySerializer(
                    part.getClass(),
                    inputUse);
            if (o instanceof PartSerializer) {
                PartSerializer tmp = (PartSerializer) o;
                try {
                    partSerializer =
                        (PartSerializer) tmp.getClass().newInstance();
                } catch (InstantiationException e) {
                    Trc.ignoredException(e);
                } catch (IllegalAccessException e) {
                    Trc.ignoredException(e);
                }
                partSerializer.setPart(part);
                Part modelPart =
                    operation.getInput().getMessage().getPart(partName);
                javax.xml.namespace.QName partType = modelPart.getTypeName();
                if (partType == null)
                    partType = modelPart.getElementName();
                partSerializer.setPartQName(partType);
            } else // document with soap encoding - never been tried
                {
                partSerializer = new SOAPEncSerializerWrapper();
                partSerializer.setPart(part);
                (
                    (
                        SOAPEncSerializerWrapper) partSerializer)
                            .setTargetSerializer(
                    (Serializer) o);
            }

            Bean bean = new Bean(partSerializer.getClass(), partSerializer);
            vect.add(bean);
        }

        // create message envelope and body
        URL url = portInstance.getEndPoint();
        Envelope env = null;
        msgBody.setBodyEntries(vect);
        msgEnv.setBody(msgBody);

        SOAPTransport st = getTransport();

        if (st instanceof SOAPJMSConnection) {
           SOAPJMSConnection sjt = (SOAPJMSConnection) st;
           sjt.setSyncTimeout(WSIFProperties.getSyncTimeout());
           sjt.setAsyncTimeout(WSIFProperties.getAsyncTimeout());
        }

        if (inJmsPropVals != null && !inJmsPropVals.isEmpty()) {
        checkForTimeoutProperties(st, inJmsPropVals);
           ((SOAPJMSConnection) st).setJmsProperties(inJmsPropVals);
        }

        //TODO docstyle headers
        //setCallContext( call );

        if ( url != null && !isHostInNonProxyProperty( url ) ) {
           setSOAPProxy( st );
        }

        // create and send message
        try {
            Message msg = new Message();
            if (st != null)
                msg.setSOAPTransport(st);

            Trc.event(
                this,
                "Invoking operation ",
                getName(),
                " url ",
                url,
                " soapaction ",
                getSoapActionURI(),
                " envelope ",
                msgEnv,
                " message ",
                msg);

            msg.send(url, getSoapActionURI(), msgEnv);

            // receive response envelope
            env = msg.receiveEnvelope();
        } catch (SOAPException exn) {
            Trc.exception(exn);
            WSIFException e =
                new WSIFException("SOAP Exception: " + exn.getMessage());
            e.setTargetException(exn);
            throw e;
        }

        Trc.event(this, "Returned from operation, envelope ", env);

        Body retbody = env.getBody();
        java.util.Vector v = retbody.getBodyEntries();
        int index = 0;

        String encoding = null;
        if ("literal".equals(outputUse)) {
            // Should also include namespace
            encoding = "literal";
        } else {
            encoding = this.outputEncodingStyle;
        }

        iterator =
            operation.getOutput().getMessage().getParts().keySet().iterator();
        while (iterator.hasNext()) {
            Element element = (Element) v.get(index++);
            String partName = (String) iterator.next();
            Part modelPart =
                operation.getOutput().getMessage().getPart(partName);
            javax.xml.namespace.QName partType = modelPart.getTypeName();
            if (partType == null)
                partType = modelPart.getElementName();

            PartSerializer partSerializer = null;
            Object o =
                this.portInstance.getSOAPMappingRegistry().queryDeserializer(
                    new org.apache.soap.util.xml.QName(
                        partType.getNamespaceURI(),
                        partType.getLocalPart()),
                    encoding);

            if (o instanceof PartSerializer) {
                PartSerializer tmp = (PartSerializer) o;
                try {
                    partSerializer =
                        (PartSerializer) tmp.getClass().newInstance();
                } catch (InstantiationException e) {
                    Trc.ignoredException(e);
                } catch (IllegalAccessException e) {
                    Trc.ignoredException(e);
                }
                partSerializer.setPartQName(partType);
                partSerializer.unmarshall(null, null, element, null, null);
                Object retBean = partSerializer.getPart();
                output.setObjectPart(partName, retBean);
            } else // document with soap encoding - never been tried 
                {
                Bean bean =
                    ((Deserializer) o).unmarshall(
                        null,
                        null,
                        element,
                        null,
                        null);
                Object retBean = bean.value;
            }
        }
       
        Header soapHeader = env.getHeader();
      addContextResponseSOAPHeaders(soapHeader);

        Trc.exit(true);
        return true;
    }
View Full Code Here

                    Constants.FAULT_CODE_CLIENT,
                    "Parsing error, response was:\n" + payloadStr);
            }

            // Unmarshall the response envelope.
            Envelope respEnv = Envelope.unmarshall(payload, respCtx);

            // Extract the response from the response envelope.
            Response resp = Response.extractFromEnvelope(respEnv, smr, respCtx);

            return resp;
View Full Code Here

            result.setDataEncoding(ENCODING);
            result.setContentType("text/xml"); // $NON-NLS-1$
            result.setDataType(SampleResult.TEXT);
            result.setSamplerData(fileContents);// WARNING - could be large

            Envelope msgEnv = Envelope.unmarshall(rdoc);
            result.sampleStart();
            SOAPHTTPConnection spconn = null;
            // if a blank HeaderManager exists, try to
            // get the SOAPHTTPConnection. After the first
            // request, there should be a connection object
View Full Code Here

      result.setURL(this.getUrl());
      org.w3c.dom.Element rdoc = createDocument();
      if (rdoc == null) {
        throw new SOAPException("Could not create document", null);
      }
      Envelope msgEnv = Envelope.unmarshall(rdoc);
      // create a new message
      Message msg = new Message();
      result.sampleStart();
      SOAPHTTPConnection spconn = null;
      // if a blank HeaderManager exists, try to
View Full Code Here

            result.setDataEncoding(ENCODING);
            result.setContentType("text/xml"); // $NON-NLS-1$
            result.setDataType(SampleResult.TEXT);
            result.setSamplerData(fileContents);// WARNING - could be large

            Envelope msgEnv = Envelope.unmarshall(rdoc);
            // create a new message
            Message msg = new Message();
            result.sampleStart();
            SOAPHTTPConnection spconn = null;
            // if a blank HeaderManager exists, try to
View Full Code Here

      RESULT.setURL(this.getUrl());
      RESULT.setSampleLabel(getName());
      org.w3c.dom.Element rdoc = createDocument();
      if (rdoc == null)
        throw new SOAPException("Could not create document", null);
      Envelope msgEnv = Envelope.unmarshall(rdoc);
      // create a new message
      Message msg = new Message();
      RESULT.sampleStart();
      SOAPHTTPConnection spconn = null;
      // if a blank HeaderManager exists, try to
View Full Code Here

            result.setDataEncoding(ENCODING);
            result.setContentType("text/xml"); // $NON-NLS-1$
            result.setDataType(SampleResult.TEXT);
            result.setSamplerData(fileContents);// WARNING - could be large

            Envelope msgEnv = Envelope.unmarshall(rdoc);
            // create a new message
            Message msg = new Message();
            result.sampleStart();
            SOAPHTTPConnection spconn = null;
            // if a blank HeaderManager exists, try to
View Full Code Here

            result.setDataEncoding(ENCODING);
            result.setContentType("text/xml"); // $NON-NLS-1$
            result.setDataType(SampleResult.TEXT);
            result.setSamplerData(fileContents);// WARNING - could be large

            Envelope msgEnv = Envelope.unmarshall(rdoc);
            // create a new message
            Message msg = new Message();
            result.sampleStart();
            SOAPHTTPConnection spconn = null;
            // if a blank HeaderManager exists, try to
View Full Code Here

TOP

Related Classes of org.apache.soap.Envelope

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.