CRM OnPrem--> Plugin--> Connect to External (SOAP) Webservice Error with connection - dynamics-crm

I am trying to connect from CRM Plugin to External SOAP API. It gives me error.
I am using Isolation Mode as None.
When I connect the same API using Console APP it works fine. I executed the Console APP from Server and it connects and responds Fine.
I googled a bit got some leads but probably I lack capability to understand/ pinpoint the issue.
Code Snippet below
WebRequest request = WebRequest.Create("URL");
request.Method = "GET";
//request.Credentials = new NetworkCredential("USERNAME", "PASSWORD");
WebResponse response = request.GetResponse();
HttpWebResponse webresponse = (HttpWebResponse)response;
if (webresponse.StatusCode == HttpStatusCode.OK)
{
tracing.Trace($" Resposne is correct i.e OK");
}
When I debug using Plugin Registration Tool, Tool breaks up and exits.
Error from Tracing:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetResponse()

Reason why it was not working:
Customer (OnPrem) uses Proxy to connect to Web.
When I was running Console App on server it was running on my Logged on context (outside CRM) i.e. user who logged on Server.
However, When I tried to call website from CRM may it be from Isolation Mode = None OR Sandbox, The services that runs under specific user did not have proxy added to them.
For Example running plugin under Isolation Mode = NONE i.e. directly under the context of APPPool Service "crmtestappserv" did not have proxy and even using mere Internet Explored under the context of same user was not able to open google.com unless proxies were Added.
Steps Taken to Solve the issue: In our plugin Code, when we make an HTTP request we add proxy to the request. This solved our issue.

Related

How to deploy and interact with a rust websocket?

I'm a beginner in Rust and WebSockets and I'm trying to deploy on Heroku a little chat backend I wrote (everything works on localhost). The build went well and I can see the app is running, and I'm now trying to connect to the WebSocket from a local HTML/Javascript frontend, but it is not working.
Here is my code creating the WebSocket on my rust server on Heroku (using the tungstenite WebSocket crate):
async fn main() -> Result<(), IoError> {
let port = env::var("PORT").unwrap_or_else(|_| "8080".to_string());
let addr = format!("0.0.0.0:{}", port);
// Create the event loop and TCP listener we'll accept connections on.
let try_socket = TcpListener::bind(&addr).await;
let listener = try_socket.expect("Failed to bind");
println!("Listening on: {}", addr);
and here is the code in my Javascript file that tries to connect to that WebSocket:
var ws = new WebSocket("wss://https://myappname.herokuapp.com/");
My web client gets the following error in the console:
WebSocket connection to 'wss://https//rocky-wave-51234.herokuapp.com/' failed
I searched to find the answer to my issue but unfortunately didn't find a fix so far. I've found hints that I might have to create an HTTP server first in my backend and then upgrade it to a WebSocket, but I can't find a resource on how to do that and don't even know if this is in fact the answer to my problem. Help would be greatly appreciated, thanks!
I think your mistake is the URL you use:
"wss://https://myappname.herokuapp.com/"
A URL usually starts with <protocol>://. The relevant protocols here are:
http - unencrypted hypertext
https - encrypted hypertext
ws - unencrypted websocket
wss - encrypted websocket
So if your URL is an encrypted websocket, it should start only with wss://, a connection cannot have multiple protocols at once:
"wss://myappname.herokuapp.com/"

IBM MFP Calling a JS adapter procedure from a JS adapter cause SSLHandshakeException by IHS

I have two javascript adapter:adapterA、adapterB
And I need call adapterA after that the adapterA will call adapterB(use MFP.Server.invokeProcedure, in the same mfp server) using this API
when I call in mfp localhost, it works
http://localhost:9080/mfp/api/adapters/AdapterA/test
then I call https after I import mfp cer to jre cacerts
It works fine too
https://localhost:443/mfp/api/adapters/AdapterA/test
My question is I have IHS Server to redirect mfp services
when I call api by IHS http url
http://{domain}/mfp/api/adapters/AdapterA/test
It works
when I call api by IHS https url
https://{domain}/mfp/api/adapters/AdapterA/test
mfp server will get error like this:
com.ibm.mfp.server.js.adapter.internal.JavascriptManagerImpl E FWLST0904E: Exception was thrown while invoking procedure: test in adapter: adapterB
java.lang.RuntimeException: javax.net.ssl.SSLHandshakeException: com.ibm.jsse2.util.j: PKIX path building failed: com.ibm.security.cert.IBMCertPathBuilderException: unable to find valid certification path to requested target
at com.ibm.mfp.server.js.adapter.internal.invocation.JavaScriptIntegrationLibraryImplementation.invokeProcedure(JavaScriptIntegrationLibraryImplementation.java:255)
but my IHS plugin only set http
how can I resolve this issue and avoid this issue
thanks
When the MobileFirst server creates the request to reach adapter B, the default behaviour is to frame the request, based on the URL of the currently executing request. That is, it uses the request originally used to reach adapter A, to frame the request to reach the target adapter B.
It works well in case 1, where the webserver is accessed using a "http://.." URL. In case 2, where MFP1 has to make an outbound call to the webserver using the "https://.." URL, it needs to first complete a SSL Handshake with the webserver. In case the MFP1 JVM lacks the certificates of the webserver, it fails to establish SSL Handshake and can lead to the error you saw.
In your case, there are two approaches you can take:
Choose to keep the adapter A to adapter B call internal to MFP1. This prevents the outbound "https://" call and you will not see the problem. Additionally, this helps in keeping the travel time shorter and also prevent a new connection on the webserver. To enable this setting, use the JNDI property mfp.adapter.invocation.url. For instance, if you set the value of this property to "http://localhost:9080/mfp", adapter B will be invoked as "http://localhost:9080/mfp/api/adapters/adapterB". The call stays local. More details on this property here.
If you wish to retain the request to adapter B go through the webserver using the secure endpoint, then you should ensure the webserver's root certificates are made available to the MFP1 JVM's trust store so that SSL handshake can be established successfully.

Genymotion androvm web service error Cannot connect java.net.ConnectException

I developed a simple application, calls currency converter webservice from www.webservicex.net. and deployed it on GenyMotion AndroVM.
But I am getting below error,
"Cannot connect to www.webservicex.net on port 80:
java.net.ConnectException: Connection timed out"
We have proxy and I defined proxy settings as well. I am able to access internet using browser inside AndroVM.
Please help
In Android, the system's proxy settings is not applied to all Http requests you made inside your app. It is applied natively inside the browser only that's the reason why you can use it.
Each application has to handle it "manually".
My first and quick advise is to use OkHttp as Http client because it handles it for you.
Or you can get the values manually and configure yourself your requests like this (gathered from here):
String host = System.getProperty("http.proxyHost");
String port = System.getProperty("http.proxyPort");
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpHost proxy = new HttpHost(host, Integer.parseInt(port));
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);

Test Rig Azure Controller cannot connect to Visual Studio Client

I am deploying a test rig as per the directions from http://msdn.microsoft.com/en-us/library/windowsazure/hh674491.aspx with the controller and agents hosted on windows azure. I have followed all the directions properly and my VS client is able to see the controller and agents. However when i execute a load test, the test remains in an pending state and I see the below error in the Controller's eventlog. My problem is similar to one found at: http://social.msdn.microsoft.com/Forums/en-US/windowsazureconnectivity/thread/4040619f-5667-4445-804a-84f37d823c9f/. Please help!
(QTController.exe, PID 692, Thread 11) ControllerDeployment.DoDeployment: System.Net.Sockets.SocketException (0x80004005): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond [xxx:xxx:xxxx:xxx:xxxx:xxxx:xxxx:220]:6915
Server stack trace:
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket(EndPoint ipEndPoint)
at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket()
at System.Runtime.Remoting.Channels.SocketCache.GetSocket(String machinePortAndSid, Boolean openNew)
at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWithRetry(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream)
at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders& responseHeaders, Stream& responseStream)
at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.VisualStudio.TestTools.Common.FileCopyService.get_DeploymentFlags()
at Microsoft.VisualStudio.TestTools.Controller.ControllerExecution.b__6(FileCopyService fileCopyService)
at Microsoft.VisualStudio.TestTools.Execution.RemoteObjectContainer1.InvokeAsRemoteUser(Action1 invoke)
at Microsoft.VisualStudio.TestTools.Controller.ControllerExecution.DoDeployment()
Based on the error message it looks like the controller is not able to talk to the agent. Have you set up a connect group as mentioned below:
"http://msdn.microsoft.com/en-us/library/windowsazure/hh674497.aspx"
Creating a Connect Group
The Connect feature of Azure allows you to create a Virtual Private Network. Members of the group can include on-premise computers as well as Azure role instances. For the Load Test solution, the Connect group allows communication between the test controller and the agents.
Attempted this as well, and couldn't get it to work. Ended up having to move the Controller into Azure as well.
I followed the documentation as far as what ports the agent needed, and opened those up in the Azure firewall. However, after doing a network capture, IIRC it also used some dynamic ports that weren't going to work to open up.
So I found that I had to move Visual Studio, the Load Agent Controller, and the Load Agents themselves all into Azure to utilize this in the cloud.

WebHost failed to process a request on IIS 7 windows 2008 when using Windows Mobile

I have developed a webservice using WCF and secured it using NTLM over SSL. I am able to connect successfully using from a visual Studio 2008 form or Web Project. The problem I am having is when creating a smart device project and deploying it on the device.
when I call the service, from client side I get the error: Web Exception
on the server site, when i check the Event Log I get the following Error:
**Sender Information: System.ServiceModel.Activation.HostedHttpRequestAsyncResult/7491627
Exception: System.Web.HttpException (0x80004005): There was no channel actively listening at 'https://mymachine:9011/FrontEndWS/MeterReadingService.svc/$metadata'. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening. --->
System.ServiceModel.EndpointNotFoundException: There was no channel actively listening at 'https://mymachine:9011/FrontEndWS/MeterReadingService.svc/$metadata'. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening.
at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)**
Process Name: w3wp
Process ID: 2828
Cannot figure out why this is happening from mobile devices but works fine from a PC.

Resources