Java Code Examples for com.sun.xml.internal.ws.api.model.wsdl.WSDLPort

The following examples show how to use com.sun.xml.internal.ws.api.model.wsdl.WSDLPort. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
public Builder property(String name, Object value) {
    config.properties().put(name, value);
    if (isfor(BindingID.class, name, value)) {
        config.getMappingInfo().setBindingID((BindingID)value);
    }
    if (isfor(WSBinding.class, name, value)) {
        config.setWSBinding((WSBinding)value);
    }
    if (isfor(WSDLPort.class, name, value)) {
        config.setWsdlPort((WSDLPort)value);
    }
    if (isfor(MetadataReader.class, name, value)) {
        config.setMetadataReader((MetadataReader)value);
    }
    return this;
}
 
Example 2
Source Project: openjdk-8-source   Source File: Packet.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void populateAddressingHeaders(WSBinding binding, Packet responsePacket, WSDLPort wsdlPort, SEIModel seiModel) {
    AddressingVersion addressingVersion = binding.getAddressingVersion();

    if (addressingVersion == null) {
        return;
    }

    WsaTubeHelper wsaHelper = addressingVersion.getWsaHelper(wsdlPort, seiModel, binding);
    String action = responsePacket.getMessage().isFault() ?
            wsaHelper.getFaultAction(this, responsePacket) :
            wsaHelper.getOutputAction(this);
    if (action == null) {
        LOGGER.info("WSA headers are not added as value for wsa:Action cannot be resolved for this message");
        return;
    }
    populateAddressingHeaders(responsePacket, addressingVersion, binding.getSOAPVersion(), action, AddressingVersion.isRequired(binding));
}
 
Example 3
@Override
protected Packet getResponse(Packet request, @Nullable SOAPMessage returnValue, WSDLPort port, WSBinding binding) {
    Packet response = super.getResponse(request, returnValue, port, binding);
    // Populate SOAPMessage's transport headers
    if (returnValue != null && response.supports(Packet.OUTBOUND_TRANSPORT_HEADERS)) {
        MimeHeaders hdrs = returnValue.getMimeHeaders();
        Map<String, List<String>> headers = new HashMap<String, List<String>>();
        Iterator i = hdrs.getAllHeaders();
        while(i.hasNext()) {
            MimeHeader header = (MimeHeader)i.next();
            if(header.getName().equalsIgnoreCase("SOAPAction"))
                // SAAJ sets this header automatically, but it interferes with the correct operation of JAX-WS.
                // so ignore this header.
                continue;

            List<String> list = headers.get(header.getName());
            if (list == null) {
                list = new ArrayList<String>();
                headers.put(header.getName(), list);
            }
            list.add(header.getValue());
        }
        response.put(Packet.OUTBOUND_TRANSPORT_HEADERS, headers);
    }
    return response;
}
 
Example 4
public Builder property(String name, Object value) {
    config.properties().put(name, value);
    if (isfor(BindingID.class, name, value)) {
        config.getMappingInfo().setBindingID((BindingID)value);
    }
    if (isfor(WSBinding.class, name, value)) {
        config.setWSBinding((WSBinding)value);
    }
    if (isfor(WSDLPort.class, name, value)) {
        config.setWsdlPort((WSDLPort)value);
    }
    if (isfor(MetadataReader.class, name, value)) {
        config.setMetadataReader((MetadataReader)value);
    }
    return this;
}
 
Example 5
public <T> T getPort(QName portName, Class<T> portInterface, WebServiceFeature... features) {
    if (portName == null || portInterface == null)
        throw new IllegalArgumentException();
    WSDLService tWsdlService = this.wsdlService;
    if (tWsdlService == null) {
        // assigning it to local variable and not setting it back to this.wsdlService intentionally
        // as we don't want to include the service instance with information gathered from sei
        tWsdlService = getWSDLModelfromSEI(portInterface);
        //still null? throw error need wsdl metadata to create a proxy
        if (tWsdlService == null) {
            throw new WebServiceException(ProviderApiMessages.NO_WSDL_NO_PORT(portInterface.getName()));
        }

    }
    WSDLPort portModel = getPortModel(tWsdlService, portName);
    return getPort(portModel.getEPR(), portName, portInterface, new WebServiceFeatureList(features));
}
 
