No conduit initiator found for namespace http://cxf.apache.org/transports/http - http

We are using apache cxf 2.6.1 to call Restful API. Both Server and the client use cxf libraries. On the client side, we use cxf generated client. Everything works in dev environment but we recently saw this error in production environment. I googled and found nothing for this specific namespace. I am wondering if anybody else got this. I already verified that the class path has following 5 cxf libraries (both in dev and prod). Any help would be greatly appreciated.
List of cxf jars we have in class path:
/opt/mhs/lib/cxf-api-2.6.1.jar
/opt/mhs/lib/cxf-rt-bindings-xml-2.6.1.jar
/opt/mhs/lib/cxf-rt-core-2.6.1.jar
/opt/mhs/lib/cxf-rt-frontend-jaxrs-2.6.1.jar
/opt/mhs/lib/cxf-rt-transports-http-2.6.1.jar
Here is the error message. Its very generic and I am having hard time finding the root cause.
apache.cxf.phase.PhaseInterceptorChain - Interceptor for {http://rest.perfmon.kiva.com/}IPerfMonRestEntityAssociationService has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: No conduit initiator was found for the namespace http://cxf.apache.org/transports/http.
at org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(AbstractConduitSelector.java:127)
at org.apache.cxf.endpoint.UpfrontConduitSelector.selectConduit(UpfrontConduitSelector.java:77)
at org.apache.cxf.message.ExchangeImpl.getConduit(ExchangeImpl.java:130)
at org.apache.cxf.interceptor.MessageSenderInterceptor.getConduit(MessageSenderInterceptor.java:71)
at org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
at org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:526)
at org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:205)
at com.sun.proxy.$Proxy60.addEntityAssociation(Unknown Source)

Related

Call a web service from .net code

I'm trying to create an application in Visual Studio 2015 that calls a web service set up on one of our servers (It's a third party web service so I don't really know anything about its implementation).
I can browse to the web service definition, and view the wsdl and singleWsdl definitions.
In Visual Studio, I right-click on the Service References folder and choose 'Add Service Reference...', type in the URL to the web service (I've also tried the wsdl and singleWsdl URLs which produce the same result) and click 'Go'. The operations are shown, so I enter a namespace and click 'OK'.
At this point lots of code is generated, but, and I think this is the cause of my problem, there are no changes made to the config file.
When I try and run my code I get an error:
"An exception of type 'System.InvalidOperationException' occurred in
System.ServiceModel.dll but was not handled in user code
Additional information: Could not find default endpoint element that
references contract 'CRMContactEventService.ContactEventService' in
the ServiceModel client configuration section. This might be because
no configuration file was found for your application, or because no
endpoint element matching this contract could be found in the client
element."
I've tried using SvcUtil.exe to generate the proxy but it also does not generate any config file. I've tried using wsdl.exe to generate another wsdl file but that just generates an empty file. I've tried saving the singleWsdl file to my local drive and using that instead of the URL but the results are the same.
Now after lots of searching, I have tried to manually add what I think is missing to the web.config file:
<system.serviceModel>
<client>
<endpoint address="http://...<url to service>.../ContactEventService.svc"
binding ="netHttpBinding"
contract = "CRMContactEventService.ContactEventService" />
</client>
</system.serviceModel>
This changes the error message:
"An exception of type 'System.ServiceModel.EndpointNotFoundException'
occurred in mscorlib.dll but was not handled in user code
Additional information: There was no endpoint listening at
http://....../ContactEventService.svc that could
accept the message. This is often caused by an incorrect address or
SOAP action. See InnerException, if present, for more details."
InnerException contains:
"The remote server returned an error: (404) Not Found."
I have tried several different values for the binding parameter in the web.config file as I don't know which one to use, but most return the above error or some other error which makes it clear that I made a bad choice.
I've been looking at this problem for far too long and I cannot see how to get this working, or even whether it's a problem with what I am doing or a problem with the web service.
Can you first manually make the SOAP call to the actual service endpoint and check if you're getting the expected result? The free SoapUI client is very useful for this type of troubleshooting. (Having said that, if the remote endpoint is responding correctly, I think you're on the right path to figuring this out.)

