325N/A * This class acts as a filter for the Extension elements in the wsa:EndpointReference in the wsdl.
325N/A * In addition to filtering the EPR extensions from WSDL, it adds the extensions configured by the JAX-WS runtime
325N/A if (endpoint.getServiceName().getLocalPart().equals(serviceName) && endpoint.getPortName().getLocalPart().equals(portName))
325N/A //check if it is run in a Java EE Container and get hold of other endpoints in the application
325N/A if (wse.getServiceName().getLocalPart().equals(serviceName) && wse.getPortName().getLocalPart().equals(portName)) {
325N/A public XMLStreamWriter filter(SDDocument doc, XMLStreamWriter w) throws XMLStreamException, IOException {
325N/A return new XMLStreamWriterFilter(w) {
325N/A private boolean portHasEPR = false;
325N/A private int eprDepth = -1; // -1 -> outside wsa:epr, 0 -> on wsa:epr start/end , > 0 inside wsa:epr
325N/A private boolean onService = false; //flag to get service name when on wsdl:service element start
325N/A private int serviceDepth = -1; // -1 -> outside wsdl:service, 0 -> on wsdl:service start/end , > 0 inside wsdl:service
325N/A private int portDepth = -1; // -1 -> outside wsdl:port, 0 -> on wsdl:port start/end , > 0 inside wsdl:port
325N/A private String portAddress; // when a complete epr is written, endpoint address is used as epr address
325N/A private boolean onPortAddress = false; //flag to get endpoint address when on soap:address element start
325N/A private void handleStartElement(String localName, String namespaceURI) throws XMLStreamException {
325N/A if (namespaceURI.equals(WSDLConstants.QNAME_SERVICE.getNamespaceURI()) && localName.equals(WSDLConstants.QNAME_SERVICE.getLocalPart())) {
325N/A } else if (namespaceURI.equals(WSDLConstants.QNAME_PORT.getNamespaceURI()) && localName.equals(WSDLConstants.QNAME_PORT.getLocalPart())) {
325N/A } else if (namespaceURI.equals(W3CAddressingConstants.WSA_NAMESPACE_NAME) && localName.equals("EndpointReference")) {
325N/A portHasEPR = true;
325N/A } else if ((namespaceURI.equals(WSDLConstants.NS_SOAP_BINDING_ADDRESS.getNamespaceURI()) || namespaceURI.equals(WSDLConstants.NS_SOAP12_BINDING_ADDRESS.getNamespaceURI()))
325N/A onPortAddress = true;
325N/A eprExtnFilterON = true;
325N/A private void resetOnElementFlags() {
325N/A if (onPortAddress) {
325N/A onPortAddress = false;
325N/A private void writeEPRExtensions(Collection<WSEndpointReference.EPRExtension> eprExtns) throws XMLStreamException {
325N/A public void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException {
325N/A if (!eprExtnFilterON) {
325N/A public void writeStartElement(String namespaceURI, String localName) throws XMLStreamException {
325N/A if (!eprExtnFilterON) {
325N/A if (!eprExtnFilterON) {
325N/A writer.writeStartElement(AddressingVersion.W3C.getPrefix(),"EndpointReference", AddressingVersion.W3C.nsUri );
325N/A writer.writeStartElement(AddressingVersion.W3C.getPrefix(), AddressingVersion.W3C.eprType.address, AddressingVersion.W3C.nsUri);
325N/A eprExtnFilterON = false;
325N/A portHasEPR = false;
325N/A if (!eprExtnFilterON) {
325N/A super.writeEndElement();
325N/A public void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException {
325N/A if (!eprExtnFilterON) {
325N/A public void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException {
325N/A if (!eprExtnFilterON) {
325N/A if (!eprExtnFilterON) {
325N/A public void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException {
325N/A if (!eprExtnFilterON) {
325N/A if (!eprExtnFilterON) {
325N/A if (!eprExtnFilterON) {
325N/A if (!eprExtnFilterON) {
325N/A if (!eprExtnFilterON) {
325N/A public void writeProcessingInstruction(String target, String data) throws XMLStreamException {
325N/A if (!eprExtnFilterON) {
325N/A public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException {
325N/A if (!eprExtnFilterON) {
325N/A if (!eprExtnFilterON) {
325N/A if (!eprExtnFilterON) {
325N/A if (!eprExtnFilterON) {
325N/A if (!eprExtnFilterON) {
325N/A if (!eprExtnFilterON) {
325N/A if (!eprExtnFilterON) {
325N/A if (!eprExtnFilterON) {
325N/A if (!eprExtnFilterON) {
325N/A if (!eprExtnFilterON) {