Example 6
public Builder property(String name, Object value) {
    config.properties().put(name, value);
    if (isfor(BindingID.class, name, value)) {
        config.getMappingInfo().setBindingID((BindingID)value);
    }
    if (isfor(WSBinding.class, name, value)) {
        config.setWSBinding((WSBinding)value);
    }
    if (isfor(WSDLPort.class, name, value)) {
        config.setWsdlPort((WSDLPort)value);
    }
    if (isfor(MetadataReader.class, name, value)) {
        config.setMetadataReader((MetadataReader)value);
    }
    return this;
}
 
Example 7
Source Project: openjdk-8   Source File: JavaMethodImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
void freeze(WSDLPort portType) {
    this.wsdlOperation = portType.getBinding().get(new QName(portType.getBinding().getPortType().getName().getNamespaceURI(),getOperationName()));
    // TODO: replace this with proper error handling
    if(wsdlOperation ==null)
        throw new WebServiceException("Method "+seiMethod.getName()+" is exposed as WebMethod, but there is no corresponding wsdl operation with name "+operationName+" in the wsdl:portType" + portType.getBinding().getPortType().getName());

    //so far, the inputAction, outputAction and fault actions are set from the @Action and @FaultAction
    //set the values from WSDLModel, if such annotations are not present or defaulted
    if(inputAction.equals("")) {
            inputAction = wsdlOperation.getOperation().getInput().getAction();
    } else if(!inputAction.equals(wsdlOperation.getOperation().getInput().getAction()))
            //TODO input action might be from @Action or WebMethod(action)
            LOGGER.warning("Input Action on WSDL operation "+wsdlOperation.getName().getLocalPart() + " and @Action on its associated Web Method " + seiMethod.getName() +" did not match and will cause problems in dispatching the requests");

    if (!mep.isOneWay()) {
        if (outputAction.equals(""))
            outputAction = wsdlOperation.getOperation().getOutput().getAction();

        for (CheckedExceptionImpl ce : exceptions) {
            if (ce.getFaultAction().equals("")) {
                QName detailQName = ce.getDetailType().tagName;
                WSDLFault wsdlfault = wsdlOperation.getOperation().getFault(detailQName);
                if(wsdlfault == null) {
                    // mismatch between wsdl model and SEI model, log a warning and use  SEI model for Action determination
                    LOGGER.warning("Mismatch between Java model and WSDL model found, For wsdl operation " +
                            wsdlOperation.getName() + ",There is no matching wsdl fault with detail QName " +
                            ce.getDetailType().tagName);
                    ce.setFaultAction(ce.getDefaultFaultAction());
                } else {
                    ce.setFaultAction(wsdlfault.getAction());
                }
            }
        }
    }
}
 
Example 8
/**
 * Link {@link SEIModel} to {@link WSDLModel}.
 * Merge it with {@link #postProcess()}.
 */
public void freeze(WSDLPort port) {
    this.port = port;
    for (JavaMethodImpl m : javaMethods) {
        m.freeze(port);
        putOp(m.getOperationQName(),m);

    }
    if (databinding != null) {
        ((com.sun.xml.internal.ws.db.DatabindingImpl)databinding).freeze(port);
    }
}
 
Example 9
public ServerSchemaValidationTube(WSEndpoint endpoint, WSBinding binding,
        SEIModel seiModel, WSDLPort wsdlPort, Tube next) {
    super(binding, next);
    this.seiModel = seiModel;
    this.wsdlPort = wsdlPort;

    if (endpoint.getServiceDefinition() != null) {
        MetadataResolverImpl mdresolver = new MetadataResolverImpl(endpoint.getServiceDefinition());
        Source[] sources = getSchemaSources(endpoint.getServiceDefinition(), mdresolver);
        for(Source source : sources) {
            LOGGER.fine("Constructing service validation schema from = "+source.getSystemId());
            //printDOM((DOMSource)source);
        }
        if (sources.length != 0) {
            noValidation = false;
            sf.setResourceResolver(mdresolver);
            try {
                schema = sf.newSchema(sources);
            } catch(SAXException e) {
                throw new WebServiceException(e);
            }
            validator = schema.newValidator();
            return;
        }
    }
    noValidation = true;
    schema = null;
    validator = null;
}
 
