FileDocCategorySizeDatePackage
SOAPConnectionImpl.javaAPI DocApache Axis 1.44325Sat Apr 22 18:57:28 BST 2006org.apache.axis.soap

SOAPConnectionImpl

public class SOAPConnectionImpl extends SOAPConnection
SOAP Connection implementation
author
Davanum Srinivas (dims@yahoo.com)

Fields Summary
private boolean
closed
private Integer
timeout
Constructors Summary
Methods Summary
public javax.xml.soap.SOAPMessagecall(javax.xml.soap.SOAPMessage request, java.lang.Object endpoint)
Sends the given message to the specified endpoint and blocks until it has returned the response.

param
request the SOAPMessage object to be sent
param
endpoint a URLEndpoint object giving the URL to which the message should be sent
return
the SOAPMessage object that is the response to the message that was sent
throws
SOAPException if there is a SOAP error

        if(closed){
            throw new SOAPException(Messages.getMessage("connectionClosed00"));
        }
        try {
            Call call = new Call(endpoint.toString());
            ((org.apache.axis.Message)request).setMessageContext(call.getMessageContext());
            Attachments attachments = ((org.apache.axis.Message)
                    request).getAttachmentsImpl();
            if (attachments != null) {
                Iterator iterator = attachments.getAttachments().iterator();
                while (iterator.hasNext()) {
                    Object attachment = iterator.next();
                    call.addAttachmentPart(attachment);
                }
            }
            
            String soapActionURI = checkForSOAPActionHeader(request);
            if (soapActionURI != null)
                call.setSOAPActionURI(soapActionURI);
            
            call.setTimeout(timeout);
            call.setReturnClass(SOAPMessage.class);
            call.setProperty(Call.CHECK_MUST_UNDERSTAND,Boolean.FALSE);
            call.invoke((Message) request);
            return call.getResponseMessage();
        } catch (java.net.MalformedURLException mue){
            throw new SOAPException(mue);
        } catch (org.apache.axis.AxisFault af){
            return new Message(af);
        }
    
private java.lang.StringcheckForSOAPActionHeader(javax.xml.soap.SOAPMessage request)
Checks whether the request has an associated SOAPAction MIME header and returns its value.

param
request the message to check
return
the value of any associated SOAPAction MIME header or null if there is no such header.

        MimeHeaders hdrs = request.getMimeHeaders();
        if (hdrs != null) {
            String[] saHdrs = hdrs.getHeader("SOAPAction");
            if (saHdrs != null && saHdrs.length > 0)
                return saHdrs[0];
        }
        return null;
    
public voidclose()
Closes this SOAPConnection object.

throws
SOAPException if there is a SOAP error

        if(closed){
            throw new SOAPException(Messages.getMessage("connectionClosed00"));
        }
        closed = true;
    
public java.lang.IntegergetTimeout()
get the timeout value

return


               
       
        return timeout;
    
public voidsetTimeout(java.lang.Integer timeout)
set the timeout value

param
timeout

        this.timeout = timeout;