Internal server error axis2 Tomcat service wsdl - java

I'm getting an Internal server error when try to see the wsdl from a service that I deployed in axis2.
Only the sample service of axis works "Version?wsdl".
Funny thing is that I'm able to see the xsd from my service, i.e "service?xsd", but not the wsdl.
Any ideas?
I'm using axis2-1.5.6 and Tomcat 7.0.

If you are using https, you have to add following to your axis2.xml file
<transportReceiver name="https"
class="org.apache.axis2.transport.http.AxisServletListener">
<parameter name="port">8443</parameter>
</transportReceiver>
(full article)
This enables https listeren for axis2. It is not enabled by default (unlike http access) .
the axis2.xml file can be found here:
$CATALINA_HOME/webapps/axis2/WEB-INF/conf/axis2.xml

Related

Consuming a webservice with CXF in Mule 3.5

I am trying to consume web service using CXF component in mule(Anypoint Studio).
So I tried genrating the WSDL file from URL but I was getting this errror: Rpc/encoded wsdls are not supported in CXF so I followed this answer.
It worked and it generated client stubs, then copied the files into my mule project.
but I am getting this error:
Service.SomeService.<init>(java.net.URL, javax.xml.namespace.QName) (java.lang.NoSuchMethodException)
This is my flow:
<flow name="WebServiceTest">
<cxf:jaxws-client
clientClass="service.SomeService"
wsdlLocation="http://127.0.0.1:8000/api/v2_soap/?wsdl"
operation="test"/>
<outbound-endpoint address="http://127.0.0.1:8000/api.php/?type=v2_soap"/>
</flow>
Any ideas?
Your configuration is not correct specially your outbound endpoint url.
You can try configuring a CXF client as per Mule documentation.
You can also build a client for your JAX-WS services without generating a client from WSDL. Here you need a copy of your service interface and all your data objects locally to use something like this :-
<flow name="csvPublisher">
...
<cxf:jaxws-client serviceClass="org.example.HelloService" operation="sayHi"/>
<outbound-endpoint address="http://localhost:63081/services/greeter"/>
</flow>
Another approach is you can use a CXF-generated client as an outbound endpoint. First, you need to generate a CXF client using the WSDL to Java tool from CXF or the Maven plugin.
Then you need to configure something like the following :-
<flow name="csvPublisher">
...
<cxf:jaxws-client
clientClass="org.apache.hello_world_soap_http.SOAPService"
port="SoapPort"
wsdlLocation="classpath:/wsdl/hello_world.wsdl"
operation="greetMe"/>
<outbound-endpoint address="http://localhost:63081/services/greeter"/>
</flow>
It is better to put the wsdl in your local classpath.
Please checkout the full documentation here as reference to get it configured :-
https://docs.mulesoft.com/mule-user-guide/v/3.7/consuming-web-services-with-cxf
and
Consuming a Webservice Using Mule 3.4

Difference between ".wsdl"and "?wsdl" in wsdl Url

I have a jax-ws web service deployed on web sphere server and when I am trying to access the wsdl in browser with the url
"Http://localhost:7001/HelloWorldService/port/helloworld?wsdl"
I see that the url is getting changed to the below one
"Http://localhost:7001/HelloWorldService/port/helloworld/HelloWorldService.wsdl"
Can someone explain the difference between these both .wsdl and ?wsdl and what needs to be done to keep the url same as ?wsdl instead of getting changed to .wsdl?
helloworld?wsdl --> is just a request to the service provider so you can get the wsdl.
HelloWorldService.wsdl" --> This is the actual file that describes the service which has set of endpoints.

.net web service as a client of java web service

I have a .net 4.0 web app which needs to connect to a customer's web service, written in Java (it has cxf in the service endpoint)
Their service endpoint is https, and ultimately I will need to supply an x509 credential, but not yet.
They do not allow discovery, they dont expose a mex endpoint, they have supplied us with a wsdl and xsds, and I've managed to create a client proxy.
I'm struggling to set the right wcf client configuration. What I have so far is this: (names changed for obvious reasons).
<system.serviceModel>
<bindings>
<basicHttpsBinding>
<binding name="CUSwsBinding" />
</basicHttpsBinding>
</bindings>
<client>
<endpoint address="https://customer.com/cxf/customerMaintenance/"
binding="basicHttpsBinding" bindingConfiguration="CUSwsBinding"
contract="CUSCustomer.Customerxxx" name="CUSCustomerWS" />
</client>
</system.serviceModel>
When I try and execute, it says the basicHttpBinding extension is not recognised. I see there are some bindings that only are supported in .net 4.5, however my manager has Fear, Uncertainty and Doubt, and our web app has to stay on 4.0
Not an expert in WCF, so any help welcome.
As someone suggested, one can create an instance of the proxy class:
var client = new proxy.ClientClass();
At this line it throws a Configuration binding extension 'system.serviceModel/bindings/basicHttpsBinding' could not be found.
The endpointaddress needs to be in config, as its currently pointing at a test environment, will be poiting at production

Websocket issue on wildfly cluster

I am using richfaces a4j:push in my Spring-JSF integrated application. I am able to push messages to the browser using websocket in my non cluster environment on wildfly 8.0.0.
When I deploy the application on wildfly8.0.0 on redhat enterprise 7.0 with httpd clustering the push messages are not working.
I get the following error on cluster environment:
17:15:22,862 ERROR [io.undertow.request] (default task-3) UT005023: Exception handling request to /star/__richfaces_push: java.lang.IllegalStateException: UT000077: The underlying transport does not support HTTP upgrade.
My cluster is configured with mod_cluster, referring the document
When I look for details on error UT000077, it says ‘Apache httpd doesn't support HTTP upgrade out of box’ I understand HTTP upgrade is required for websocket communication. It is suggested to use mod_proxy_wstunnel. However the details are not available for this configuration.
Any pointers/suggestions are much appreciated.
At the time of this answer AJP [which is the default one] does not support HTTP upgrade and hence not websocket.
If you switch to HTTP websocket will work.
Following changes you need to do to switch to AJP
Change
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
To
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
[comment out proxy_ajp_module and added proxy_http_module]
In modcluster sub-system
Change
<subsystem xmlns="urn:jboss:domain:modcluster:1.2">
<mod-cluster-config advertise-socket="modcluster" connector="ajp">
<dynamic-load-provider>
<load-metric type="cpu"/>
</dynamic-load-provider>
</mod-cluster-config>
</subsystem>
To
<subsystem xmlns="urn:jboss:domain:modcluster:1.2">
<mod-cluster-config advertise-socket="modcluster" connector="default">
<dynamic-load-provider>
<load-metric type="cpu"/>
</dynamic-load-provider>
</mod-cluster-config>
</subsystem>
[“default” is the name of the http listener]
Also you need to load mod_proxy_wstunnel in your httpd
MODCLUSTER-438 WebSocket support for mod_cluster
Let me give my two cents in this question to people there are using Apache 2.2.x If are you using Apache 2.2.x you need to compile the mod_proxy_wstunnel from Apache 2.4 for Apache 2.2.x This link have a how to do it. Following, to achieve WebSockets with mod_cluster you need also compile mod_cluster 1.3.3+ as described in this link and add EnableWsTunnel in your mod_cluster.conf outside your virtual host
I hope helps.

WCF Authentication Service - How to generate client using Apache Axis?

I have an ASP.NET application hosting a few WCF services, using ASP.NET Membership for security. I've exposed the System.Web.ApplicationServices.AuthenticationService through an SVC file (AuthenticationService.svc) as shown below:
<%# ServiceHost Language="C#" Debug="true" Service="System.Web.ApplicationServices.AuthenticationService" %>
My WCF configuration for this service is as follows:
<service name="System.Web.ApplicationServices.AuthenticationService" behaviorConfiguration="AuthenticationServiceBehaviors">
<endpoint contract="System.Web.ApplicationServices.AuthenticationService" binding="basicHttpBinding"/>
</service>
...
<behavior name="AuthenticationServiceBehaviors">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true"/>
</behavior>
...
<bindings>
<basicHttpBinding>
<binding allowCookies="true"></binding>
</basicHttpBinding>
</bindings>
I've enabled the authentication service in my web.config as shown below:
<system.web.extensions>
<scripting>
<webServices>
<authenticationService enabled="true" requireSSL="false"/>
</webServices>
</scripting>
</system.web.extensions>
I created a .NET console application to test the service. Visual Studio generated a client, and the service worked as expected. My problem is that I need to use this service from a Java application, but when I try to generate a client in Eclipse using Apache Axis, I get the following error:
IWAB0399E Error in generating Java from WSDL: java.io.IOException: Emitter failure.
There is an undefined portType (AuthenticationService) in the WSDL document
http://localhost:17637/Services/AuthenticationService.svc?wsdl=wsdl0.
Hint: make sure <binding type=".."> is fully qualified.
I've tracked it down to Apache Axis needing different namespace and name in the ServiceContract and ServiceBehavior, thanks to this post. I've changed other WCF services as that post shows, and they work just fine. The problem is that System.Web.ApplicationServices.AuthenticationService looks like this (from http://msdn.microsoft.com/en-us/library/system.web.applicationservices.authenticationservice.aspx):
[ServiceBehaviorAttribute(Namespace = "http://asp.net/ApplicationServices/v200", InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)]
[AspNetCompatibilityRequirementsAttribute(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
[ServiceContractAttribute(Namespace = "http://asp.net/ApplicationServices/v200")]
public class AuthenticationService
Notice the ServiceBehaviorAttribute namespace is the same as the ServiceContractAttribute namespace? I need them to be different so I can get Eclipse (Apache Axis) to generate a client. Any ideas?
I do not think is possible to change name of built-in service. You should be allowed for wrapping built-in service in other service or for writing custom service handle authentication.

Categories