Consuming a WCF WsHttpBinding WebService in Java - java

I'm trying to get a Java Client to communicate with a WCF wshttpbinding WebService. But I am unable to do so. The call either hangs, or I get "musunderstoodheader expcetions".
My Web Service is just the default Visual Studio generated "WCF Service Library Template".
My Web Service Client is just a blank IntelliJ project, with the corresponding stub generated using "Add Web Service Client" (the webservice platform specified is JAX-WS 2.X).
When I change my binding to BasicHttpBinding everything works flawlessly.
I've tried playing with the WsHttpBinding configuration, including turning off security, but I've had no success.
Suggestions ? Thoughts ? Is the WsHttpBinding only partially supported by JAX-WS 2.0?

Your problem is that JAX-WS doesn't support the same WS protocols that are used in the wsHttpBinding. You need to use WSIT instead. WSIT is available as part of the Metro library, which is also available on Glassfish.
I recommend using wsHttpBinding or ws2007HttpBinding where possible, but you can still do a fairly secure service with basicHttpBinding over SSL/Transport Auth.

I would carefully examine your WCF config and remove all authenitcation, authoraization etc., properties. Remember, by default, WCF will expose your service securely when using a secure transport/binding. Therefore, unless you configure your Java client to honor those security demands, it will most likely fail to authenticate and you won't see the two converse.
Once you have the two talking, gradually work through adding each security element until you have your Java client cofigured correctly.

Related

using jax-ws in jboss

I am trying to call a web service from java. I am using JBoss as the client application server. The Web server is written in jax-ws and is running in some other server (which i dont know).
My requirement is to call the web service from my application running in JBoss. After doing enough search, I found that, jax-ws is a Standard and now included in jdk. Metro is a reference implementation of jax-ws and is provided in the Glassfish App server.
My Question is: -
Is there any other jax-ws implementation present in the market?
Just like each container provides its own implementation of Servlet API, do all of them provide implementation of Jax-ws?
Do I need to copy the Metro api to my Jboss application?
Where does JBossWS comes into play here?
A sample code provided by the Web Service host specifies that, the client needs to have to add a authentication token to the SOAPHeader, and in the sample code they have used com.sun.xml.ws package.
When I used MessageFactory to create a new SOAPMessage, will it use the Metro RI or JbossWS?
If Metro is glassfish's implementation of Jax-ws, then will it run in other app servers?
Added to that, my application exposes another Web service also (although it uses Axis 1).
I am getting a bit confused regarding this.
Can someone help me with some details regarding jax-ws, Metro, JbossWS. And where do each of them stand.
JBossWS is the Web-Service stack provided by the JBoss Application Server, and yes, it is also an implementation of the JAX-WS standard. As far as I know, JBossWS is based on Apache CXF.
Glassfish uses another implemetation of JAX-WS, Metro.
In order to communicate with a remote WebService (the implementation is not important, as long as it uses standards), you can simply use JAX-WS api and any Application Server which provides an implementation for it. JBoss does, so you have just to write your client following the JAX-WS api (and it should run on both JBoss and Glassfish or any other JAX-WS compliant container).
About the authentication, you should provide some more information, since there are a lot of options in the standards here.

java calling app not able to comunicate with WCF service

i have java appl using the rampart, metro, and soapui, open source utilities to connect to a .net wcf service
get error 500 response and message that the security validation failed. i am able to connect from the java server using a sample .net application and are able to connect.
whats the trick to get java to use .net services?
You may need to tweak the WCF service configuration to support the java clients. Install and use the WCF Interop Express wizards to help you find the correct config. If you don't control the WCF service, you still should be able to use the wizards to create a sample config they could use.

How to add a custom Callback Handler for JAX-WS client service in WebSphere 7.0/RAD 7.5

I'm trying to add a custom callback handler to a client web service (JAX-WS), but cannot find any information related to it. All the information out there requires a keystore, which was not required as part of JAX-RPC.
I'm converting several client web services from JAX-RPC to JAX-WS, and we implement the WS-Security header with a custom username token generator. For JAX-RPC, this is done via a simple wizard, where you create the token and token generator, and it inserts the WSSE information at runtime (using the custom CallbackHandler). For JAX-WS, all the WS-Security wizards require a keystore, and there's no information on just adding the custom CallbackHandler. For JAX-RPC, this configuration was done in the "WS Extension" and "WS Binding" tabs of the deployment descriptor. I've attempted to do it from the Services > Clients in my web project (which lists both RPC and WS services), but again, running into the keystore issue. I've also attempted it from the adminconsole, but it's not working as configured.
I'm using RAD 7.5 and WebSphere App Server 7.0.
How do I add a custom callback handler for WSSE to a client JAX-WS web service?
I have not been able to find out how to configure this via RAD/WebSphere. Instead, I've used the WSS API to add the username/password wsse header to the request from the client. This works identical to the JAX-RPC configuration. The WSS code can be found on the IBM site here: http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.wsfep.multiplatform.doc/info/ae/ae/twbs_confwssgeneratortoken.html

Need example of Java Client Destop App consuming Two-way SSL Secured webservice

I'm looking for an example of a java desktop application that consumes a Two-way SSL secured web service. Any tutorials or examples would be great, especially if they are based on the Eclipse IDE.
Thanks.
First, if you're not familiar with SSL, (self-signed) certificates, keytool, key store, trust store, in one word PKI, I'd suggest to start with The Fifteen Minute Guide to Mutual Authentication and Java Secure HTTP Client Key Management. These resources are just awesome and should help you to get started and to understand what you'll need on the server side and the client side (and why).
Then, I suggest to check Mutual Authentication for Web Services: A Live Example.
And for the JBoss specific setup, check out the SSLSetup page of the JBoss wiki (more precisely the Authentication scenario #4).
I'm not sure what you're looking for, an actual applications that communicates via SSL to a web service provider? SOAPui is right up your alley then - except it's a general-purpose web-service tester and not some domain-specific application.
And it's not eclipse based, although there is a SOAPui Eclipse plugin.

Java Web Service for .NET 2.0 Client on Linux (Fedora)

I'm tasked with creating a Java Web Service for a .NET 2.0 client to consume.
What would your suggestions for the implementation be?
The solution doesn't need to be very heavyweight (don't need a full Java EE container I believe) but what do you think is the best solution for this? I have thought about using Glassfish v2 with JAX-WS annotations (#WebService), and JAXB XML Bindings(e.g. #XmlElement), which I assume the .NET client would be able to consume?
Has anyone tried this scenario?
Would Glassfish be overkill though, since I'm merely using the Web Service as a mechanism for .NET on Windows to communicate to the Linux box, the underlying application is extremely small.
Any suggestions are more than welcome :)
Thanks,
James
P.S. Other notes - would you use Axis/CXF instead of Glassfish? Would you use a servlet container such as Tomcat? etc.
I have used Axis2 and it works.
I had the same problem of making Data Exposing API (Web Service in my case) in Java.
I made the web service using Axis2 and Spring (to access database) and the WSDL created via Axis2 was easily consumed via ASP.NET Application via its Add Web Service Dialog Box and the corresponding Proxy Classes were created easily.

Categories