I want to set up two way ssl(self-signed cert) to call a webservice endpoint from wildfly to weblogic. I've tested the weblogic setting, it works fine. Now, the problem is how should I configure the wildfly in order to build the connection with weblogic. I've tried the settings in standalone.xml as below:
<security-realm name="UndertowRealm">
<server-identities>
<ssl>
<keystore path="space2_identity.jks" relative-to="jboss.server.config.dir" keystore-password="password" alias="space2i" key-password="password"/>
</ssl>
</server-identities>
<authentication>
<truststore path="space2_trust.jks" relative-to="jboss.server.config.dir" keystore-password="password"/>
<local default-user="$local" skip-group-loading="true"/>
<properties path="mgmt-users.properties" relative-to="jboss.server.config.dir"/>
</authentication>
</security-realm>
<https-listener name="https" verify-client="REQUIRED" security-realm="UndertowRealm" socket-binding="https"/>
The above setting is succeeded if I use a browser to run a two way ssl with wildfly. But for my main purpose (call WS between wildfly and weblogic), I keep receiving a bad_certification error, I suspect that wildfly cannot find my keystore and trustkeystore when wildfly is acting as a client role. It's because if I put the self-sign cert into jvm cacerts file, one way ssl can be built with weblogic. However, I've tried many methods to do the two way ssl, it keeps telling me bad_certification error. I've even insert the following lines into standalone.conf.bat:
set "JAVA_OPTS=%JAVA_OPTS% -Djavax.net.debug=ssl"
set "JAVA_OPTS=%JAVA_OPTS% -Djavax.net.ssl.keyStore=D:/Keystore/space2_identity.jks"
set "JAVA_OPTS=%JAVA_OPTS% -Djavax.net.ssl.trustStore=D:/Keystore/space2_trust.keystore"
set "JAVA_OPTS=%JAVA_OPTS% -Djavax.net.ssl.keyStorePassword=password"
set "JAVA_OPTS=%JAVA_OPTS% -Djavax.net.ssl.trustStorePassword=password"
set "JAVA_OPTS=%JAVA_OPTS% -Djavax.net.ssl.trustStoreType=jks"
set "JAVA_OPTS=%JAVA_OPTS% -Djavax.net.ssl.keyStoreType=jks"
Still, bad_certification received. I've tried many ways, what have I done wrong? Please kindly help. Thank you very much!
In your JAVA_OPTS the truststore is space2_trust.keystorewhile you have space2_trust.jks in your Undertow configuration.
I'm working on a C# WebService on Visual Studio 2012 which use data from an oracle Database and convert them with the EntityManager of visual studio.
On my computer it works fine, but as soon as I publish it on a server IIS, I got this error :
System.Web.Services.Protocols.SoapException: The store provider
factory type 'Oracle.DataAccess.Client.OracleClientFactory' does not
implement the IServiceProvider interface. Use a store provider that
implements this interface.
It happens when I try to get a connection on my database with the Entity framework and I don't know how to look at this problem in order to fix it.
DATA
I work with Oracle.DataAccess v 4.112.3 and .NETFramework 4.5
this is part of my web.config with the connection string
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
<connectionStrings>
<add name="EntitiesCCMX" connectionString="metadata=res://*/ModelCCMX.csdl|res://*/ModelCCMX.ssdl|res://*/ModelCCMX.msl;provider=Oracle.DataAccess.Client;provider connection string="data source=CCMX;password=rhcs;persist security info=True;user id=CCMX"" providerName="System.Data.EntityClient" />
<add name="HastusEntities" connectionString="metadata=res://*/ModelHASTUS.csdl|res://*/ModelHASTUS.ssdl|res://*/ModelHASTUS.msl;provider=Oracle.DataAccess.Client;provider connection string="data source=GIRO2010.WORLD;password=hastus2010;user id=HASTUS2010"" providerName="System.Data.EntityClient" />
</connectionStrings>
What I already did :
I allowed 32bit application on the server
I reinstalled oracle on my computer and on the server
I try to send the oracle.DataAccess.dll on the server
I configured the oranet which redirect on my database
If you need anything more, please ask. I am really stuck with this one...
EDIT :
Managed to "fix" it but I'm not sure why, I will post a response will all the things I done if it keep working for a day or two.
Anyways, for short,
- I add 8 dll (oci, ociw32, Oracle.DataAccess, oraocci11, oraocciei11, oraocciocu11, OraOps11w, System.Data.OracleClient)
- I changed this line in Machine.Config (Microsoft.NET\Framework\v4.0.30319\Config)
<add name="Oracle Data Provider for .NET" invariant="Oracle.DataAccess.Client" description="Oracle Data Provider for .NET" type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=4.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
by this line (Version = 4.112.3.0)
<add name="Oracle Data Provider for .NET" invariant="Oracle.DataAccess.Client" description="Oracle Data Provider for .NET" type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
And I installed Visual Studio professional 2012 on the server (And I think that this instalation moved some repertory or some paths)
I will be back when I"m sure.
EDIT2
Didn't work anymore without touching at anything. But it's another error now.
ORA-12154: TNS:could not resolve the connect identifier specified
Your first problem is stated at oracle's web site
http://www.oracle.com/technetwork/issue-archive/2011/11-sep/o51odt-453447.html
It's the oracle version, you need newer one.
The last error it's just a connection error. try to tnsping the database from the server, if it works check your connection string.
I am trying to program a VisualWebPart using Visual Studio 2010 which has to do a simple thing: invoke a web service (hosted in a remote server, NOT locally). When I execute within the Sharepoint site (version 2010, which I have published in my IIS) I get this error:
"The HTTP request is unauthorized with client authentication scheme 'Ntlm'. The authentication header received from the server was 'NTLM'."
Pardon my ignorance, but the only difference here is the case of the Ntlm authentication scheme! I have been all over the web and found many related problems, but none of the solutions worked. Almost ALL solutions i found involve modifications in the webservice security configuration, this is not an option for me.
Looking for a solution, I created a sample windows form and invoked the web service from it: no problems whatsoever.
In order to be able to invoke the webservice correctly this is the necessary security configuration:
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" proxyCredentialType="Ntlm" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
I believe the problem is that I havenĀ“t been able to properly set this security property to the web.config of my Sharepoint site, since I tried to put it in the security tag that appears in the web.config but still get the same error.
Any further information needed please ask, I am REALLY desperate, for days I have been with the SAME error.
In the end I was given permissions in their server: more precisely in the database which was the one that wouldn't let me create the web part in the server. Once this was done, the call to the webservice worked just fine, because they have the web.config correctly configured.
EDIT:
After I modified the web.config and I don't get error that's good.... then I add a new page (html) and write this small code to consume the service like this:
$("#btn12").click(function (event) {
$.getJSON('http://localhost:3576/MyService.svc/GetCurrentUser', {},
function (data) {
alert(data);
});
//return false;
});
I see the following error in my FireBug:
http://localhost:3576/MyService.svc/GetCurrentUser
400 Bad Request
Note: I have added html page on the same wcf project and running the project it self so I am assuming the service is also running ...
What might be wrong here?
END EDIT
I have just created a new wcf services and when I hit f5 from VS and I get this error in WCF Test Client window :
Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.
Error: Cannot obtain Metadata from http://localhost:3696/MobileService.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.
WS-Metadata Exchange Error
URI: http://localhost:3696/MyService.svc
Metadata contains a reference that cannot be resolved: 'http://localhost:3696/MyService.svc'.
There was no endpoint listening at http://localhost:3696/MyService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
Unable to connect to the remote server
No connection could be made because the target machine actively refused it 127.0.0.1:3696
HTTP GET Error
URI: http://localhost:3696/MyService.svc
There was an error downloading 'http://localhost:3696/MyService.svc'.
Unable to connect to the remote server
No connection could be made because the target machine actively refused it 127.0.0.1:3696
My config:
<behaviors>
<endpointBehaviors>
<behavior name="MyService.MyService">
<webHttp/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="metadataBehavior">
<serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost:2812/MyService.svc" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="MyService.MyService"
behaviorConfiguration="metadataBehavior">
<endpoint
address="http://localhost/MyService.svc"
binding="customBinding"
bindingConfiguration="jsonpBinding"
behaviorConfiguration="MyService.MyService"
contract="MyService.IMyService"/>
</service>
</services>
<bindings>
<customBinding>
<binding name="jsonpBinding">
<jsonpMessageEncoding/>
<httpTransport manualAddressing="true"/>
</binding>
</customBinding>
</bindings>
<extensions>
<bindingElementExtensions>
<add name="jsonpMessageEncoding" type="Microsoft.Ajax.Samples.JsonpBindingExtension, MyService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
</bindingElementExtensions>
</extensions>
You need to add a metadata exchange (mex) endpoint to your service:
<services>
<service name="MyService.MyService" behaviorConfiguration="metadataBehavior">
<endpoint
address="http://localhost/MyService.svc"
binding="customBinding" bindingConfiguration="jsonpBinding"
behaviorConfiguration="MyService.MyService"
contract="MyService.IMyService"/>
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange"/>
</service>
</services>
Now, you should be able to get metadata for your service
Update: ok, so you're just launching this from Visual Studio - in that case, it will be hosted in Cassini, the built-in web server. That beast however only supports HTTP - you're not using that protocol in your binding...
Also, since you're hosting this in Cassini, the address of your service will be dictated by Cassini - you don't get to define anything.
So my suggestion would be:
try to use http binding (just now for testing)
get this to work
once you know it works, change it to your custom binding and host it in IIS
So I would change the config to:
<behaviors>
<serviceBehaviors>
<behavior name="metadataBehavior">
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="MyService.MyService" behaviorConfiguration="metadataBehavior">
<endpoint
address="" <!-- don't put anything here - Cassini will determine address -->
binding="basicHttpBinding"
contract="MyService.IMyService"/>
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange"/>
</service>
</services>
Once you have that, try to do a View in Browser on your SVC file in your Visual Studio solution - if that doesn't work, you still have a major problem of some sort.
If it works - now you can press F5 in VS and your service should come up, and using the WCF Test Client app, you should be able to get your service metadata from a) the address that Cassini started your service on, or b) the mex address (Cassini's address + /mex)
In case you rename the svc file make sure that your markup is correct.
You'll need to modify the default configuration and follow these steps:
1) Go to SVC file right click and select view markup
2) Make sure that that code behind and service pointing to correct the file and class name.
FYI - YOU CAN also get this error from a machine that is not having enough memory free. I got this error on a machine I run with 16 gigs of memory. I had a VM running with 6 gigs and a LOT of memory intensive apps. Close some down and this problem went away.
I still did get the error in the title of the question of
Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.`
I did notice a larger message about memory though in using the WCF Test Client.
Hope this helps someone else.
In my case I was getting this error because the option (HttpActivation) was not enabled.
Add Serializable() before the type you expose
Serializable()
Public Class YourType
Put Serializable into <>
if working with .NET 4.0 WCF service - make sure Global.asax is not in the source directory. If it is , it is picked up at runtime and attempted to be compiled in...
changing the Binding Type from wsHttpbinding to basichttp binding in the endpoint tag and from wsHttpbinding to mexhttpbinginding in metadata endpoint tag helped to overcome the error. Thank you...
In my case, on commenting out the
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
in the web.config file was throwing "Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata".
For me the issue got resolved by doing the following:
Navigated to Tool --> Options --> Project and Solutions --> Web Projects
I could find the first check box "Use the 64 bit version of IIS Express of web sites and projects" was unchecked.
Selecting this check box helped me in launching the WCF Client.
VS Version : VS2019
I observed that when I removed SessionMode from the ServiceContract attribute, the issue went away.
Example:
[ServiceContract(SessionMode=SessionMode.Required, CallbackContract=typeof(ICallbacks))]
public interface IStringReverser
{
[OperationContract]
string ReverseString(string value);
}
to...
[ServiceContract()]
public interface IStringReverser
{
[OperationContract]
string ReverseString(string value);
}
I have tried several solutions mentioned over web, unfortunately without any success.
In my project, I have two interfaces(xml/json) for each service. Adding mex endpoints or binding configurations did not helped at all.
But, I have noticed, I get this error only when running project with *.svc.cs or *.config file focused. When I run project with IService.cs file focused (where interfaces are defined), service is added without any errors. This is really strange and in my opinion conclusion is bug in Visual Studio 2013.
I reproduced same behaviour on several machines(even on Windows Server machine).
Hope this helps someone.
Most of the time this happens due to less memory space. first check then try some other tricks .
The property IsOneWay=true may be true in the Operational contract of the interface.
Remove that property to get rid of this error.
In my case, the Webservice was generating the assembly with a different name than the project/service name. It was set like that by my predecessor developer working on the solution and I didn't know.
It was set to -
<serviceBehaviors>
<behavior name="CustomServiceBehavior">
<serviceAuthorization serviceAuthorizationManagerType="BookingService.KeyAuthorizationManager, BookingService" />
</behavior>
</serviceBehaviors>
So, the fix was the put the right assembly name in serviceAuthorizationManagerType. The assembly name can be obtained from following path of the service project:
Right click on the WCF svc project--> Select "Properties" --> From the list of tabs select "Application". Check the value against "Assembly name:" field in the list. This is the assemblyName to use for serviceAuthorizationManagerType which may not be the servicename necessarily.
<serviceBehaviors>
<behavior name="MyCustomServiceBehavior">
<serviceAuthorization serviceAuthorizationManagerType="BookingService.KeyAuthorizationManager, AssemblyNameFromSvcProperties" />
</behavior>
</serviceBehaviors>
remember to follow the instruction for serviceAuthorizationManagerType as mentioned on https://learn.microsoft.com/en-us/dotnet/framework/wcf/extending/how-to-create-a-custom-authorization-manager-for-a-service
It says -
Warning
Note that when you specify the serviceAuthorizationManagerType, the string must contain the fully qualified type name. a comma, and the name of the assembly in which the type is defined. If you leave out the assembly name, WCF will attempt to load the type from System.ServiceModel.dll.
Change to older Visual Studio.
Weird solution that worked for me.
I was using Visual studio 2017,
after changing to Visual Studio 2015 ,everything worked.
In Visual Studio:
project properties (right click on your project)
Debug -> Start Options
Make sure "Command line arguments" is empty
After Add this to your web.config file and configure according to your service name and contract name.
<behaviors>
<serviceBehaviors>
<behavior name="metadataBehavior">
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="MyService.MyService" behaviorConfiguration="metadataBehavior">
<endpoint
address="" <!-- don't put anything here - Cassini will determine address -->
binding="basicHttpBinding"
contract="MyService.IMyService"/>
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange"/>
</service>
</services>
Please add this in your Service.svc
using System.ServiceModel.Description;
Hope it will helps you.
I had that issue. The solution is to startup VS with administrative privilege.
I have a WSDL for a Web Service and a Public Key Certificate in the shape of a .cer file.
I need to get SoapUI to encrypt the service request with the public key of the certificate.
How do I do this?
In SoapUI, go to the Preferences dialog, under the File menu. There's a tab/section for SSL. There you can specify the path to the .cer file. I don't have it here in front of me, and I've only done .pfx, but it should work the same. With .pfx, you need to enter the password - not sure if you do that for .cer or not. You can also convert the .cer to .pfx if that works better. But anyway, with a .pfx specified here, I was able to use https connections to our server (Cisco ACE gateway actually) which required "client certificate authentication". It was easy to do in SoapUI, proving that the infrastructure was set up right. Our app, written in Delphi2005, took another 3 weeks... But at least we knew what we were trying to do, and had a way to verify the result.
In Preferences fill in the path to your certificate in the KeyStore field and the password underneath.
I use a p12 certificate and it seems to be working fine.
If you can use WCF, just add security to the binding, and the following behavior:
<behaviors>
<behavior>
<clientCredentials>
<clientCertificate findValue= "101010101010101010101010101010000000000"
storeLocation="LocalMachine" storeName="The logic storage"
X509FindType="The cert name"/>
</clientCertificate>
</clientCredentials>
</behavior>
</behaviors>
More info about how to enable security in WCF, see: MSDN