Java源码示例:com.sun.xml.internal.ws.api.model.wsdl.WSDLPort

示例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;
}
 
示例2
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));
}
 
示例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;
}
 
示例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;
}
 
示例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));
}
 
示例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;
}
 
示例7
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());
                }
            }
        }
    }
}
 
示例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);
    }
}
 
示例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;
}
 
示例10
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());
                }
            }
        }
    }
}
 
示例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));

}
 
示例12
/**
 * 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);
 
示例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;
}
 
示例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);
}
 
示例15
/**
 * 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);
 
示例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;
}
 
示例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);
            }
        }
//    }
    }
 
示例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);
}
 
示例19
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);
}
 
示例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;
}
 
示例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);
    }
}
 
示例22
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;
}
 
示例23
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);
}
 
示例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();

}
 
示例25
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();

}
 
示例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() );
}
 
示例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() );
}
 
示例28
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);
}
 
示例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;
}
 
示例30
public WSDLPort getWsdlPort() {
        return wsdlPort;
}