Example 10
Source Project: hottub   Source File: JavaMethodImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
void freeze(WSDLPort portType) {
    this.wsdlOperation = portType.getBinding().get(new QName(portType.getBinding().getPortType().getName().getNamespaceURI(),getOperationName()));
    // TODO: replace this with proper error handling
    if(wsdlOperation ==null)
        throw new WebServiceException("Method "+seiMethod.getName()+" is exposed as WebMethod, but there is no corresponding wsdl operation with name "+operationName+" in the wsdl:portType" + portType.getBinding().getPortType().getName());

    //so far, the inputAction, outputAction and fault actions are set from the @Action and @FaultAction
    //set the values from WSDLModel, if such annotations are not present or defaulted
    if(inputAction.equals("")) {
            inputAction = wsdlOperation.getOperation().getInput().getAction();
    } else if(!inputAction.equals(wsdlOperation.getOperation().getInput().getAction()))
            //TODO input action might be from @Action or WebMethod(action)
            LOGGER.warning("Input Action on WSDL operation "+wsdlOperation.getName().getLocalPart() + " and @Action on its associated Web Method " + seiMethod.getName() +" did not match and will cause problems in dispatching the requests");

    if (!mep.isOneWay()) {
        if (outputAction.equals(""))
            outputAction = wsdlOperation.getOperation().getOutput().getAction();

        for (CheckedExceptionImpl ce : exceptions) {
            if (ce.getFaultAction().equals("")) {
                QName detailQName = ce.getDetailType().tagName;
                WSDLFault wsdlfault = wsdlOperation.getOperation().getFault(detailQName);
                if(wsdlfault == null) {
                    // mismatch between wsdl model and SEI model, log a warning and use  SEI model for Action determination
                    LOGGER.warning("Mismatch between Java model and WSDL model found, For wsdl operation " +
                            wsdlOperation.getName() + ",There is no matching wsdl fault with detail QName " +
                            ce.getDetailType().tagName);
                    ce.setFaultAction(ce.getDefaultFaultAction());
                } else {
                    ce.setFaultAction(wsdlfault.getAction());
                }
            }
        }
    }
}
 
Example 11
public OperationDispatcher(@NotNull WSDLPort wsdlModel, @NotNull WSBinding binding, @Nullable SEIModel seiModel) {
    this.binding = binding;
    opFinders = new ArrayList<WSDLOperationFinder>();
    if (binding.getAddressingVersion() != null) {
        opFinders.add(new ActionBasedOperationFinder(wsdlModel, binding, seiModel));
    }
    opFinders.add(new PayloadQNameBasedOperationFinder(wsdlModel, binding, seiModel));
    opFinders.add(new SOAPActionBasedOperationFinder(wsdlModel, binding, seiModel));

}
 
Example 12
Source Project: openjdk-jdk9   Source File: WSEndpoint.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * This is used by WsaServerTube and WSEndpointImpl to create a Packet with SOAPFault message from a Java exception.
 */
public abstract Packet createServiceResponseForException(final ThrowableContainerPropertySet tc,
                                                         final Packet      responsePacket,
                                                         final SOAPVersion soapVersion,
                                                         final WSDLPort    wsdlPort,
                                                         final SEIModel    seiModel,
                                                         final WSBinding   binding);
 