Which context should websocket config go into?

As most people, I have a root and servlet contexts. I need to enable websocket Stomp. I also need to send messages from the Service layer. So how do I configure?
If I put websocket:message-broker into the servlet config, then SimpMessagingTemplate is not autowired in the service layer. If I put it into the root, then it doesn't work at all, it isn't registered as an HTTP handler (even though logs say it does). If I put everything into the dispatcher context, then there is a
java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:252
For now I am going to work around it by calling SimpMessaging from Controller, and not Service, but I'd rather a better solution.

How do I see Exception details in SignalR when self hosted with OWIN

I am currently receiving a 500 error message when trying to connect my .NET WPF application to a server running SignalR that is self hosted with OWIN. I have tried setting the EnableDetailedErrors to true in the hub configuration. I have also tried OnIncomingError in the HubPipelineModule. Neither have worked. Any other ideas on how I can see the specific error?
You can use the IAppBuilder.UseErrorPage() extension method to see exception details instead of a blank 500 response. This method is available via the Microsoft.Owin.Diagnostics NuGet package.
Make sure you call UseErrorPage before calling MapSignalR or adding other middleware that may throw an exception.
More information on UseErrorPage can be found in the Add OWIN Diagnostics section of the following article: http://www.asp.net/aspnet/overview/owin-and-katana/getting-started-with-owin-and-katana

Thinktecture.IdentityModel.45, Routing, wants to invoke identity controller

I'm trying to use Thinktecture.IdentityModel.45 for authentication in ASP.NET Web API.
I'm trying to get the Basic Authentication to work. And have downloaded the source and got the sample to work. (JsBasicAuth).
We have Web API in the same project as a MVC application. And when the test client calls ~/api/identity all handlers and authorization work. But then the framework (web api) tries to invoke a controller called "identity" and the call fails.
{"Message":"No HTTP resource was found that matches the request URI 'http://localhost/app/api/identity'.","MessageDetail":"No type was found that matches the controller named 'identity'."}
Do I need to exclude /identity /token from the routing? What am I missing?
I now discovered the Common project in the sample solution. There is a IdentityController there. And I didn't have that in my own project. Now it works! :)

Could not find default endpoint element that references contract 'Service' error in consuming web Services in asp.net mvc

I have a problem when calling web Services in ASP.net MVC , I do the following
add the web service by add service reference to solution, and I include the service.cs file to the solution also, but when I try to create object in home controller , I have the following error
Could not find default endpoint element that references contract 'Service' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
can any one help me please
thanks
There's a couple things going on here. First, you're using SVCUTIL to generate a proxy and configuration settings for a non-WCF service - .asmx is legacy. I was able to generate a proxy and config settings, but to overcome the error you got you need to call one of the overloaded versions of WeatherHttpClient.
I'm not 100% sure, but this is what I think based on what I observed.
The reason is because there are two endpoints defined in the configuration file (one for SOAP 1.1 and one for SOAP 1.2), and since both endpoints are named there is no default endpoint to choose from.
When I used var x = new WeatherHttpClient(new BasicHttpBinding("WeatherSoap"), new EndpointAddress("http://wsf.cdyne.com/WeatherWS/Weather.asmx")); I was able to create the proxy just fine.
However, when I called GetCityForecastByZip I got the following error:
Server did not recognize the value of HTTP Header SOAPAction: http://ws.cdyne.com/WeatherWS/WeatherHttpGet/GetCityForecastByZIPRequest.
So then I used WSDL.exe to generate the proxy a la .ASMX style. I included that in my project, and the following code returned a result (after including a reference to System.Web.Services - I was using a console app):
var x = new Weather();
ForecastReturn result = x.GetCityForecastByZip("91504");`
I would suggest for simplicity using WSDL.exe to generate the proxy for your service, as it seems to be simpler.
I will also add that I've done very little MVC, but I don't think this is an MVC issue. I hope this helps you.

Resources