Object port = service.getPort(qname, c); WSBindingProvider bp = (WSBindingProvider) port; // Manually set connection timeouts as we seem to hit them during IT testing Map<String, Object> requestContext = bp.getRequestContext(); requestContext.put(BindingProviderProperties.REQUEST_TIMEOUT, env.getProperty("timeout")); requestContext.put(BindingProviderProperties.CONNECT_TIMEOUT, env.getProperty("timeout"));
/** * The pipeline is created for this {@link com.sun.xml.ws.api.client.WSPortInfo}. * Nullable incase of backwards compatible usages of this class. */ public @Nullable WSPortInfo getPortInfo() { return bindingProvider == null? null: bindingProvider.getPortInfo(); }
/** * @param binding the binding to configure * @param bindingConfig the config to apply to the binding */ void configurePartnerBinding(Soap binding, BindingConfig bindingConfig) { WSBindingProvider wsBindingProvider = (WSBindingProvider) binding; this.configureRequestContextConnectionParams(wsBindingProvider); // Set the endpoint URL wsBindingProvider.getRequestContext() .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, bindingConfig.getPartnerServerUrl()); // Set the session Id in the header SessionHeader sessionHeader = new SessionHeader(); sessionHeader.setSessionId(bindingConfig.getSessionId()); // now that login is done, add both the session id header and the client id header // (callOpts) List<Header> headers = new ArrayList<Header>(); final CallOptions callOptions = new CallOptions(); callOptions.setClient(this.partnerKey); headers.add(Headers.create(this.partnerJaxbContext, sessionHeader)); headers.add(Headers.create(this.partnerJaxbContext, callOptions)); wsBindingProvider.setOutboundHeaders(headers); }
Binding bType = bp.getBinding(); NameValuePairDescriptor next = (NameValuePairDescriptor) iter.next(); bp.getRequestContext().put(next.getName(), next.getValue());
((WSBindingProvider) aPort).setOutboundHeaders (aHeaders); ((WSBindingProvider) aPort).setOutboundHeaders (aHeaders);
ExecuteAnonymousResult result = binding.executeAnonymous(param); HeaderList headers = (HeaderList) ((WSBindingProvider) binding).getResponseContext() .get(JAXWSProperties.INBOUND_HEADER_LIST_PROPERTY);
/** * Set up a metadata binding for use. * * @param metadataBinding the binding to configure * @param bindingConfig the config data to apply */ void configureMetadataBinding(@Nonnull MetadataPortType metadataBinding, @Nonnull BindingConfig bindingConfig) { WSBindingProvider metadataWsBindingProvider = (WSBindingProvider) metadataBinding; this.configureRequestContextConnectionParams(metadataWsBindingProvider); // Set the session Id in the header com.palominolabs.crm.sf.soap.jaxwsstub.metadata.SessionHeader sessionHeader = new com.palominolabs.crm.sf.soap.jaxwsstub.metadata.SessionHeader(); sessionHeader.setSessionId(bindingConfig.getSessionId()); List<Header> headers = new ArrayList<Header>(); com.palominolabs.crm.sf.soap.jaxwsstub.metadata.CallOptions metadataCallOpts = new com.palominolabs.crm.sf.soap.jaxwsstub.metadata.CallOptions(); metadataCallOpts.setClient(this.partnerKey); headers.add(Headers.create(this.metadataJaxbContext, sessionHeader)); headers.add(Headers.create(this.metadataJaxbContext, metadataCallOpts)); metadataWsBindingProvider.setOutboundHeaders(headers); metadataWsBindingProvider.getRequestContext() .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, bindingConfig.getMetadataServerUrl()); logger.exit("User " + bindingConfig.getUsername() + ", session id " + bindingConfig.getSessionId() + " on metadata server" + bindingConfig.getMetadataServerUrl()); }
wsBindingProvider.getRequestContext() .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, SANDBOX_INITIAL_ENDPOINT); } else { wsBindingProvider.getRequestContext() .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, NORMAL_INITIAL_ENDPOINT); wsBindingProvider.getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY)); wsBindingProvider.setOutboundHeaders(Headers.create(this.partnerJaxbContext, callOpts)); this.configureRequestContextConnectionParams(wsBindingProvider);
/** * Set GZIP compression headers and timeouts * * @param wsBindingProvider the binding to adjust */ private void configureRequestContextConnectionParams(@Nonnull WSBindingProvider wsBindingProvider) { Map<String, List<String>> httpHeaders = new HashMap<String, List<String>>(); httpHeaders.put("Content-Encoding", Collections.singletonList("gzip")); httpHeaders.put("Accept-Encoding", Collections.singletonList("gzip")); wsBindingProvider.getRequestContext().put(MessageContext.HTTP_REQUEST_HEADERS, httpHeaders); // timeouts in millis int connectTimeout = 10 * 1000; // 10 min read timeout; count() call can take several minutes int readTimeout = 10 * 60 * 1000; wsBindingProvider.getRequestContext().put(JAXWSProperties.CONNECT_TIMEOUT, connectTimeout); wsBindingProvider.getRequestContext().put(JAXWSProperties.REQUEST_TIMEOUT, readTimeout); } }
/** * The pipeline is created for this {@link com.sun.xml.ws.api.client.WSPortInfo}. * Nullable incase of backwards compatible usages of this class. */ public @Nullable WSPortInfo getPortInfo() { return bindingProvider == null? null: bindingProvider.getPortInfo(); }
void configureApexBinding(ApexPortType binding, BindingConfig bindingConfig) { WSBindingProvider apexWsBindingProvider = (WSBindingProvider) binding; this.configureRequestContextConnectionParams(apexWsBindingProvider); // Set the session Id in the header com.palominolabs.crm.sf.soap.jaxwsstub.apex.SessionHeader sessionHeader = new com.palominolabs.crm.sf.soap.jaxwsstub.apex.SessionHeader(); sessionHeader.setSessionId(bindingConfig.getSessionId()); List<Header> headers = new ArrayList<Header>(); com.palominolabs.crm.sf.soap.jaxwsstub.apex.CallOptions apexCallOpts = new com.palominolabs.crm.sf.soap.jaxwsstub.apex.CallOptions(); apexCallOpts.setClient(this.partnerKey); DebuggingHeader apexDebug = new DebuggingHeader(); apexDebug.setDebugLevel(LogType.PROFILING); for (LogCategory category : LogCategory.values()) { LogInfo logInfo = new LogInfo(); logInfo.setCategory(category); logInfo.setLevel(LogCategoryLevel.DEBUG); apexDebug.getCategories().add(logInfo); } headers.add(Headers.create(this.apexJaxbContext, sessionHeader)); headers.add(Headers.create(this.apexJaxbContext, apexCallOpts)); headers.add(Headers.create(this.apexJaxbContext, apexDebug)); apexWsBindingProvider.setOutboundHeaders(headers); apexWsBindingProvider.getRequestContext() .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, bindingConfig.getApexServerUrl()); logger.exit("User " + bindingConfig.getUsername() + ", session id " + bindingConfig.getSessionId() + " on apex server" + bindingConfig.getApexServerUrl()); }
//This is the input object for the webservice GetDocumentInfoInput input = new GetDocumentInfoInput(); input.setBarcode(barcode); //I instantiate the WS MAKSpcIntSpcWFSpcScannerInfo_Service service = new MAKSpcIntSpcWFSpcScannerInfo_Service(); //I get the WS port MAKSpcIntSpcWFSpcScannerInfo port = service.getMAKSpcIntSpcWFSpcScannerInfo(); WSBindingProvider provider = (WSBindingProvider)port; //This is the row what set the URL for the WS provider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url); //This is the WS calling GetDocumentInfoOutput output = port.getDocumentInfo(input);
/** * The pipeline is created for this {@link com.sun.xml.ws.api.client.WSPortInfo}. * Nullable incase of backwards compatible usages of this class. */ public @Nullable WSPortInfo getPortInfo() { return bindingProvider == null? null: bindingProvider.getPortInfo(); }
/** * This constructor should be used only by JAX-WS Runtime and is not meant for external consumption. * * @since JAX-WS 2.2 */ public ClientTubeAssemblerContext(@NotNull EndpointAddress address, @Nullable WSDLPort wsdlModel, @NotNull WSBindingProvider bindingProvider, @NotNull WSBinding binding, @NotNull Container container, Codec codec, SEIModel seiModel, Class sei) { this(address, wsdlModel, (bindingProvider==null? null: bindingProvider.getPortInfo().getOwner()), bindingProvider, binding, container, codec, seiModel, sei); }
/** * This constructor should be used only by JAX-WS Runtime and is not meant for external consumption. * * @since JAX-WS 2.2 */ public ClientTubeAssemblerContext(@NotNull EndpointAddress address, @Nullable WSDLPort wsdlModel, @NotNull WSBindingProvider bindingProvider, @NotNull WSBinding binding, @NotNull Container container, Codec codec, SEIModel seiModel, Class sei) { this(address, wsdlModel, (bindingProvider==null? null: bindingProvider.getPortInfo().getOwner()), bindingProvider, binding, container, codec, seiModel, sei); }
/** * This constructor should be used only by JAX-WS Runtime and is not meant for external consumption. * * @since JAX-WS 2.2 */ public ClientTubeAssemblerContext(@NotNull EndpointAddress address, @Nullable WSDLPort wsdlModel, @NotNull WSBindingProvider bindingProvider, @NotNull WSBinding binding, @NotNull Container container, Codec codec, SEIModel seiModel, Class sei) { this(address, wsdlModel, (bindingProvider==null? null: bindingProvider.getPortInfo().getOwner()), bindingProvider, binding, container, codec, seiModel, sei); }