Example 13
public ClientSchemaValidationTube(WSBinding binding, WSDLPort port, Tube next) {
    super(binding, next);
    this.port = port;
    if (port != null) {
        String primaryWsdl = port.getOwner().getParent().getLocation().getSystemId();
        MetadataResolverImpl mdresolver = new MetadataResolverImpl();
        Map<String, SDDocument> docs = MetadataUtil.getMetadataClosure(primaryWsdl, mdresolver, true);
        mdresolver = new MetadataResolverImpl(docs.values());
        Source[] sources = getSchemaSources(docs.values(), mdresolver);
        for(Source source : sources) {
            LOGGER.fine("Constructing client validation schema from = "+source.getSystemId());
            //printDOM((DOMSource)source);
        }
        if (sources.length != 0) {
            noValidation = false;
            sf.setResourceResolver(mdresolver);
            try {
                schema = sf.newSchema(sources);
            } catch(SAXException e) {
                throw new WebServiceException(e);
            }
            validator = schema.newValidator();
            return;
        }
    }
    noValidation = true;
    schema = null;
    validator = null;
}
 
Example 14
/**
 * Lists up the port names in WSDL. For error diagnostics.
 */
private StringBuilder buildWsdlPortNames() {
    Set<QName> wsdlPortNames = new HashSet<QName>();
    for (WSDLPort port : wsdlService.getPorts()) {
        wsdlPortNames.add(port.getName());
    }
    return buildNameList(wsdlPortNames);
}
 
Example 15
Source Project: openjdk-jdk8u   Source File: WSEndpoint.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * This is used by WsaServerTube and WSEndpointImpl to create a Packet with SOAPFault message from a Java exception.
 */
public abstract Packet createServiceResponseForException(final ThrowableContainerPropertySet tc,
                                                         final Packet      responsePacket,
                                                         final SOAPVersion soapVersion,
                                                         final WSDLPort    wsdlPort,
                                                         final SEIModel    seiModel,
                                                         final WSBinding   binding);
 
Example 16
/**
 * Creates {@link Packet} from method invocation's return value
 */
protected Packet getResponse(Packet request, @Nullable T returnValue, WSDLPort port, WSBinding binding) {
    Message message = null;
    if (returnValue != null) {
        message = getResponseMessage(returnValue);
    }
    Packet response = request.createServerResponse(message,port,null,binding);
    return response;
}
 
Example 17
public DatabindingImpl(DatabindingProviderImpl p, DatabindingConfig config) {
        RuntimeModeler modeler = new RuntimeModeler(config);
        modeler.setClassLoader(config.getClassLoader());
        seiModel = modeler.buildRuntimeModel();
        WSDLPort wsdlport = config.getWsdlPort();
        packetFactory = new MessageContextFactory(seiModel.getWSBinding().getFeatures());
        clientConfig = isClientConfig(config);
        if (clientConfig) {
            initStubHandlers();
        }
        seiModel.setDatabinding(this);
        if (wsdlport != null) {
            freeze(wsdlport);
        }
        if (operationDispatcher == null) {
            operationDispatcherNoWsdl = new OperationDispatcher(null, seiModel.getWSBinding(), seiModel);
        }
//    if(!clientConfig) {
        for (JavaMethodImpl jm : seiModel.getJavaMethods()) {
            if (!jm.isAsync()) {
                TieHandler th = new TieHandler(jm, seiModel.getWSBinding(), packetFactory);
                wsdlOpMap.put(jm, th);
                tieHandlers.put(th.getMethod(), th);
            }
        }
//    }
    }
 
Example 18
protected WSEndpointImpl(@NotNull QName serviceName, @NotNull QName portName, WSBinding binding, Container container,
                      SEIModel seiModel, WSDLPort port,
                      Tube masterTubeline) {
              this.serviceName = serviceName;
              this.portName = portName;
              this.binding = binding;
              this.soapVersion = binding.getSOAPVersion();
              this.container = container;
              this.endpointPolicy = null;
              this.port = port;
              this.seiModel = seiModel;
              this.serviceDef = null;
              this.implementationClass = null;
              this.masterTubeline = masterTubeline;
              this.masterCodec = ((BindingImpl) this.binding).createCodec();

      LazyMOMProvider.INSTANCE.registerEndpoint(this);
      initManagedObjectManager();

      this.operationDispatcher = (port == null) ? null : new OperationDispatcher(port, binding, seiModel);
          this.context = new ServerPipeAssemblerContext(
              seiModel, port, this, null /* not known */, false);

              tubePool = new TubePool(masterTubeline);
              engine = new Engine(toString(), container);
              wsdlProperties = (port == null) ? new WSDLDirectProperties(serviceName, portName, seiModel) : new WSDLPortProperties(port, seiModel);
}
 
