org.ow2.petals.ws.client.AbstractWSClient Maven / Gradle / Ivy
The newest version!
/**
* PETALS - PETALS Services Platform.
* Copyright (c) 2007 EBM Websourcing, http://www.ebmwebsourcing.com/
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* -------------------------------------------------------------------------
* $Id$
* -------------------------------------------------------------------------
*/
package org.ow2.petals.ws.client;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.soap.SOAPEnvelope;
import org.ow2.petals.ws.addressing.EndpointReference;
/**
* An abstract Web Service client used to send SOAP messages.
*
* @author chamerling - eBM WebSourcing
*
*/
public abstract class AbstractWSClient {
/**
* The destination EPR
*/
protected EndpointReference destinationEPR;
/**
* The source EPR
*/
protected EndpointReference sourceEPR;
/**
* The soap client used to send soap messages
*/
protected SoapClient soapClient;
/**
* Creates a new instance of {@link AbstractWSClient} with the default SOAP
* client.
*
* @param sourceEPR
* @param destinationEPR
*/
public AbstractWSClient(EndpointReference sourceEPR,
EndpointReference destinationEPR) {
this(sourceEPR, destinationEPR, new SimpleSoapClient());
}
/**
* Creates a new instance of {@link AbstractWSClient}
*
* @param sourceEPR
* @param destinationEPR
* @param soapClient
*/
public AbstractWSClient(EndpointReference sourceEPR,
EndpointReference destinationEPR, SoapClient soapClient) {
this.sourceEPR = sourceEPR;
this.destinationEPR = destinationEPR;
this.soapClient = soapClient;
}
/**
* Call a web service
*
* @param URI
* @param soapMessage
* @return
*/
protected SOAPEnvelope callWS(String wsaAction, OMElement soapMessage) {
SOAPEnvelope response = soapClient.send(sourceEPR, destinationEPR,
wsaAction, soapMessage, null);
return response;
}
/**
* @return the destinationEPR
*/
public EndpointReference getDestinationEPR() {
return this.destinationEPR;
}
/**
* @param destinationEPR
* the destinationEPR to set
*/
public void setDestinationEPR(EndpointReference destinationEPR) {
this.destinationEPR = destinationEPR;
}
/**
* @return the soapClient
*/
public SoapClient getSoapClient() {
return this.soapClient;
}
/**
* @param soapClient
* the soapClient to set
*/
public void setSoapClient(SoapClient soapClient) {
this.soapClient = soapClient;
}
/**
* @return the sourceEPR
*/
public EndpointReference getSourceEPR() {
return this.sourceEPR;
}
/**
* @param sourceEPR
* the sourceEPR to set
*/
public void setSourceEPR(EndpointReference sourceEPR) {
this.sourceEPR = sourceEPR;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy