I need to connect a java metro client to a wcf service for a project I'm cuurently working on. I used the tutorial at click.
Everything seems to work properly until I want to add sessions to my service. When I add <reliableSession enabled="true" /> to my config file, the client isn't able to reload the wcf service.
config file:
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="false" logMalformedMessages="false"
logMessagesAtServiceLevel="false" logMessagesAtTransportLevel="false" />
</diagnostics>
<services>
<service name="Service" behaviorConfiguration="ServiceBehavior">
<!-- Service Endpoints -->
<endpoint address="" bindingConfiguration="interopBinding" binding="metroBinding" contract="IService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
<!-- To configure the service certificate -->
<serviceCredentials>
<serviceCertificate storeLocation="LocalMachine" storeName="Root" x509FindType="FindBySubjectDistinguishedName" findValue="CN=go2.openscrolling" />
<clientCertificate>
<authentication certificateValidationMode="PeerOrChainTrust" />
</clientCertificate>
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<metroBinding>
<binding name="interopBinding" messageEncoding="Text">
<security mode="MutualCertificate" establishSecurityContext="false" algorithmSuite="Basic128"/>
<!--<reliableSession enabled="true" />-->
</binding>
</metroBinding>
</bindings>
<extensions>
<bindingExtensions>
<add name="metroBinding" type="Microsoft.ServiceModel.Interop.Metro.Configuration.MetroBindingCollectionElement, Microsoft.ServiceModel.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4fc38efee625237e"/>
</bindingExtensions>
</extensions>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
Related
We have a pretty big WCF service that we use for quite some time, but up until now we've been connecting to it only via c#. Now we have a need to connect to it from Java.
I found out quickly that if I use Eclipse and go to new/other/Web Service Client I can put the WSDL link there to auto generate the code.
Doing that straight away did not produce much though. I obtained two files, one of which had empty body.
This is my first issue with this auto generation tool - it creates something, but I don't see any log of what it succeeded and what failed in creating.
I searched and found out that i had to change the bindings to basicHttpBinding, and make sure that httpGetEnabled is set to "true". After this change, auto generation in Java produces a lot of code, i get the data contract schemas and so on. And I get 4 files under the 'org.tempuri' namespace:
BasicHttpBinding_IMyServiceStub.java
IMyServiceProxy.java
MyService.java
MyServiceLocator.java
However looking at some tutorials, it seems I should get a fifth one, IMyService.java - which I did not get. And, I do have errors in the generated code pointing out that indeed IMyService cannot be resolved, as its being used in a few places, but its definition was not auto-generated.
Since I have no logs of what has failed during auto generation, I'm kind of lost what to look for as a culprit.
Does anyone have any experience on either:
a) locating logs for auto generation that would tell me what went
wrong
b) directly know what causes the Interface class not to be generated?
I'm suspecting i have to change something more in webconfig file on the server. A second guess is that perhaps we use some c# construct not recognised by java...or something.
Anyway, completly lost here, as there is no feedback of what went wrong.
Here is a webconfig file from the IIS server.
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="XXX" connectionString="XXX" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation targetFramework="4.0"/>
<customErrors mode="Off"/>
<httpRuntime executionTimeout="5400" requestValidationMode="2.0"/>
<identity impersonate="false"/>
</system.web>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="bindingNetTcp" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00">
<binaryMessageEncoding maxSessionSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
</binaryMessageEncoding>
<tcpTransport maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"/>
</binding>
<binding name="bindingHttps" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00">
<binaryMessageEncoding maxReadPoolSize="2147483647" maxWritePoolSize="2147483647" maxSessionSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
</binaryMessageEncoding>
<httpsTransport manualAddressing="false" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" allowCookies="true" authenticationScheme="Anonymous" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" keepAliveEnabled="true" maxBufferSize="2147483647" proxyAuthenticationScheme="Anonymous" realm="" transferMode="StreamedResponse" unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true"/>
</binding>
<binding name="bindingHttp" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00">
<binaryMessageEncoding maxReadPoolSize="2147483647" maxWritePoolSize="2147483647" maxSessionSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
</binaryMessageEncoding>
<httpTransport manualAddressing="false" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" allowCookies="true" authenticationScheme="Anonymous" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" keepAliveEnabled="true" maxBufferSize="2147483647" proxyAuthenticationScheme="Anonymous" realm="" transferMode="StreamedResponse" unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true"/>
</binding>
</customBinding>
<netTcpBinding>
<binding name="NetTcpBinding_IGodService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
<security mode="Transport">
<transport clientCredentialType="Certificate" protectionLevel="EncryptAndSign"/>
<message clientCredentialType="Windows"/>
</security>
</binding>
<binding name="NetTcpBinding_IGodService1" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
<security mode="Transport">
<transport clientCredentialType="Certificate" protectionLevel="EncryptAndSign"/>
<message clientCredentialType="Windows"/>
</security>
</binding>
<binding name="CustomBinding_IDQMServer">
<security mode="None"/>
</binding>
</netTcpBinding>
</bindings>
<services>
<service name="XXX.XXX" behaviorConfiguration="XXXBehavior">
<host>
<baseAddresses>
<add baseAddress="net.tcp://example.com:4502/xxx/xxx/"/>
<add baseAddress="http://example.com/xxx/xxx/"/>
</baseAddresses>
</host>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<endpoint address="" binding="customBinding" bindingConfiguration="bindingHttps" contract="xxx.Ixxx"/>
<endpoint address="" binding="basicHttpBinding" contract="xxx.Ixxx"/>
<endpoint address="" binding="customBinding" bindingConfiguration="bindingNetTcp" contract="xxx.Ixxx"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="xxxBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
<serviceThrottling maxConcurrentCalls="2500" maxConcurrentInstances="2147483647" maxConcurrentSessions="2147483647"/>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="SrvBehavior">
<clientCredentials>
<clientCertificate findValue="xxx" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName"/>
<serviceCertificate>
<authentication certificateValidationMode="PeerTrust"/>
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<defaultDocument>
<files>
<add value="xxx.svc"/>
</files>
</defaultDocument>
</system.webServer>
</configuration>
Please note that im using basicHttpBinding there, previously it was "bindingHttp" like the https one, but it didnt work at all.
EDIT: As pointed out in the comment section, we're using Lists in the service quite a lot, an example of the c# wcf interface:
public class ListResults<T>//our own custom return class
{
public List<T> Result { get; set; }
public long? ID { get; set; }
public int? Error { get; set; }
}
[SecurityOperationBehavior]
[OperationContract]
ListResults<SomeDataType> SomeListFunction(string param1, long? param2, bool? param3);
I'm writing a test application using ActiveMQ embedded broker on the same machine. I tried to configure it as follows:
activemq.xml:
<amq:broker useJmx="false" persistent="false">
<amq:transportConnectors>
<amq:transportConnector uri="tcp://localhost:61616" />
</amq:transportConnectors>
</amq:broker>
<amq:simpleAuthenticationPlugin >
<amq:users>
<amq:authenticationUser username="system" password="manager"
groups="users,admins" />
</amq:users>
</amq:simpleAuthenticationPlugin>
Tomcat's context.xml: !!The Password is deliberately incorrect!!
<Resource name="jms/ConnectionFactory" auth="Container" userName="userssname" password="passwords"
type="org.apache.activemq.ActiveMQConnectionFactory" description="JMS Connection Factory"
factory="org.apache.activemq.jndi.JNDIReferenceFactory" brokerURL="tcp://localhost:61616"
brokerName="LocalActiveMQBroker" />
But, when I try to perform injection I can easily create a ConnectionFactory object and send/receive messages even with incorrect password. How can I deny this?
I believe that you need to add authorization entries for queues and topics as well.
Example authorization plugin configuration:
<authorizationPlugin>
<map>
<authorizationMap>
<authorizationEntries>
<authorizationEntry queue=">" write="admins,publishers" read="admins,consumers" admin="admins" />
<authorizationEntry topic=">" write="admins,publishers" read="admins,consumers" admin="admins" />
<authorizationEntry topic="ActiveMQ.Advisory.>" read="everyone" write="everyone" admin="everyone"/>
</authorizationEntries>
</authorizationMap>
</map>
</authorizationPlugin>
I want to build a soap Client .NET to contact Java web service. The problem is in the response because there is no compatibility from Java and .NET for the signature.
So I want to disable the validation response from .NET, for this, I have find this articles on MSDN
https://msdn.microsoft.com/en-us/library/aa717047.aspx
I can read that it possibile to insert a method that intercept the response and I can bypass the check. But I'm not able to do this.
I have write import in my project these class:
SchemaValidationBehavior
SchemaValidationBehaviorExtensionElement
SchemaValidationMessageInspector
This is my app.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="MyNewService">
<security defaultAlgorithmSuite="Basic128" authenticationMode="MutualCertificate" requireDerivedKeys="false" securityHeaderLayout="Lax" includeTimestamp="true" messageProtectionOrder="SignBeforeEncrypt" messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10" requireSignatureConfirmation="false">
<localClientSettings detectReplays="true"/>
<localServiceSettings detectReplays="true"/>
</security>
<textMessageEncoding messageVersion="Soap11WSAddressing10"/>
<httpsTransport/>
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="https://edottotest.sanita.regione.rsr.rupar.puglia.it/nsisr/PianoAssistenzialeResidenzialeService" binding="customBinding" bindingConfiguration="MyNewService" contract="PianoAssistenzialeResidenzialeService.PianoAssistenzialeResidenziale" name="PianoAssistenzialeResidenzialePort" >
<identity>
<dns value="HEALTHNETBR"/>
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
I think the problem is on this file.
I want to use Infinispan JDBC Cache Store instead of LevelDb Cache Store.
Here's below my configuration:
<infinispan
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:6.0 http://www.infinispan.org/schemas/infinispan-config-6.0.xsd
urn:infinispan:config:jdbc:6.0 http://www.infinispan.org/schemas/infinispan-cachestore-jdbc-config-6.0.xsd"
xmlns="urn:infinispan:config:6.0"
xmlns:jdbc="urn:infinispan:config:jdbc:6.0" >
<global>
<globalJmxStatistics enabled="false" allowDuplicateDomains="true"/>
</global>
<!-- Define the cache loaders (i.e., cache stores). Passivation is false
because we want *all* data to be persisted, not just what doesn't fit
into memory. -->
<persistence>
<mixedKeyedJdbcStore fetchPersistentState="false" ignoreModifications="false" purgeOnStartup="false">
<simpleConnection connectionUrl="jdbc:postgresql://localhost:5432/infinispan_binary_based" driverClass="org.postgresql.Driver" username="postgres" password="postgres"/>
<stringKeyedTable prefix="ISPN_MIXED_STR_TABLE" createOnStart="true" dropOnExit="true">
<idColumn name="ID_COLUMN" type="VARCHAR(255)" />
<dataColumn name="DATA_COLUMN" type="BINARY" />
<timestampColumn name="TIMESTAMP_COLUMN" type="BIGINT" />
</stringKeyedTable>
<binaryKeyedTable prefix="ISPN_MIXED_BINARY_TABLE" createOnStart="true" dropOnExit="true">
<idColumn name="ID_COLUMN" type="VARCHAR(255)" />
<dataColumn name="DATA_COLUMN" type="BINARY" />
<timestampColumn name="TIMESTAMP_COLUMN" type="BIGINT" />
</binaryKeyedTable>
</mixedKeyedJdbcStore>
</persistence>
</namedCache>
but I keep getting this exception:
Message: Unexpected element '{urn:infinispan:config:jdbc:6.0}mixedKeyedJdbcStore'
at org.infinispan.configuration.parsing.ParserRegistry.parseElement(ParserRegistry.java:139) [infinispan-core-6.0.2.Final.jar:6.0.2.Final]
at org.infinispan.configuration.parsing.XMLExtendedStreamReaderImpl.handleAny(XMLExtendedStreamReaderImpl.java:37) [infinispan-core-6.0.2.Final.jar:6.0.2.Final]
at org.infinispan.configuration.parsing.Parser60.parsePersistence(Parser60.java:558) [infinispan-core-6.0.2.Final.jar:6.0.2.Final]
I removed leveldb cache store jar from my dependencies and replace it with jdbc cache store jar.
Could you tell me if I missed anything?
Help please?
Thank you in advance.
You're declaring a namespace called jdbc, but not using it. You need to either prefix all the tags in mixedKeyedJdbcStore with jdbc:, or use a default namespace like this:
<infinispan
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:6.0 http://www.infinispan.org/schemas/infinispan-config-6.0.xsd
urn:infinispan:config:jdbc:6.0 http://www.infinispan.org/schemas/infinispan-cachestore-jdbc-config-6.0.xsd"
xmlns="urn:infinispan:config:6.0"
xmlns:jdbc="urn:infinispan:config:jdbc:6.0" >
<global>
<globalJmxStatistics enabled="false" allowDuplicateDomains="true"/>
</global>
<!-- Define the cache loaders (i.e., cache stores). Passivation is false
because we want *all* data to be persisted, not just what doesn't fit
into memory. -->
<namedCache name="testCache">
<persistence>
<mixedKeyedJdbcStore xmlns="urn:infinispan:config:jdbc:6.0" fetchPersistentState="false" ignoreModifications="false" purgeOnStartup="false">
<simpleConnection connectionUrl="jdbc:postgresql://localhost:5432/infinispan_binary_based" driverClass="org.postgresql.Driver" username="postgres" password="postgres"/>
<stringKeyedTable prefix="ISPN_MIXED_STR_TABLE" createOnStart="true" dropOnExit="true">
<idColumn name="ID_COLUMN" type="VARCHAR(255)" />
<dataColumn name="DATA_COLUMN" type="BINARY" />
<timestampColumn name="TIMESTAMP_COLUMN" type="BIGINT" />
</stringKeyedTable>
<binaryKeyedTable prefix="ISPN_MIXED_BINARY_TABLE" createOnStart="true" dropOnExit="true">
<idColumn name="ID_COLUMN" type="VARCHAR(255)" />
<dataColumn name="DATA_COLUMN" type="BINARY" />
<timestampColumn name="TIMESTAMP_COLUMN" type="BIGINT" />
</binaryKeyedTable>
</mixedKeyedJdbcStore>
</persistence>
</namedCache>
Your configuration was also missing a starting namedCache tag, but I assume it was a copypaste mistake, otherwise the error message would be different.
We are experimenting with IBM's WebSphere Liberty profile. Now we have trouble to connect to our WebSphere MQ server. It works for normal WebSphere profile. We followed this tutorial https://developer.ibm.com/wasdev/2013/06/14/using-websphere-mq-with-the-liberty-profile/ and I ran into the following Exception:
Stack Dump = java.lang.ClassNotFoundException: com.ibm.mq.jms.MQQueue
Any idea what I could change, so that this class could be found?
I am working with Liberty Profile, version 8.5.5.3.
my server.xml looks the following:
<server description="new server">
<!-- Enable features -->
<featureManager>
<feature>jsf-2.0</feature>
<feature>jpa-2.0</feature>
<feature>jndi-1.0</feature>
<feature>localConnector-1.0</feature>
<feature>beanValidation-1.0</feature>
<feature>wasJmsClient-1.1</feature>
<feature>jaxws-2.2</feature>
<feature>jmsMdb-3.1</feature>
</featureManager>
<!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
<httpEndpoint id="defaultHttpEndpoint" httpPort="9080" httpsPort="9443" />
<application id="myapp" name="myApp" type="ear" location="d:\somehwere">
<classloader delegation="parentLast" commonLibraryRef="global" />
</application>
<variable name="wmqJmsClient.rar.location" value="D:\opt\was_liberty_profile\was_8_5_5_3\wlp\usr\shared\wmq\wmq.jmsra.rar"/>
<library id="global">
<file name="d:/dev/mavenrepo/com/h2database/h2/1.4.181/h2-1.4.181.jar" />
</library>
<jmsQueue id="MYAPP_QUEUE" jndiName="jms/test/testq">
<properties.wmqJms
baseQueueName="MYAPP.TEST.A"
persistence="PERS"
targetClient="MQ"/>
</jmsQueue>
<jmsQueueConnectionFactory id="TEST.SVRCONN.001" jndiName="jms/test/testcf"><!-- connectionManagerRef="ConMgr2">-->
<properties.wmqJms
channel="WM026D.SVRCONN.001"
hostName="i19328.myhost.ch"
port="1439"
queueManager="WM026D"
targetClientMatching="false"/>
</jmsQueueConnectionFactory>
<jmsActivationSpec id="fvtapp/fvtmdb/FVTMessageDrivenBean">
<properties.wmqJms destinationRef="MYAPP_QUEUE"
destinationType="javax.jms.Queue"
queueManager="WM026D"/>
</jmsActivationSpec>
</server>
You have the wrong feature there. It should be:
<feature>wmqJmsClient-1.1</feature>
not:
<feature>wasJmsClient-1.1</feature>
the later one is for built in messaging not MQ.