Example 19
Source Project: hottub   Source File: WSEndpointImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected WSEndpointImpl(@NotNull QName serviceName, @NotNull QName portName, WSBinding binding, Container container,
                      SEIModel seiModel, WSDLPort port,
                      Tube masterTubeline) {
              this.serviceName = serviceName;
              this.portName = portName;
              this.binding = binding;
              this.soapVersion = binding.getSOAPVersion();
              this.container = container;
              this.endpointPolicy = null;
              this.port = port;
              this.seiModel = seiModel;
              this.serviceDef = null;
              this.implementationClass = null;
              this.masterTubeline = masterTubeline;
              this.masterCodec = ((BindingImpl) this.binding).createCodec();

      LazyMOMProvider.INSTANCE.registerEndpoint(this);
      initManagedObjectManager();

      this.operationDispatcher = (port == null) ? null : new OperationDispatcher(port, binding, seiModel);
          this.context = new ServerPipeAssemblerContext(
              seiModel, port, this, null /* not known */, false);

              tubePool = new TubePool(masterTubeline);
              engine = new Engine(toString(), container);
              wsdlProperties = (port == null) ? new WSDLDirectProperties(serviceName, portName, seiModel) : new WSDLPortProperties(port, seiModel);
}
 
Example 20
private ClientTubeAssemblerContext(@NotNull EndpointAddress address, @Nullable WSDLPort wsdlModel,
                                   @Nullable WSService rootOwner, @Nullable WSBindingProvider bindingProvider, @NotNull WSBinding binding,
                                  @NotNull Container container, Codec codec, SEIModel seiModel, Class sei) {
    this.address = address;
    this.wsdlModel = wsdlModel;
    this.rootOwner = rootOwner;
    this.bindingProvider = bindingProvider;
    this.binding = binding;
    this.container = container;
    this.codec = codec;
    this.seiModel = seiModel;
    this.sei = sei;
}
 
Example 21
/**
 * Link {@link SEIModel} to {@link WSDLModel}.
 * Merge it with {@link #postProcess()}.
 */
public void freeze(WSDLPort port) {
    this.port = port;
    for (JavaMethodImpl m : javaMethods) {
        m.freeze(port);
        putOp(m.getOperationQName(),m);

    }
    if (databinding != null) {
        ((com.sun.xml.internal.ws.db.DatabindingImpl)databinding).freeze(port);
    }
}
 
Example 22
Source Project: openjdk-jdk8u-backup   Source File: Packet.java    License: GNU General Public License v2.0 5 votes vote down vote up
public Packet relateServerResponse(@Nullable Packet r, @Nullable WSDLPort wsdlPort, @Nullable SEIModel seiModel, @NotNull WSBinding binding) {
    relatePackets(r, false);
    r.setState(State.ServerResponse);
    AddressingVersion av = binding.getAddressingVersion();
    // populate WS-A headers only if WS-A is enabled
    if (av == null) {
        return r;
    }

    if (getMessage() == null) {
        return r;
    }

    //populate WS-A headers only if the request has addressing headers
    String inputAction = AddressingUtils.getAction(getMessage().getHeaders(), av, binding.getSOAPVersion());
    if (inputAction == null) {
        return r;
    }
    // if one-way, then dont populate any WS-A headers
    if (r.getMessage() == null || (wsdlPort != null && getMessage().isOneWay(wsdlPort))) {
        return r;
    }

    // otherwise populate WS-Addressing headers
    populateAddressingHeaders(binding, r, wsdlPort, seiModel);
    return r;
}
 
Example 23
Source Project: openjdk-jdk8u-backup   Source File: WsaTube.java    License: GNU General Public License v2.0 5 votes vote down vote up
public WsaTube(WSDLPort wsdlPort, WSBinding binding, Tube next) {
    super(next);
    this.wsdlPort = wsdlPort;
    this.binding = binding;
    addKnownHeadersToBinding(binding);
    addressingVersion = binding.getAddressingVersion();
    soapVersion = binding.getSOAPVersion();
    helper = getTubeHelper();
    addressingRequired = AddressingVersion.isRequired(binding);
}
 
Example 24
public WsaTubeHelper(WSBinding binding, SEIModel seiModel, WSDLPort wsdlPort) {
    this.binding = binding;
    this.wsdlPort = wsdlPort;
    this.seiModel = seiModel;
    this.soapVer = binding.getSOAPVersion();
    this.addVer = binding.getAddressingVersion();

}
 
Example 25
Source Project: jdk8u60   Source File: WsaTubeHelper.java    License: GNU General Public License v2.0 5 votes vote down vote up
public WsaTubeHelper(WSBinding binding, SEIModel seiModel, WSDLPort wsdlPort) {
    this.binding = binding;
    this.wsdlPort = wsdlPort;
    this.seiModel = seiModel;
    this.soapVer = binding.getSOAPVersion();
    this.addVer = binding.getAddressingVersion();

}
 
Example 26
/**
 * This constructor should be used only by JAX-WS Runtime and is not meant for external consumption.
 * @deprecated
 *      Use {@link #ClientTubeAssemblerContext(EndpointAddress, WSDLPort, WSService, WSBindingProvider, WSBinding, Container, Codec, SEIModel, Class)}
 */
public ClientTubeAssemblerContext(@NotNull EndpointAddress address, @Nullable WSDLPort wsdlModel,
                                  @NotNull WSService rootOwner, @NotNull WSBinding binding,
                                  @NotNull Container container) {
    // WSBinding is actually BindingImpl
    this(address, wsdlModel, rootOwner, binding, container, ((BindingImpl)binding).createCodec() );
}
 
Example 27
/**
 * This constructor should be used only by JAX-WS Runtime and is not meant for external consumption.
 * @deprecated
 *      Use {@link #ClientTubeAssemblerContext(EndpointAddress, WSDLPort, WSService, WSBindingProvider, WSBinding, Container, Codec, SEIModel, Class)}
 */
public ClientTubeAssemblerContext(@NotNull EndpointAddress address, @Nullable WSDLPort wsdlModel,
                                  @NotNull WSService rootOwner, @NotNull WSBinding binding,
                                  @NotNull Container container) {
    // WSBinding is actually BindingImpl
    this(address, wsdlModel, rootOwner, binding, container, ((BindingImpl)binding).createCodec() );
}
 
Example 28
Source Project: openjdk-jdk9   Source File: WsaTube.java    License: GNU General Public License v2.0 5 votes vote down vote up
public WsaTube(WSDLPort wsdlPort, WSBinding binding, Tube next) {
    super(next);
    this.wsdlPort = wsdlPort;
    this.binding = binding;
    addKnownHeadersToBinding(binding);
    addressingVersion = binding.getAddressingVersion();
    soapVersion = binding.getSOAPVersion();
    helper = getTubeHelper();
    addressingRequired = AddressingVersion.isRequired(binding);
}
 
Example 29
private ClientTubeAssemblerContext(@NotNull EndpointAddress address, @Nullable WSDLPort wsdlModel,
                                   @Nullable WSService rootOwner, @Nullable WSBindingProvider bindingProvider, @NotNull WSBinding binding,
                                  @NotNull Container container, Codec codec, SEIModel seiModel, Class sei) {
    this.address = address;
    this.wsdlModel = wsdlModel;
    this.rootOwner = rootOwner;
    this.bindingProvider = bindingProvider;
    this.binding = binding;
    this.container = container;
    this.codec = codec;
    this.seiModel = seiModel;
    this.sei = sei;
}
 
Example 30
public WSDLPort getWsdlPort() {
        return wsdlPort;
}