Package org.apache.soap

Examples of org.apache.soap.Body


        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
View Full Code Here

TOP

Related Classes of org.apache.soap.Body

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.