Infinispan Serialization with Protobuf Problem - infinispan

Using a client/server Infinispan implementation, the write operations use Protobuf serialization, but the load operation is using the java serializer. How can I configure the load to use the Protobuf serialization?
Here is the server and cache config:
<cache-container name="default" statistics="true">
<transport cluster="${infinispan.cluster.name:cluster}" stack="${infinispan.cluster.stack:tcp}" node-name="${infinispan.node.name:}"/>
<security>
<authorization/>
</security>
</cache-container>
<cache-container name="operationnproto" statistics="true">
<serialization>
<context-initializer class="com.bskyb.infinispan.datastores.BookSchemaImpl"/>
</serialization>
<distributed-cache name="distributedCache-operationnproto" owners="2" capacity-factor="1">
<encoding media-type="application/x-protostream"/>
<persistence>
<store class="com.bskyb.infinispan.datastores.BookCacheStore">
<property name="lbCassandraCluster"></property>
<property name="lbCassandraPort"></property>
<property name="lbCassandraDatacenter">datacenter1</property>
</store>
</persistence>
</distributed-cache>

Related

How to disable GZIP compression on Wildfly 10?

To be able to display the download status in a java application, I need to disable GZIP compression on a wildfly 10 server. It seems to be enabled by default. I found a lot of pages on how to enable it, nothing to disable it. Any clue ?
EDIT
I tried removing completely gzip filter from config as you can see below. The files I download (3 MB) are still compressed during transfert
<subsystem xmlns="urn:jboss:domain:undertow:3.1" statistics-enabled="true">
<buffer-cache name="default"/>
<server name="default-server">
<http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>
<https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<filter-ref name="server-header"/>
<filter-ref name="x-powered-by-header"/>
</host>
</server>
<servlet-container name="default">
<jsp-config/>
<websockets/>
</servlet-container>
<handlers>
<file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
</handlers>
<filters>
<response-header name="server-header" header-name="Server" header-value="WildFly/10"/>
<response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
</filters>
</subsystem>

IIS Express with SSL and friendly name

I set up my localhost site for my project following this procedure:
https://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx
My applicationhost.config looks like this:
<site name="ProjectName.Web" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\myUserName\Source\Repos\SolutionName\ProjectName.Web" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:51415:localhost" />
<binding protocol="https" bindingInformation="*:44342:localhost" />
<binding protocol="http" bindingInformation="*:80:myPC.myDomain.com" />
<binding protocol="https" bindingInformation="*:443:myPC.myDomain.com" />
</bindings>
</site>
I reviewed this post also: Why does SSL 443 fail to work in IIS Express for custom domains of Visual Studio web projects?
Still get this:
This site can’t be reached
The connection was reset.
How can I debug this issue?

Where to configure NLog NHibernate bridge for logging sql configuration?

As a proof-of-concept I am using a console application wrapping a proxy of a WCF service. I execute a few calls through the proxy and write the results to the console. Underlying the WCF service is a Data Access Layer built on the Repository pattern using NHibernate as an ORM. I want to write the NHib-generated SQL to the console.
I have attempted to configure NLog using the NuGet package and guidance from here with no luck, but I suspect perhaps I don't properly understand where I need to perform these different configuration bits in my many-layered architecture. Here's an attempt at describing my layout:
Solution
|
-- WCF Service
|
-- DAL
| | (NHibernate is used here)
| -- hibernate.cfg.xml
| NLog.config
| App.config (r)
-- WCF Client (console app)
|
--App.config (c)
hibernate.cfg.xml contents:
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="dialect">NHibernate.Dialect.MsSql2012Dialect</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="show_sql">true</property>
<property name="connection.connection_string">Data Source=.\SQLEXPRESS;Initial Catalog=AdventureWorks2012;User ID=**;Password=********</property>
</session-factory>
</hibernate-configuration>
NLog.config contents:
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="trace" type="Trace" />
</targets>
<rules>
<logger name="NHibernate.SQL" writeTo="trace" />
</rules>
</nlog>
App.config (r) contents:
<configuration>
<appSettings>
<add key="nhibernate-logger" value="NHibernate.NLogLoggerFactory, NHibernate.NLog" />
</appSettings>
</configuration>
App.config (c) contents:
<configuration>
<system.diagnostics>
<trace autoflush="true">
<listeners>
<add name="consoleListener" type="System.Diagnostics.ConsoleTraceListener" />
</listeners>
</trace>
</system.diagnostics>
<appSettings>
<add key="nhibernate-logger" value="NHibernate.NLogLoggerFactory, NHibernate.NLog" />
</appSettings>
</configuration>
My NUnit unit tests are displaying the SQL Statements, so the show-sql instruction in hibernate.cfg.xml is working correctly. If I insert a Trace.WriteLine() in my console app that shows up in the console, so (I expect) anything written to Trace ought to show up there. But I do not see any SQL in the console.
I'm assuming that I've placed some of my .config instructions in the wrong layers of my app, but where?

API for WSO2 API Manager

Is there an API for WSO2 API Manager that I can consume? As in say, get a list of the API's or whatever. I heard there is a SOAP API for this, but I cannot find anything about it. I'm hoping someone has got some information. I found this XML file (listed below) that may or may not be what I need but I'm a total noob when it comes to SOAP and don't know of this what I need. Here's the file contents. Is this what a WSDL file would look like?
<?xml version="1.0" encoding="UTF-8"?><serviceGroup name="API" successfullyAdded="true">
<service name="API" exposedAllTransports="true" serviceDeployedTime="1347567758279" successfullyAdded="true">
<operation name="getAPI">
<parameter name="AuthorizationAction">/permission/admin/manage/resources/govern/apis/list</parameter>
<module name="addressing" version="4.0" type="engagedModules"/>
<module name="relay" version="4.0" type="engagedModules"/>
</operation>
<operation name="updateAPI">
<parameter name="AuthorizationAction">/permission/admin/manage/resources/govern/apis/add</parameter>
<module name="addressing" version="4.0" type="engagedModules"/>
<module name="relay" version="4.0" type="engagedModules"/>
</operation>
<operation name="getAPIDependencies">
<parameter name="AuthorizationAction">/permission/admin/manage/resources/govern/apis/list</parameter>
<module name="addressing" version="4.0" type="engagedModules"/>
<module name="relay" version="4.0" type="engagedModules"/>
</operation>
<operation name="addAPI">
<parameter name="AuthorizationAction">/permission/admin/manage/resources/govern/apis/add</parameter>
<module name="addressing" version="4.0" type="engagedModules"/>
<module name="relay" version="4.0" type="engagedModules"/>
</operation>
<operation name="getAPIArtifactIDs">
<parameter name="AuthorizationAction">/permission/admin/manage/resources/govern/apis/list</parameter>
<module name="addressing" version="4.0" type="engagedModules"/>
<module name="relay" version="4.0" type="engagedModules"/>
</operation>
<operation name="deleteAPI">
<parameter name="AuthorizationAction">/permission/admin/manage/resources/govern/apis/add</parameter>
<module name="addressing" version="4.0" type="engagedModules"/>
<module name="relay" version="4.0" type="engagedModules"/>
</operation>
<bindings>
<binding name="APISoap12Binding">
<operation name="getAPI"/>
<operation name="updateAPI"/>
<operation name="getAPIDependencies"/>
<operation name="addAPI"/>
<operation name="deleteAPI"/>
<operation name="getAPIArtifactIDs"/>
</binding>
<binding name="APIHttpBinding">
<operation name="getAPI"/>
<operation name="updateAPI"/>
<operation name="getAPIDependencies"/>
<operation name="addAPI"/>
<operation name="deleteAPI"/>
<operation name="getAPIArtifactIDs"/>
</binding>
<binding name="APISoap11Binding">
<operation name="getAPI"/>
<operation name="updateAPI"/>
<operation name="getAPIDependencies"/>
<operation name="addAPI"/>
<operation name="deleteAPI"/>
<operation name="getAPIArtifactIDs"/>
</binding>
</bindings>
<policies/>
<module name="addressing" version="4.0" type="engagedModules"/>
<module name="relay" version="4.0" type="engagedModules"/>
<parameter name="enableMTOM">true</parameter>
<parameter name="adminService">true</parameter>
<parameter name="AuthorizationAction">/permission/admin/login</parameter>
<parameter name="hiddenService">true</parameter>
</service>
</serviceGroup>
Yes,there's a javascript API layer built with Jaggery which can be used to consume API Manager related functionalities in a REST way.
Currently,you can find them inside the two jaggery applications [store/publisher] with following location.Navigate to it,and you'll notice there are several sub-directories inside 'blocks' directory according to the terms that api manager related functionalities catogorized [eg:item-add,listing,search,etc].Open the reuired catogory and there will be a sub folder called 'ajax' since we are passing requests in AJAX way.Inside that you can find the jag file which contains the relevant API methods that can be consume in a REST way.
Yet we have not separate this API layer from the web-application flow to make a user easy to find and consume the API,but we are planning to add this API layer separate in to the apps in near future.
For the moment,what you can do is just go to the above mentioned location,and find the relevant API method to consume.Say for an example if you want to consume addAPI method in api-publisher,what you can do is navigate to 'ajax' sub-directory of'item-add' directory in the location .You'll see there's a file called 'add.jag'.Open it and identify what is the action[eg:addAPI] and what are the request parameters[eg:APIName,version,etc] you need to pass to process the action.Then send http request to the API function by using a REST client.[eg:CURL].For example here your http request will be following way.
"http://ip:port/publisher/site/blocks/item-add/ajax/add.jag -d "action=addAPI&name=API1&version=1.0.0&description=API&endpoint=http://search.twitter.com&wsdl=&tags=open,social&tier=Silver&thumbUrl=https://lh6.ggpht.com/RNc8dD2hXG_rWGzlj09ZwAe1sXVvLWkeYT3ePx7zePCy4ZVV2XMGIxAzup4cKM85NFtL=w124&context=/api2&tiersCollection=Gold&resourceCount=0&resourceMethod-0=POST&uriTemplate-0=/*";"
You can find three samples[TwitterSearch,YahooPlaceFinder,YoutubeFinds] written based on this JavaScript layer from the below location of your downloaded pack.
{API Manager HOME}/samples
Navigate to each three above samples inside the above location and have a look on APIPopulator.sh script,to get better understanding how the API Manager related jaggery API has been consumed from those.
Adding to above,for WSO2 API Manager implementation of its back-end major functionalities we have not used web-service invocations but a java API which can be found from here.You can use that API to do your custom implementations.You can find our java[back-end] implementation from this java API from here.

WSDL Generation for WCF Service Behind Load Balancer

The Background:
I have a Service hosted on IIS 7.0 behind a Load Balancer which decrypts SSL as traffic passes through it.
The security mode required of the Service is Mixed-Mode ie TransportWithMessageSecurity
To enable the Service to accept HTTP traffic whilst allowing clients to communicate to the Load Balancer over SSL, I have created a User Defined Binding, which adds a custom HttpTransportBindingElement to its Channel Stack.
The custom HttpTransportBindingElement in turn asserts to the framework that it is capable of Encrypting and Signing messages...therefore the Framework won't complain when traffic comes in through it via HTTP because the Transport is claiming that it is signing/encrypting the messages...even though its not.
(For all those concerned, this has been determined to be acceptable security wise because the message orginally should have arrived over SSL to the Load Balancer...)
The Problem:
When we use svcutil.exe to generate the client proxy, the resulting auto-generated app.config file contains an endpoint to the service which is addressed over HTTP. This should be over HTTPS.
Additionally the <transport> element within the <customBinding> node is defined as a <httpTransport> element when it needs to be a <httpsTransport> element.
I suspect this is because the WSDL which is generated by the framework on the server, is being built with HTTP addresses instead of HTTPS > in turn, as a result of using the custom HttpTransportBindingElement (as explained above).
The auto-generated app.config for the client:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="myBindingEndpoint">
<!-- WsdlImporter encountered unrecognized policy assertions in ServiceDescription 'http://tempuri.org/': -->
<!-- <wsdl:binding name='myBindingEndpoint'> -->
<!-- <sp:HttpToken xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">..</sp:HttpToken> -->
<security defaultAlgorithmSuite="Default" authenticationMode="CertificateOverTransport"
requireDerivedKeys="true" securityHeaderLayout="Strict" includeTimestamp="true"
keyEntropyMode="CombinedEntropy" messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10">
<localClientSettings cacheCookies="true" detectReplays="false"
replayCacheSize="900000" maxClockSkew="00:05:00" maxCookieCachingTime="Infinite"
replayWindow="00:05:00" sessionKeyRenewalInterval="10:00:00"
sessionKeyRolloverInterval="00:05:00" reconnectTransportOnFailure="true"
timestampValidityDuration="00:05:00" cookieRenewalThresholdPercentage="60" />
<localServiceSettings detectReplays="false" issuedCookieLifetime="10:00:00"
maxStatefulNegotiations="128" replayCacheSize="900000" maxClockSkew="00:05:00"
negotiationTimeout="00:01:00" replayWindow="00:05:00" inactivityTimeout="00:02:00"
sessionKeyRenewalInterval="15:00:00" sessionKeyRolloverInterval="00:05:00"
reconnectTransportOnFailure="true" maxPendingSessions="128"
maxCachedCookies="1000" timestampValidityDuration="00:05:00" />
<secureConversationBootstrap />
</security>
<textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
messageVersion="Default" writeEncoding="utf-8">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</textMessageEncoding>
<httpTransport manualAddressing="false" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous"
bypassProxyOnLocal="false" decompressionEnabled="true" hostNameComparisonMode="StrongWildcard"
keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous"
realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
useDefaultWebProxy="true" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://myserver/GAEASSLWcfService/ServiceOverSSL.svc"
binding="customBinding" bindingConfiguration="myBindingEndpoint"
contract="IServiceOverSSL" name="myBindingEndpoint" />
</client>
</system.serviceModel>
</configuration>
The Work-around:
Simply changing the <httpTransport /> to <httpsTransport /> and re-addressing the endpoints to use HTTPS fixes the issue.
But we'd prefer to not have to instruct our service consumers to change their .config files...the use of our service should be as seemless as possible...
The Question:
How can i ensure the client proxies will generate automatically with the correct Addresses and Transport elements???
References:
For those who want to learn about the solution to the 'service behind a load-balancer/ssl decrypter' and the custom HttpTransportBindingElement, see this post XXX by ZZZ regarding building the user defined binding and also this post XXX by ZZZ regarding some of the other issues with exposing Services behind a Load Balancing/SSL accelerator.
I was having the same problem, my WSDL was generated with the http scheme instead of https behind my load balancer.
I've reflected the WCF code and I found a solution that worked, for me though.
In addition to useRequestHeadersForMetadataAddress, you need to turn httpGetEnabled off and httpsGetEnabled on in the serviceMetadata.
Also, if you're using .net 4 like I think you are, instead of adding a custom HttpTransportBindingElement, just use the standard HttpTransportBindingElement and set AllowInsecureTransport on your TransportSecurityBindingElement.
Check out this question. Try to configure:
<serviceBehaviors>
<behavior name="<name>">
<!-- Other options would go here -->
<useRequestHeadersForMetadataAddress>
<defaultPorts> <!-- Use your own port numbers -->
<add scheme="http" port="81" />
<add scheme="https" port="444" />
</defaultPorts>
</useRequestHeadersForMetadataAddress>
</behavior>
</serviceBehaviors>