Created
January 19, 2012 18:02
-
-
Save ctataryn/1641475 to your computer and use it in GitHub Desktop.
null filter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ ============= WSDL ================] | |
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" | |
xmlns:tns="http://ws.mlc.mb.ca/playerManagement/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" | |
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="playerManagement" | |
targetNamespace="http://ws.mlc.mb.ca/playerManagement/"> | |
<wsdl:types> | |
<xsd:schema targetNamespace="http://ws.mlc.mb.ca/playerManagement/" xmlns:pm="http://ws.mlc.mb.ca/playerManagement/"> | |
<xsd:element name="wsPlayer"> | |
<xsd:complexType> | |
<xsd:sequence> | |
<xsd:element name="id" type="xsd:int" /> | |
<xsd:element name="firstName" type="xsd:string" /> | |
<xsd:element name="lastName" type="xsd:string" /> | |
</xsd:sequence> | |
</xsd:complexType> | |
</xsd:element> | |
<xsd:element name="retrievePlayerById"> | |
<xsd:complexType> | |
<xsd:sequence> | |
<xsd:element name="playerId" type="xsd:int" /> | |
</xsd:sequence> | |
</xsd:complexType> | |
</xsd:element> | |
<xsd:element name="retrievePlayerByIdResponse"> | |
<xsd:complexType> | |
<xsd:sequence> | |
<xsd:element ref="pm:wsPlayer" /> | |
</xsd:sequence> | |
</xsd:complexType> | |
</xsd:element> | |
</xsd:schema> | |
</wsdl:types> | |
<wsdl:message name="retrievePlayerById-Request"> | |
<wsdl:part element="tns:retrievePlayerById" name="filter" /> | |
</wsdl:message> | |
<wsdl:message name="retrievePlayerById-Response"> | |
<wsdl:part element="tns:retrievePlayerByIdResponse" name="playerResponse" /> | |
</wsdl:message> | |
<wsdl:portType name="playerManagement"> | |
<wsdl:operation name="retrievePlayerById"> | |
<wsdl:input message="tns:retrievePlayerById-Request" /> | |
<wsdl:output message="tns:retrievePlayerById-Response" /> | |
</wsdl:operation> | |
</wsdl:portType> | |
<wsdl:binding name="playerManagementSOAP" type="tns:playerManagement"> | |
<soap:binding style="document" | |
transport="http://schemas.xmlsoap.org/soap/http" /> | |
<wsdl:operation name="retrievePlayerById"> | |
<soap:operation soapAction="http://ws.mlc.mb.ca/playerManagement/" /> | |
<wsdl:input> | |
<soap:body use="literal" /> | |
</wsdl:input> | |
<wsdl:output> | |
<soap:body use="literal" /> | |
</wsdl:output> | |
</wsdl:operation> | |
</wsdl:binding> | |
<wsdl:service name="playerManagement"> | |
<wsdl:port binding="tns:playerManagementSOAP" name="playerManagementSOAP"> | |
<soap:address location="http://www.example.org/" /> | |
</wsdl:port> | |
</wsdl:service> | |
</wsdl:definitions> | |
[ ============= Initial Servlet ================] | |
package ca.mb.mlc.ws.playermanagement.servlet; | |
import javax.servlet.ServletConfig; | |
import org.apache.cxf.Bus; | |
import org.apache.cxf.BusFactory; | |
import org.apache.cxf.endpoint.Endpoint; | |
import org.apache.cxf.frontend.ServerFactoryBean; | |
import org.apache.cxf.transport.servlet.CXFNonSpringServlet; | |
import ca.mb.mlc.service.web.PlayerManagementWebServicesStub; | |
public class PlayerManagementEntryServlet extends CXFNonSpringServlet { | |
@Override | |
protected void loadBus(ServletConfig servletConfig) { | |
super.loadBus(servletConfig); | |
// You can als use the simple frontend API to do this | |
ServerFactoryBean factory = new ServerFactoryBean(); | |
factory.setBus(getBus()); | |
factory.setServiceClass(PlayerManagementWebServicesStub.class); | |
factory.setAddress("/PlayerManagement"); | |
factory.create(); | |
} | |
} | |
[ ============= Web Service Interface generated by cxf-codegen-plugin =============== ] | |
package ca.mb.mlc.ws.playermanagement; | |
import javax.jws.WebMethod; | |
import javax.jws.WebParam; | |
import javax.jws.WebResult; | |
import javax.jws.WebService; | |
import javax.jws.soap.SOAPBinding; | |
import javax.xml.bind.annotation.XmlSeeAlso; | |
/** | |
* This class was generated by Apache CXF 2.5.1 | |
* 2012-01-19T12:46:02.408-06:00 | |
* Generated source version: 2.5.1 | |
* | |
*/ | |
@WebService(targetNamespace = "http://ws.mlc.mb.ca/playerManagement/", name = "playerManagement") | |
@XmlSeeAlso({ObjectFactory.class}) | |
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) | |
public interface PlayerManagement { | |
@WebResult(name = "retrievePlayerByIdResponse", targetNamespace = "http://ws.mlc.mb.ca/playerManagement/", partName = "playerResponse") | |
@WebMethod(action = "http://ws.mlc.mb.ca/playerManagement/") | |
public RetrievePlayerByIdResponse retrievePlayerById( | |
@WebParam(partName = "filter", name = "retrievePlayerById", targetNamespace = "http://ws.mlc.mb.ca/playerManagement/") | |
RetrievePlayerById filter | |
); | |
} | |
[ ============= Web Service Implementation ================] | |
package ca.mb.mlc.service.web; | |
import java.util.ArrayList; | |
import java.util.List; | |
import ca.mb.mlc.model.web.WsPlayerFacade; | |
import ca.mb.mlc.playermanagement.model.Player; | |
import ca.mb.mlc.playermanagement.model.impl.PlayerImpl; | |
import ca.mb.mlc.ws.playermanagement.ObjectFactory; | |
import ca.mb.mlc.ws.playermanagement.PlayerManagement; | |
import ca.mb.mlc.ws.playermanagement.RetrievePlayerById; | |
import ca.mb.mlc.ws.playermanagement.RetrievePlayerByIdResponse; | |
import ca.mb.mlc.ws.playermanagement.WsPlayer; | |
public class PlayerManagementWebServicesStub implements PlayerManagement { | |
public final static int PLAYER_ID = -99; | |
public final static String PLAYER_FNAME = "Rusty"; | |
public final static String PLAYER_LNAME = "Shackleford"; | |
public RetrievePlayerByIdResponse retrievePlayerById( | |
RetrievePlayerById filter) { | |
//create a new player from our Domain | |
Player player = new PlayerImpl(filter.getPlayerId()); | |
//populate it if the player id matches | |
if (filter.getPlayerId() == PLAYER_ID) { | |
player = new PlayerImpl(); | |
player = new PlayerImpl(); | |
player.setId(PLAYER_ID); | |
player.getName().setFirstName(PLAYER_FNAME); | |
player.getName().setFirstName(PLAYER_LNAME); | |
} | |
ObjectFactory objFac = new ObjectFactory(); | |
//wrap the player in the web service specific objects | |
WsPlayer wsPlayer = new WsPlayerFacade(player); | |
//set the player into the response | |
ca.mb.mlc.ws.playermanagement.RetrievePlayerByIdResponse resp = objFac.createRetrievePlayerByIdResponse(); | |
resp.setWsPlayer(wsPlayer); | |
return resp; | |
} | |
} | |
[ ============= SOAP Call ================] | |
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:play="http://ws.mlc.mb.ca/playerManagement/"> | |
<soapenv:Header/> | |
<soapenv:Body> | |
<play:retrievePlayerById> | |
<play:playerId>99</play:playerId> | |
</play:retrievePlayerById> | |
</soapenv:Body> | |
</soapenv:Envelope> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment