1 16 package org.apache.axis2.saaj; 17 18 import org.apache.axis2.Constants; 19 import org.apache.axis2.addressing.AddressingConstants; 20 import org.apache.axis2.addressing.EndpointReference; 21 import org.apache.axis2.clientapi.Call; 22 import org.apache.axis2.engine.AxisFault; 23 24 import javax.xml.soap.SOAPConnection ; 25 import javax.xml.soap.SOAPException ; 26 import javax.xml.soap.SOAPMessage ; 27 import java.net.MalformedURLException ; 28 import java.net.URL ; 29 30 31 37 public class SOAPConnectionImpl extends SOAPConnection { 38 39 42 public SOAPMessage call(SOAPMessage request, Object endpoint) 43 throws SOAPException { 44 try{ 45 org.apache.axis2.soap.SOAPEnvelope envelope = ((SOAPEnvelopeImpl)request.getSOAPPart().getEnvelope()).getOMEnvelope(); 46 47 Call call = new Call(); 48 URL url = new URL (endpoint.toString()); 49 call.setTransportInfo(Constants.TRANSPORT_HTTP,Constants.TRANSPORT_HTTP, true); 50 call.setTo(new EndpointReference(AddressingConstants.WSA_TO, url.toString())); 51 org.apache.axis2.soap.SOAPEnvelope responseEnv = (org.apache.axis2.soap.SOAPEnvelope)call.invokeBlocking("echo", envelope); 52 SOAPEnvelopeImpl response = new SOAPEnvelopeImpl(responseEnv); 53 return new SOAPMessageImpl(response); 54 55 }catch (MalformedURLException mue) { 56 throw new SOAPException (mue); 57 }catch (AxisFault af){ 58 throw new SOAPException (af); 59 } 60 } 61 62 63 66 public void close() throws SOAPException { 67 69 } 70 71 } 72 | Popular Tags |