Setting a custom HTTP header dynamically with Spring-WS client

public class AddHttpHeaderInterceptor implements ClientInterceptor { public boolean handleFault(MessageContext messageContext) throws WebServiceClientException { return true; } public boolean handleRequest(MessageContext messageContext) throws WebServiceClientException { TransportContext context = TransportContextHolder.getTransportContext(); HttpComponentsConnection connection =(HttpComponentsConnection) context.getConnection(); connection.addRequestHeader(“name”, “suman”); return true; } public boolean handleResponse(MessageContext messageContext) throws WebServiceClientException { return true; } } config: <bean id=”webServiceTemplate” class=”org.springframework.ws.client.core.WebServiceTemplate”> … <property name=”interceptors”> <list> … Read more

How to add Headers on RESTful call using Jersey Client API

I use the header(name, value) method and give the return to webResource var: Client client = Client.create(); WebResource webResource = client.resource(“uri”); MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl(); queryParams.add(“json”, js); //set parametes for request appKey = “Bearer ” + appKey; // appKey is unique number //Get response from RESTful Server get(ClientResponse.class); ClientResponse response = webResource.queryParams(queryParams) .header(“Content-Type”, … Read more

Authentication issues with WWW-Authenticate: Negotiate

Putting this information here for future readers’ benefit. 401 (Unauthorized) response header -> Request authentication header Here are several WWW-Authenticate response headers. (The full list is at IANA: HTTP Authentication Schemes.) WWW-Authenticate: Basic-> Authorization: Basic + token – Use for basic authentication WWW-Authenticate: NTLM-> Authorization: NTLM + token (2 challenges) WWW-Authenticate: Negotiate -> Authorization: Negotiate … Read more

WPF TabItem Header Styling

Try this style instead, it modifies the template itself. In there you can change everything you need to transparent: <Style TargetType=”{x:Type TabItem}”> <Setter Property=”Template”> <Setter.Value> <ControlTemplate TargetType=”{x:Type TabItem}”> <Grid> <Border Name=”Border” Margin=”0,0,0,0″ Background=”Transparent” BorderBrush=”Black” BorderThickness=”1,1,1,1″ CornerRadius=”5″> <ContentPresenter x:Name=”ContentSite” VerticalAlignment=”Center” HorizontalAlignment=”Center” ContentSource=”Header” Margin=”12,2,12,2″ RecognizesAccessKey=”True”> <ContentPresenter.LayoutTransform> <RotateTransform Angle=”270″ /> </ContentPresenter.LayoutTransform> </ContentPresenter> </Border> </Grid> <ControlTemplate.Triggers> <Trigger Property=”IsSelected” Value=”True”> … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)